Can I Access All Google Knowledge Graph Data Through the Google Knowledge Graph Search API?

The Google Knowledge Graph is one of the most recognizable sources of contextually-linked facts on people, books, organizations, events, and more. 

Access to all of this information — including how each knowledge graph entity is linked — could be a boon to many services and applications. On this front Google has developed the Knowledge Graph Search API.

While at first glance this may seem to be your golden ticket to Google’s Knowledge Graph data, think again. 

The current version of Google’s Knowledge Graph Search API is severely impaired on several fronts. While there are a small number of potential use cases for Google’s Knowledge Graph Search API, the API does not grant developers even a fraction of the data or ontology that makes the Knowledge Graph potentially useful in the first place.

Below we’ll work through what Google’s Knowledge Graph Search API does provide (hint: not much), then look at what data is provided through Diffbot’s Knowledge Graph API.

How the Google Knowledge Graph Search API Works

The first thing to note about Google’s Knowledge Graph Search API is the inclusion of the word “search.” This is effectively what this API provides. But as with all search services, the value is in what a query actually returns.

Per the Google Knowledge Graph Search API documentation, four query parameters control what data is requested through the API:

  • Query, string: A literal string to search for in the Knowledge Graph.
  • Ids, string: A list of entity IDs to search for in the Knowledge Graph. To specify multiple IDs in the HTTP request, repeat the parameter in the URL as in …?ids=A&ids=B
  • Languages, string: The list of language codes (defined in ISO 639) to run the query with, for instance `en`.
  • And Types, string: Restricts returned entities to those of the specified types. For example, you can specify `Person` (as defined in https://schema.org/Person) to restrict the results to entities representing people. If multiple types are specified, returned entities will contain one or more of these types.

These query parameters effectively allow you to do two things:

  1. Request a result for which you already know the ID.
  2. Request a best guess answer from a more loosely typed query string.

While there are use cases for the above request types (as in autocomplete in a form), the real limitations of Google’s Knowledge Graph Search API are seen in what a query to the API returns. The central fields are listed below:

  • ID: a unique identifier for an entity in the Knowledge Graph
  • Name: the name of the entity being returned
  • Image: an image of the entity 
  • Type: movie, book, organizations, etc. 
  • Description: a short description of the object.
  • Detailed Description: a slightly-longer description (c.1 paragraph)

Notably missing are much of the data that makes a Knowledge Graph entity useful to begin with. Contextual data including events, social media posts, recent news, sub-entities or parent entities, attributes, and more are all missing. 

In short, the Google Knowledge Graph Search API essentially returns a thumbnail snippet of a Knowledge Graph entity, and not the Knowledge Graph entity itself. 

How Diffbot’s Knowledge Graph API Works

Querying Diffbot’s KG Visually (For Illustration)

Diffbot’s Knowledge Graph API provides access to all of the contextual data that makes Knowledge Graph entities valuable for 

  • Over 20 billion entities
  • Seen through over 1 trillion facts!

An API query for Diffbot’s Knowledge Graph begins by passing your developer token and query parameters to the API’s endpoint. 

Each Diffbot Knowledge Graph query begins by specifying the top-level type of the entity you’re searching for. Top-level types range widely in Diffbot’s Knowledge Graph, and include the following:

  • Article
  • Corporation
  • DegreeEntity
  • Discussion
  • EducationMajorEntity
  • EmploymentCategory
  • Image
  • Intangible
  • Miscellaneous
  • Organization
  • Person
  • Place
  • Product
  • Skill
  • Video

After passing a type query parameter, you can work your way down adding specificity to get to a terminal level field. 

Each type within Diffbot’s Knowledge Graph includes a wide range of contextually-linked field holding facts that can play into what is returned from your query. Where Google’s Knowledge Graph Search API just returns a snippet of a KG entity, Diffbot’s Knowledge Graph API allows you to filter by fields within entities and returns entire collections of entity objects.

This means you can perform queries such as the following, mining down into a collection of Knowledge Graph entities based on one subfield.

type:Person employments.{employer.name:"Diffbot" isCurrent:true}

Additionally, you can perform operations on entities that contain certain facts. For example, one can perform facet views of entities like the following:

type:Person employments.{isCurrent:true employer.name:"Facebook"} facet:educations.{institution.name}

Which in this case will return the number of Facebook employees who attended the same schools as one another. 

By providing access to the world’s most comprehensive Knowledge Graph, Diffbot’s Knowledge Graph API supports a wide range of use cases including:

  • Enhancing Organizational Data
  • Searching Articles By Tags
  • Searching Articles by Organization
  • Searching Articles By Person
  • Searching Organizational Data
  • Searching Demographic Data
  • Searching Skill Set Data
  • And a range of other applications.

Want to see what Diffbot’s Knowledge Graph API can do you for? Request a trial developer token today! For users not comfortable with API access to the Knowledge Graph, we also provide a visual UI for Knowledge Graph access. Check out our Knowledge Graph hub today. 

Need more info? Contact sales or browse Diffbot’s Knowledge Graph API documentation