[Developers] Errors and results using Python API

Christopher R. Maden crism at metaweb.com
Thu Aug 7 23:36:08 UTC 2008


David Janes wrote:
> I'm making the following query
> 
> name = 'The Godfather'
> query = {
>     'name~=' : '*%s*' % name,
>     'name' : [],
> }

The curly braces in the outermost layer of the query mean that you 
expect a dictionary back — a single object.

Freebase is unable to give you the single object called something like 
“The Godfather” because there are at least 8 such.  Instead, it gives 
you an error and tells you why.

Whenever there is the possibility of more than one value, you must use 
[] as the outermost wrapper, so that MQL can give you back the same kind 
of thing you asked for (a dictionary or a list).

HTH,
Chris
-- 
Christopher R. Maden
Data Architect
Freebase.com: <URL: http://www.freebase.com/ >
Metaweb Technologes, Inc. <URL: http://www.metaweb.com/ >


More information about the Developers mailing list