[Developers] PHP Integration Problems

Chris Eppstein chris at eppsteins.net
Thu Jan 3 00:25:45 UTC 2008


I wonder if the problem is just that the query isn't being placed  
within the request envelope. That would make it work in the editor but  
not via code. The request you send via mqlread should look like this
{ 'qname' : { 'query' : query_in_the_query_editor }}

This was a gotcha for me on a couple of occasions until I abstracted  
it away.

-chris


On Jan 2, 2008, at 2:22 PM, Tim Kientzle wrote:

> If you get no results without the limit, it's probably timing out on
> the server.
>
> You'll need to use a cursor to request "pages" of data at a time.  On
> freebase.com,
> search for "MQL Cursors" and you'll get a few useful hits, including
> some examples:
>
> http://www.freebase.com/view/search?limit=30&start=0&query=mql+cursor
>
> You should probably start with the documentation here:
>
> http://www.freebase.com/view/guid/9202a8c04000641f800000000544e139
>
>
>
> On Jan 2, 2008, at 1:12 PM, Chris Mahon wrote:
>
>> Hi Chris,
>>
>> Thanks for the reply. Starting to make more sense, I can't see how I
>> would use games_on_this_platform then? I.E. what can I do with it?
>> My query was the same as on the Query Builder/Editor which did
>> return results so it was odd that PHP did not. Anyway, I've made
>> good progress and now have results coming back!
>>
>> One quick question though. I am adding a limit to my query, above
>> the default 100. However when I do this it does not return results
>> for my query. If I take the limit out, I get results. Any ideas? Is
>> there a way of getting it to return ALL matches without limit?
>>
>> Query is now as follows:
>>
>> $q2 = array(array("/common/topic/image" => array(array("optional" =>
>> true, "id" => null)),
>> 					 "type" => "/cvg/computer_videogame",
>> 					 "name" => null,
>> 					 "id" => null,
>> 					 "sort" => "name",
>> 					 "release_date" => array(),
>> 					 "cvg_genre" => array(),
>> 					 "versions" => array("platform" => array("id" => null, "name"
>> => null, "name~=" => "Xbox 360")),
>> 					 "limit" => 150
>> 	));
>>
>> Cheers,
>> Chris
>>
>> On Jan 1, 2008 5:53 PM, Christopher R. Maden <crism at metaweb.com>
>> wrote:
>> Chris Mahon <darthmahon at gmail.com> wrote:
>>> I'm currently building a search page for computer games and have
>> come across
>>> some teething problems whilst using freebase.
>>>
>>> This is the query I based that on from within the freebase query
>> builder:
>>>
>>> [{
>>> "type":"/cvg/cvg_platform",
>>> "games_on_this_platform":[{ "game":[{ "name":null }] }],
>>> "name":"Xbox 360"
>>> }]
>>
>> Happy new year, Chris.  The problem with using foreach on the result
>> of that query is that it returns a single thing: the platform called
>> "Xbox 360."  Now, it has a number of games on that platform, but the
>> root of the query is just the platform itself.
>>
>> You can turn the query inside-out, to find games whose platform is
>> the Xbox 360, or you can iterate over the games on that platform,
>> instead of iterating over the platform itself.
>>
>> ~Chris
>> --
>> Christopher R. Maden
>> Data Architect
>> Metaweb Technologies, Inc.
>> <URL: http://www.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



More information about the Developers mailing list