Reputation: 7110
Freebase contains a fair amount of documentation but lacks some specific examples of working code for many scenarios.
One of them is how to implement (in Python, using the Python Freebase library) a query using their eMQL service. Which is an extended version of their MQL service. The documentation states that you need to "set the envelope parameter to extended=true", but I cannot figure out how to actually do that (get the syntax right).
Here is the doc on the service I am trying to use: http://www.freebase.com/docs/mql_extensions/common#service
Here is an example of the code I am trying to get working using the extended service:
query = {
"extended": True,
"query": [{
"id": "/en/settlers_of_catan",
"/common/topic/weblink": [{
"description": "Wikipedia",
"url": None
}]
}]
}
result = freebase.sandbox.mqlread(query)
This fails, with the error, "Type /type/object does not have property extended". Which I believe is telling me I am not actually setting the extended property and am trying to do it in the wrong place.
Upvotes: 1
Views: 259
Reputation: 7110
And the answer is simple - pass the envelope setting (in this case 'extended=true' to the mqlread function.
result = freebase.sandbox.mqlread(query, extended=True)
Of course note the capitalization of T in True.
Upvotes: 2