Search code examples
freebasemql

Freebase MQL Query to fetch all instances and their Wiki description


I want to fetch and save Wikipedia descriptions of all instances from /sports/sport to my database.

It requires 2 API calls - one to fetch mid and another to fetch wiki description. Is it possible to combine the 2 queries to a single query?

Thanks in advance.


Solution

  • The API isn't really designed for bulk downloads. There's a dump file available for these types of bulk operations. https://developers.google.com/freebase/data#freebase-rdf-dumps

    If you were searching for a specific sport or sports, you could get both the description and MID using the Search API e.g. https://www.googleapis.com/freebase/v1/search?indent=true&filter=(all%20type:/sports/sport)&output=(description)

    Don't forget that you need to cite Wikipedia as well as Freebase, since you're using their text.