Skip to content

Get chemical elements with and without boiling point data from Freebase

In response to my question on the Freebase developers list [Developers] how to get items with properties having null values?, Chris Maden of Metaweb quickly wrote me the following solution:

To find all elements *with* boiling points:

[
   {
     "atomic_number" : null,
     "boiling_point" : {
       "value" : null
     },
     "name" : null,
     "sort" : "atomic_number",
     "type" : "/chemistry/chemical_element"
   }
]

By putting the value in an object, you are requiring a value to be present; a simple null matches no value at all.

You can find all elements *without* boiling points like this:

[
   {
     "atomic_number" : null,
     "boiling_point" : {
       "optional" : "forbidden",
       "value" : null
     },
     "name" : null,
     "sort" : "atomic_number",
     "type" : "/chemistry/chemical_element"
   }
]

The "value" clause matches only values that are present; the "optional":"forbidden" directive then eliminates them.

Post a Comment

You must be logged in to post a comment.