[Developers] Reverse sort with non-null values last or only non-null values
Jack Alves
jack at metaweb.com
Fri Mar 16 05:43:50 UTC 2007
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?
More information about the Developers
mailing list