[Developers] Two MQL questions

John Giannandrea jg at metaweb.com
Sun Sep 30 04:08:00 UTC 2007


Kirrily Robert wrote:
> 1) If I want to find users in Australia I can naively search for
> "location":"Australia", but what if someone has specified some smaller
> location within Australia, eg. "Melbourne, Australia" or "North
> Carlton, Victoria" or even "Building 3, Engineering department,

Right now you would have to do several queries with multiple plies  
out. e.g.

{
   "q1":{
     "query":[{
       "location":[{
         "containedby":"Australia",
         "name":null
       }],
       "name":null,
       "return":"count",
       "type":"/freebase/user_profile"
     }]
   },
   "q2":{
     "query":[{
       "location":[{
         "containedby":[{
           "containedby":"Australia",
           "name":null
         }],
         "name":null
       }],
       "name":null,
       "return":"count",
       "type":"/freebase/user_profile"
     }]
   }
}


The problem with this is that you need to merge the user lists
because some locations have two containedby's.

Either we need an OR feature in MQL,  or we need a transitive operator
that would look up the chain for you.  Both have been discussed.

> 2) How do you search between two dates, eg. People born between  
> 1970 and 1980.

   "query":[{
     "date_of_birth":null,
     "date_of_birth<":"1980",
     "date_of_birth>=":"1970",
     "name":null,
     "type":"/people/person"
   }]

Its a big set, so dont try to sort or count them, yet.

-jg



More information about the Developers mailing list