[Developers] timeout? bah!
Stefano Mazzocchi
stefano at metaweb.com
Wed Mar 18 05:28:10 UTC 2009
John Giannandrea wrote:
> spencer kelly wrote:
>> so willmoffat has beat the timeout:
>> http://mqlx.com/~willmoffat/learn_feature/cursor/cursor.html
>> but theres no documentation, he's on vacation, and i cant figure out
>> how to clone it.
>
> what's the timeout you are having?
>
> general cursor documentation is here:
> http://mql.freebaseapps.com/ch04.html#envelopeparameters
Or, if you know python, you can do this:
1) go to http://code.google.com/p/freebase-python/
2) check out the 'freebase-api' from source (sorry, no downloads)
3) install the freebase-api in your python environment (python setup.py
install or something like that)
4) use the following code
-------------------- cut here --------------------------
#!/usr/bin/env python
from freebase.api import HTTPMetawebSession, MetawebError
query = {
... put your mql query here...
}
freebase = HTTPMetawebSession('freebase.com')
iterator = freebase.mqlreaditer(query)
for topic in iterator:
... do something with the returned topic, one by one ...
--------------------- cut here --------------------------
Note how the 'query' needs to be for a single topic, not for many (I'm
telling you because I got burned myself the other day).
I've been using scripts like the above to obtain dumps of particular
subsets of the freebase graph and it works with cursors, so timeouts are
not a problem (which is what Will used).
HTH
--
Stefano Mazzocchi Application Catalyst
Metaweb Technologies, Inc. stefano at metaweb.com
-------------------------------------------------------------------
More information about the Developers
mailing list