Freebase Search API - Get All Results

156 views Asked by At

Is it possible now to get all results from Freebase Search API?

Today I was trying 2 approaches in Java:

  1) www.googleapis.com/freebase/v1/search?filter=..."
   Using "cursor"(integer) and "limit" options.

  2) www.freebase.com/ajax/156b.lib.www.tags.svn.freebase-site.googlecode.dev/cuecard/mqlread.ajax?&query=
   Try to simulate 'Query Editor' (https://www.freebase.com/query)
   Using "cursor" from the previous results set (String).

But in both of these approaches I got only

       - 200 (first option)
       - 500 (second option)

records (should be about 6000 records) ...

After several iterations I have got

            - "Request too large, cursor: 200, limit: 200" (first option, only 1 iteration)
            - "cursor is false" (second option, 6 iterations)

message.

Is it Freebase problem or may be API limitations?

How could I get all results?

1

There are 1 answers

2
Tom Morris On BEST ANSWER

Without specifics it's a little difficult to say what the problem is, but the Search API is definitely not intended to return complete results. The MQLRead API should return complete results, although I'd consider 6K results to be towards the upper end of its intended usage. If you're not going an error like "Query too hard," I suspect that there's something in your query which is unintentionally limiting it in ways you don't expect.

The other way to get large amounts of information from Freebase is to extract it from the data dumps.

NOTE: Freebase is no longer being updated and both the MQLRead and Search APIs will be going away shortly (although Google has said that the Search API will be replaced with a Knowledge Graph based equivalent).

UPDATE: When I run the query from the comment below with "return":"count", I get a value of 536 which matches with the reported results of six iterations using the cursor.

Note that MQLRead does NOT compute the transitive closure for places like birthplace, so querying for people born in Portugal, will not return people listed as being born in Lisbon (another 1143 people.)

The Search API will return the transitive closure, although I'm not sure it's guaranteed to be complete. It's really designed & tuned to return the top few best matches, not exhaustive lists, but if you want to experiment with it, you can use this query in the example app:

http://freebase-search.freebaseapps.com/?filter=(all+type%3A%2Fpeople%2Fperson+%2Fpeople%2Fperson%2Fplace_of_birth%3APortugal)&output=(%2Fpeople%2Fperson%2Fplace_of_birth%7Bintrinsic%7D+(%2Fpeople%2Fperson%2Fplace_of_birth+))&limit=10&scoring=entity&lang=en

or it's raw API equivalent:

https://www.googleapis.com/freebase/v1/search?limit=10&scoring=entity&filter=(all+type%3A%2Fpeople%2Fperson+%2Fpeople%2Fperson%2Fplace_of_birth%3APortugal)&output=(%2Fpeople%2Fperson%2Fplace_of_birth%7Bintrinsic%7D+(%2Fpeople%2Fperson%2Fplace_of_birth+))&lang=en&indent=true