A knowledge graph is a collection of facts stored as entities (people, places, products, concepts) joined by named relationships. Most are built from subject-predicate-object triples such as "Paris, is the capital of, France", and the links between triples are what let you query across them.
The term covers a data model, not one product. Google uses "Knowledge Graph" for its own entity database, companies build private ones for their products, and public ones such as Wikidata are open data. What they share is the structure described below.
How a knowledge graph stores facts
The basic unit is a triple. The W3C's RDF 1.1 specification, the standard behind most knowledge graphs, says the core structure is a set of triples, each consisting of a subject, a predicate and an object. A set of triples is an RDF graph. Each triple is one edge: the subject and object are the nodes at either end, and the predicate is the label on the arrow.
The kinds of thing allowed in each position are fixed by the spec:
| Position | Can be | Example |
|---|---|---|
| Subject | An IRI or a blank node | ex:Paris |
| Predicate | An IRI | ex:capitalOf |
| Object | An IRI, a literal or a blank node | ex:France or "2161000" |
An IRI is a globally unique identifier, written like a web address. It is how a graph tells two entities with the same name apart: two cities called Paris get two different IRIs. A literal is a plain value such as a string, a number or a date. A blank node stands for something that exists but has no identifier of its own; per the spec, blank nodes do not identify specific resources.
A small example
Here are five facts written in Turtle, a common text format for RDF. This is example data, not taken from a real dataset:
@prefix ex: <http://example.org/> .
ex:Paris ex:capitalOf ex:France .
ex:Paris ex:population "2161000" .
ex:France ex:memberOf ex:EuropeanUnion .
ex:Marie ex:bornIn ex:Paris .
ex:Marie ex:worksFor ex:AcmeLabs .
Each line is a triple ending in a full stop. Notice that ex:Paris appears as the subject of two triples and as the object of another. That repetition is what makes it a graph: the same node connects several facts, so a program can walk from Marie to Paris to France to the European Union without anyone writing that route down.
How you query a knowledge graph
RDF data is queried with SPARQL, the W3C's query language for RDF. A query is built from triple patterns, which look like triples with some positions replaced by variables (names starting with ?). The engine returns every set of values that makes the pattern match. The SPARQL 1.1 specification's own introductory style is a query like this one, shown here against the example data above:
PREFIX ex: <http://example.org/>
SELECT ?country
WHERE {
ex:Marie ex:bornIn ?city .
?city ex:capitalOf ?country .
}
The variable ?city appears in both patterns, so the two patterns are joined through it. Example output for the data above:
country
-------
ex:France
The query answered "in which country was Marie born, if her birthplace is a capital?" by following two edges. In a spreadsheet you would need a lookup between two tables. In a graph the second hop is just another pattern.
Schemas and meaning
A graph with only triples would be a pile of labels. Real knowledge graphs add a vocabulary that says what the types and predicates mean, for example that ex:capitalOf relates a city to a country, and that a Person is a kind of Thing. Google's Knowledge Graph Search API shows the idea in practice: its results are JSON-LD that uses schema.org types, with entity types such as Person, Movie, MusicGroup, Organization, Place and VideoGame. Agreeing on a shared vocabulary is what allows data from different sources to be merged into one graph.
Two practical consequences follow. First, the graph is only as good as its identifiers. If the same real-world person has two IRIs in two datasets, the graph treats them as two entities until someone links them. Second, a graph can say something false just as easily as something true. The model stores assertions; it does not check them.
Where you meet knowledge graphs
- Search results. The information panels that appear beside some search results draw on an entity database. Google's developer page describes its Knowledge Graph Search API as returning entities with a name, types, a description, an image and a website URL.
- Open datasets. Wikidata is a public knowledge graph. Google's documentation recommends its data dumps if you need interconnected data rather than a list of matching entities.
- Company data. Organisations link customers, products, documents and systems into a graph so that one question can span all of them.
- AI applications. A graph can serve as a source of verified facts that a language model is given at question time. That is a variation on retrieval-augmented generation, covered in What Is RAG?, where the retrieved material is structured facts instead of text passages.
Knowledge graph vs. embeddings
Both are used to help software find related things, but they work differently. A knowledge graph holds explicit, named relationships that a person or a pipeline wrote down: Marie was born in Paris. Embeddings, explained in What Are Embeddings?, are lists of numbers learned from data, where closeness means similarity but the reason is not stated. Similarity search over embeddings, described in Semantic Search Explained, finds text that is about the same thing. A graph answers questions that need an exact relationship, and it can show the path that led to the answer.
| Knowledge graph | Embeddings | |
|---|---|---|
| Stores | Named facts between identified entities | Vectors of numbers |
| Relationship | Explicit and labelled | Implicit, as distance |
| Strength | Exact multi-step questions, traceable answers | Fuzzy matching of meaning |
| Cost to build | Needs identifiers and a shared vocabulary | Needs a model and a vector index |
Limits to know about
- Building one takes effort. Someone has to decide the entity types, the predicates and the identifier scheme, and keep them consistent as data arrives.
- Coverage is uneven. A graph knows what was put into it. A question about an entity it lacks returns nothing, not a guess.
- Public APIs have conditions. Google states that its Knowledge Graph Search API is read-only, is not suitable for use as a production-critical service, and is being migrated to Cloud Enterprise Knowledge Graph, with new users directed to that product (as of the page's text when checked in November 2026).
Frequently asked questions
- Is a knowledge graph the same as a database?
- A knowledge graph is a way of modelling data, and it can be stored in several kinds of database. Its defining feature is that facts are stored as relationships between identified entities, so you can ask questions that follow links, such as 'which films were directed by people born in Paris'. A relational table can hold the same facts, but the links are less direct to query.
- What is a triple in a knowledge graph?
- A triple is one fact written as subject, predicate, object. In RDF, the W3C standard for this model, the subject is an IRI or blank node, the predicate is an IRI, and the object is an IRI, a literal such as a string or number, or a blank node. A set of triples forms an RDF graph.
- What language do you use to query a knowledge graph?
- For RDF data, the W3C standard query language is SPARQL. You write triple patterns with variables, and the query engine returns every combination of values that matches the pattern in the graph. Other graph databases use their own query languages.
- Does Google's Knowledge Graph Search API return the whole graph?
- No. Google's documentation says the API returns a ranked list of individual matching entities, not interconnected graphs, and that it is not suitable as a production-critical service. For linked data, the same page points to Wikidata data dumps.