[Developers] query API - overuse and sanctions?

Vishal Talwar vishal at metaweb.com
Fri May 8 19:32:16 UTC 2009


Ah, sorry, I didn't read the earlier emails carefully enough. The new query editor is smart enough to automatically prefix the duplicated keys (eg. in Kirrily's query, it's "ns0:name"). In the old query editor, you would actually see the duplicates disappear before your eyes after hitting the "Format" button. As the MQL reference guide explains:

"""
Unfortunately, this query is not valid JSON: it includes the same property name twice, which means that cannot be parsed into object form. (To put this another way, you could not represent this query in a dictionary or hash data structure in a programming language like Python, Ruby or JavaScript.)
""" http://mql.freebaseapps.com/ch03.html#id2952288

So since keys must be unique, there has to be one winner. With MQL it seems that the last key wins and the query can thus be rewritten as:

{
  "id": null,
  "name": null,
  "limit": 1,
  "type": "/people/person"
}

Freebase simply returns the first person it finds, and it happens to be Jack Abramoff.

Vishal 

----- Original Message -----
From: "Michael Callaghan" <john.michael.callaghan at gmail.com>
To: "For discussions about MQL, Freebase API and apps built on Freebase" <developers at freebase.com>
Sent: Friday, May 8, 2009 12:12:50 PM GMT -08:00 US/Canada Pacific
Subject: Re: [Developers] query API - overuse and sanctions?


Vishal 

Thanks but I'm quite aware of the error in the query. I only included it out of interest given the odd result it returns... 

Michael 



2009/5/8 Vishal Talwar < vishal at metaweb.com > 


Hi Michael, 

You have "name" in there twice, as "Samuel Adams" first and then null. Looks like null is winning. Try: 

http://www.freebase.com/api/service/mqlread?query={%22query%22:{%22limit%22:1,%22type%22%20:%22/people/person%22,%22name%22:%22Samuel%20Adams%22,%22id%22%20:%20null}} 

Vishal 




----- Original Message ----- 
From: "Michael Callaghan" < john.michael.callaghan at gmail.com > 
To: "For discussions about MQL, Freebase API and apps built on Freebase" < developers at freebase.com > 
Sent: Friday, May 8, 2009 12:02:23 PM GMT -08:00 US/Canada Pacific 
Subject: Re: [Developers] query API - overuse and sanctions? 


Kirrily 

http://www.freebase.com/api/service/mqlread?query={%22query%22:{%22limit%22:1,%22type%22%20:%22/people/person%22,%22name%22:%22Samuel%20Adams%22,%22name%22:null,%22id%22%20:%20null}} 

Thanks for the numbers. 

As for the query, I just tried the above on a different computer and good ol' Jack Abramoff came back ... (Note, it's the mqlread service and not the queryeditor as in your link) 

Michael 




2009/5/8 Kirrily Robert < kirrily at metaweb.com > 



On 08/05/2009, at 9:54 AM, Michael Callaghan wrote: 

> {"query":{"limit":1,"type" :"/people/person","name":"Samuel 
> Adams","name":null,"id" : null} 


Looks OK to me: http://www.freebase.com/app/queryeditor?q={%22limit 
%22%3A%201%2C%20%22type%22%3A%20%22%2Fpeople%2Fperson%22%2C%20%22name 
%22%3A%20%22Samuel%20Adams%22%2C%20%22ns0%3Aname%22%3A%20null%2C 
%20%22id%22%3A%20null%20} 

Wrt API overuse, just FYI, our limit is 100,000 queries per day. "A 
few thousand" shouldn't affect you. 

K. 

-- 
Kirrily Robert 
Freebase Community Director 
kirrily at metaweb.com 






_______________________________________________ 
Developers mailing list 
Developers at freebase.com 
http://lists.freebase.com/mailman/listinfo/developers 


_______________________________________________ 
Developers mailing list 
Developers at freebase.com 
http://lists.freebase.com/mailman/listinfo/developers 
_______________________________________________ 
Developers mailing list 
Developers at freebase.com 
http://lists.freebase.com/mailman/listinfo/developers 


_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers


More information about the Developers mailing list