Simple script to query Google's Knowledge Graph API.
Latest commit e014978 Jun 30, 2016 @nchah Updating README, sample usage



Further background on Freebase and the deprecated Freebase APIs is available in my freebase-mql repository. The KG API is a successor to the functionality once offered by the Freebase APIs.

Google Knowledge Graph

Google's Knowledge Graph is an internal knowledge base of linked data that draws from a wide range of sources for its data. The aforementioned Freebase database was one of the data sources.

The Knowledge Graph allows the search engine to serve up the rich Knowledge Cards that take up the right side of many notable search results.

The current KG API has more limited search capabilities compared to the previous Freebase API. It's currently not possible to craft queries (as was done in MQL) that return a sub-graph of Freebase topics. The best alternative will be to use the unique identifier (Freebase mid) and join it with other data, such as the growing volume on Wikidata.

An example query:

$ python 'google'
 - entity_types: Thing, Organization, Corporation
 - description: Technology company
 - detailed_description: Google is an American multinational technology company specializing in Internet-related services and...
 - identifier: kg:/m/045c7b
 - url: N/A
 - resultScore: 287.675293

Google X
 - entity_types: EducationalOrganization, Corporation, Organization, Thing
 - description: Corporation
 - detailed_description: X, previously Google X, is a semi-secret research and development facility created by Google and ope...
 - identifier: kg:/m/0hhrhd0
 - url: N/A
 - resultScore: 47.670715

 - entity_types: Thing, Place
 - description: Building complex
 - detailed_description: The Googleplex is the corporate headquarters complex of Google, Inc., located at 1600 Amphitheatre P...
 - identifier: kg:/m/03bby1
 - url:
 - resultScore: 44.866741



Many Freebase and Knowledge Graph related updates are posted on the once active freebase-discuss Google Group and the Google+ community.


Knowledge Graph

Google Developers Resources

Freebase APIs

Knowledge Graph Search APIs