[Developers] Reverse sort with non-null values last or onlynon-null values
Jack Alves
jack at metaweb.com
Sat Mar 17 01:31:13 UTC 2007
I accomplished displaying non-null values at the end using a mjt script. I
did the query for all results then repeated mjt.for loops with mjt.if
statements,
mjt.if="f.schema['/freebase/type_profile/instance_count'] != null">
mjt.if="f.schema['/freebase/type_profile/instance_count'] == null">
-----Original Message-----
From: developers-bounces at freebase.com
[mailto:developers-bounces at freebase.com] On Behalf Of Jack Alves
Sent: Thursday, March 15, 2007 10:44 PM
To: developers at freebase.com
Subject: [Developers] Reverse sort with non-null values last or onlynon-null
values
I built a query to find all properties with expected_type=datetime. I want
to reverse sort by the instance_count of the type that contains the property
but I want null values to appear at the end of the results.
Initially I tried the query below and discovered null values are returned
first.
{
"query":[{
"properties":[{
"expected_type":"/type/datetime",
"name":null,
"schema":{
"/freebase/type_profile/instance_count":null,
"name":null
}
}],
"sort":"-properties.schema./freebase/type_profile/instance_count",
"type":"/type/type"
}]
}
Then I figured out how to reverse sort the non-null results (thanks to
previous email thread Ketan/Dae).
{
"query":[{
"properties":[{
"expected_type":"/type/datetime",
"name":null,
"schema":{
"/freebase/type_profile/instance_count":{
"value":null
},
"name":null
}
}],
"sort":"-properties.schema./freebase/type_profile/instance_count.value",
"type":"/type/type"
}]
}
How do query for only null values? Is there a better way to do this? Do I
need to parse the results in my script?
_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers
More information about the Developers
mailing list