Reputation: 11888
I would like to query freebase, to get some basic information about a celebrity. For example, I would like to get the place of birth, and the gender of Madonna.
I achieved to get Madonna's friends by using:
https://www.googleapis.com/freebase/v1/mqlread?&query={"id":"/en/madonna","name":null,"type":"/base/popstra/celebrity","/base/popstra/celebrity/friendship":[{"participant":[]}]}
But, I'm understanding this request pretty badly. How can I change it to get the information I talked above ?
I was thinking about :
https://www.googleapis.com/freebase/v1/mqlread?&query={"id":"/en/madonna","name":null,"type":"/base/popstra/celebrity","/base/popstra/celebrity/gender":[{"gender":}], "/base/popstra/celebrity/place_of_birth":[{"place of birth":}]}
but it's not working ofc.
Upvotes: 1
Views: 424
Reputation: 4603
Here is how you build MQL queries for Freebase topics:
Go the the Query Editor and build a simple query for the ID of that topic:
[{ "id": "/en/madonna", "name": null }]
Go to the sample topic page, click on "Edit this topic" and find the facts that you want to query for (ex. Date of birth)
Add the properties that you want to your query like so:
[{ "id" "/en/madonna", "name": null, "/people/person/date_of_birth": null, "/people/person/gender": null }]
Queries can also specify a default type (ex. /people/person) which makes the property paths shorter:
[{ "id" "/en/madonna", "name": null, "type": "/people/person", "date_of_birth": null, "gender": null }]
But each level of query can only have one default type so if you want to mix in properties from other types you'll need to use the full property IDs:
[{ "id": "/en/madonna", "name": null, "type": "/people/person", "date_of_birth": null, "gender": null, "/base/popstra/celebrity/friendship": [{ "participant": [] }] }]
When you've got your query working in the query editor, just click the "Link" menu at the top right to get the MQLRead Link that will make that query to our API.
Upvotes: 3