[Developers] Freebase users on Google Maps: Better MQL?

Kurt Bollacker kurt at metaweb.com
Wed May 9 16:32:52 UTC 2007


On Wed, May 09, 2007 at 04:09:06PM +0200, Will Moffat wrote:
> Hi,
> 
> I'm trying to improve the MQL queries (see below) that I use for my
> mashup "Freebase users on Google Maps"
> http://hamstersoup.wordpress.com/
> 
> Since many people haven't filled in "my_full_name" in their user
> profile I also search on their username. I have to make 2 almost
> identical queries  (and get 2 almost identical sets of results)
> because of a lack of an OR construct in MQL. This seems pretty
> inefficient.
> 
> Am I missing something? Is there a better way?

You're not missing anything obvious.  There *is* a way to combine
these into a single using the "/type/reflect" reflection properties.
The query is not pretty, but does allow a limited OR construct.  Your
query could be rewritten to look like:

{
  "query":[{
    "/type/reflect/any_value":[{
      "link":{
        "master_property":{
          "id":null,
          "id|=":["/type/object/name","/freebase/user_profile/my_full_name"]
        }
      },
      "type":"/type/text",
      "value":null,
      "value~=":"*fi*"
    }],
    "id":null,
    "limit":10,
    "location":[{
      "geolocation":{
        "latitude":null,
        "longitude":null
      },
      "id":null,
      "limit":1,
      "name":null
    }],
    "my_full_name":null,
    "name":null,
    "personal_quote":null,
    "type":"/freebase/user_profile"
  }]
}

I hope this helps...						Kurt :-)


 
> thanks,
> --Will
> 
> 
> Query1: Search for users with "fi" in their username:
> [{
>   "id":null,
>   "limit":10,
>   "location":[{
>     "geolocation":{
>       "latitude":null,
>       "longitude":null
>     },
>     "id":null,
>     "limit":1,
>     "name":null
>   }],
>   "my_full_name":null,
>   "name":null,
>   "name~=":"*fi*",
>   "personal_quote":null,
>   "type":"/freebase/user_profile"
> }]
> 
> Query2: Search for users with "fi" in their full name
> [{
>   "id":null,
>   "limit":10,
>   "location":[{
>     "geolocation":{
>       "latitude":null,
>       "longitude":null
>     },
>     "id":null,
>     "limit":1,
>     "name":null
>   }],
>   "my_full_name":null,
>   "my_full_name~=":"*fi*",
>   "name":null,
>   "personal_quote":null,
>   "type":"/freebase/user_profile"
> }]
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list