<span class="Apple-style-span" style="font-family: arial, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Hi Guys,</span></span><div><span class="Apple-style-span" style="font-family: arial, sans-serif;">
<span class="Apple-style-span" style="font-size: small;"><br class="webkit-block-placeholder"></span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif;"><span class="Apple-style-span" style="font-size: small;">
Tim - thanks for the info, I&#39;ll look into MQL Cursors.</span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br class="webkit-block-placeholder">
</span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Chris - I checked to see if the query produced was the same and I believe it is. This is what PHP outputs:
</span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br class="webkit-block-placeholder"></span></span></div><div><span class="Apple-style-span" style="font-size: small;">
<span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace;">{&quot;qname&quot;:{&quot;query&quot;:[{&quot;\/common\/topic\/image&quot;:[{&quot;optional&quot;:true,&quot;id&quot;:null}],&quot;type&quot;:&quot;\/cvg\/computer_videogame&quot;,&quot;name&quot;:null,&quot;id&quot;:null,&quot;sort&quot;:&quot;name&quot;,&quot;release_date&quot;:[],&quot;cvg_genre&quot;:[],&quot;versions&quot;:{&quot;platform&quot;:{&quot;id&quot;:null,&quot;name&quot;:null,&quot;name~=&quot;:&quot;Xbox 360&quot;}},&quot;limit&quot;:150}]}}
</span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br class="webkit-block-placeholder"></span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif;">
<span class="Apple-style-span" style="font-size: small;">I ran the above query in freebase and it produced results. This is the PHP that passes my query through:</span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif;">
<span class="Apple-style-span" style="font-size: small;"><br class="webkit-block-placeholder"></span></span></div><div><span class="Apple-style-span" style="font-family: Times; font-size: 16px;"><div><span class="Apple-style-span" style="font-size: small;">
<span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace;">// Put the query into an envelope object</span></span></div><div><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace;">
$envelope = array(&quot;qname&quot; =&gt; array(&quot;query&quot; =&gt; $queryobj));</span></span></div><div><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace;">
<br class="webkit-block-placeholder"></span></span></div><div><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace;">// Serialize the envelope object to JSON text
</span></span></div><div><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace;">$querytext = $this-&gt;json-&gt;encode($envelope);</span>
</span></div></span><div><br class="webkit-block-placeholder"></div><div>Thanks,</div><div>Chris</div><br><div class="gmail_quote">On Jan 3, 2008 12:25 AM, Chris Eppstein &lt;<a href="mailto:chris@eppsteins.net">chris@eppsteins.net
</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I wonder if the problem is just that the query isn&#39;t being placed<br>within the request envelope. That would make it work in the editor but
<br>not via code. The request you send via mqlread should look like this<br>{ &#39;qname&#39; : { &#39;query&#39; : query_in_the_query_editor }}<br><br>This was a gotcha for me on a couple of occasions until I abstracted<br>
it away.<br><font color="#888888"><br>-chris<br></font><div><div></div><div class="Wj3C7c"><br><br>On Jan 2, 2008, at 2:22 PM, Tim Kientzle wrote:<br><br>&gt; If you get no results without the limit, it&#39;s probably timing out on
<br>&gt; the server.<br>&gt;<br>&gt; You&#39;ll need to use a cursor to request &quot;pages&quot; of data at a time. &nbsp;On<br>&gt; <a href="http://freebase.com" target="_blank">freebase.com</a>,<br>&gt; search for &quot;MQL Cursors&quot; and you&#39;ll get a few useful hits, including
<br>&gt; some examples:<br>&gt;<br>&gt; <a href="http://www.freebase.com/view/search?limit=30&amp;start=0&amp;query=mql+cursor" target="_blank">http://www.freebase.com/view/search?limit=30&amp;start=0&amp;query=mql+cursor
</a><br>&gt;<br>&gt; You should probably start with the documentation here:<br>&gt;<br>&gt; <a href="http://www.freebase.com/view/guid/9202a8c04000641f800000000544e139" target="_blank">http://www.freebase.com/view/guid/9202a8c04000641f800000000544e139
</a><br>&gt;<br>&gt;<br>&gt;<br>&gt; On Jan 2, 2008, at 1:12 PM, Chris Mahon wrote:<br>&gt;<br>&gt;&gt; Hi Chris,<br>&gt;&gt;<br>&gt;&gt; Thanks for the reply. Starting to make more sense, I can&#39;t see how I<br>&gt;&gt; would use games_on_this_platform then? 
I.E. what can I do with it?<br>&gt;&gt; My query was the same as on the Query Builder/Editor which did<br>&gt;&gt; return results so it was odd that PHP did not. Anyway, I&#39;ve made<br>&gt;&gt; good progress and now have results coming back!
<br>&gt;&gt;<br>&gt;&gt; One quick question though. I am adding a limit to my query, above<br>&gt;&gt; the default 100. However when I do this it does not return results<br>&gt;&gt; for my query. If I take the limit out, I get results. Any ideas? Is
<br>&gt;&gt; there a way of getting it to return ALL matches without limit?<br>&gt;&gt;<br>&gt;&gt; Query is now as follows:<br>&gt;&gt;<br>&gt;&gt; $q2 = array(array(&quot;/common/topic/image&quot; =&gt; array(array(&quot;optional&quot; =&gt;
<br>&gt;&gt; true, &quot;id&quot; =&gt; null)),<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;type&quot; =&gt; &quot;/cvg/computer_videogame&quot;,<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;name&quot; =&gt; null,
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;id&quot; =&gt; null,<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;sort&quot; =&gt; &quot;name&quot;,<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;release_date&quot; =&gt; array(),
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cvg_genre&quot; =&gt; array(),<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;versions&quot; =&gt; array(&quot;platform&quot; =&gt; array(&quot;id&quot; =&gt; null, &quot;name&quot;
<br>&gt;&gt; =&gt; null, &quot;name~=&quot; =&gt; &quot;Xbox 360&quot;)),<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;limit&quot; =&gt; 150<br>&gt;&gt; &nbsp; &nbsp; &nbsp;));<br>&gt;&gt;<br>&gt;&gt; Cheers,<br>&gt;&gt; Chris
<br>&gt;&gt;<br>&gt;&gt; On Jan 1, 2008 5:53 PM, Christopher R. Maden &lt;<a href="mailto:crism@metaweb.com">crism@metaweb.com</a>&gt;<br>&gt;&gt; wrote:<br>&gt;&gt; Chris Mahon &lt;<a href="mailto:darthmahon@gmail.com">darthmahon@gmail.com
</a>&gt; wrote:<br>&gt;&gt;&gt; I&#39;m currently building a search page for computer games and have<br>&gt;&gt; come across<br>&gt;&gt;&gt; some teething problems whilst using freebase.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; This is the query I based that on from within the freebase query
<br>&gt;&gt; builder:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; [{<br>&gt;&gt;&gt; &quot;type&quot;:&quot;/cvg/cvg_platform&quot;,<br>&gt;&gt;&gt; &quot;games_on_this_platform&quot;:[{ &quot;game&quot;:[{ &quot;name&quot;:null }] }],
<br>&gt;&gt;&gt; &quot;name&quot;:&quot;Xbox 360&quot;<br>&gt;&gt;&gt; }]<br>&gt;&gt;<br>&gt;&gt; Happy new year, Chris. &nbsp;The problem with using foreach on the result<br>&gt;&gt; of that query is that it returns a single thing: the platform called
<br>&gt;&gt; &quot;Xbox 360.&quot; &nbsp;Now, it has a number of games on that platform, but the<br>&gt;&gt; root of the query is just the platform itself.<br>&gt;&gt;<br>&gt;&gt; You can turn the query inside-out, to find games whose platform is
<br>&gt;&gt; the Xbox 360, or you can iterate over the games on that platform,<br>&gt;&gt; instead of iterating over the platform itself.<br>&gt;&gt;<br>&gt;&gt; ~Chris<br>&gt;&gt; --<br>&gt;&gt; Christopher R. Maden<br>&gt;&gt; Data Architect
<br>&gt;&gt; Metaweb Technologies, Inc.<br>&gt;&gt; &lt;URL: <a href="http://www.metaweb.com/" target="_blank">http://www.metaweb.com/</a> &gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; Developers mailing list
<br>&gt;&gt; <a href="mailto:Developers@freebase.com">Developers@freebase.com</a><br>&gt;&gt; <a href="http://lists.freebase.com/mailman/listinfo/developers" target="_blank">http://lists.freebase.com/mailman/listinfo/developers
</a><br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; Developers mailing list<br>&gt;&gt; <a href="mailto:Developers@freebase.com">Developers@freebase.com</a><br>&gt;&gt; <a href="http://lists.freebase.com/mailman/listinfo/developers" target="_blank">
http://lists.freebase.com/mailman/listinfo/developers</a><br>&gt;<br>&gt; _______________________________________________<br>&gt; Developers mailing list<br>&gt; <a href="mailto:Developers@freebase.com">Developers@freebase.com
</a><br>&gt; <a href="http://lists.freebase.com/mailman/listinfo/developers" target="_blank">http://lists.freebase.com/mailman/listinfo/developers</a><br><br>_______________________________________________<br>Developers mailing list
<br><a href="mailto:Developers@freebase.com">Developers@freebase.com</a><br><a href="http://lists.freebase.com/mailman/listinfo/developers" target="_blank">http://lists.freebase.com/mailman/listinfo/developers</a><br></div>
</div></blockquote></div><br></div>