Knowledge: Knowledge Graphs
Knowledge graphs and GraphRAG: when relationships matter more than similarity
Vector search finds passages that resemble a question. Some questions call for something else: connections spanning multiple steps, or an overview of an entire document collection. Here is a look at knowledge graphs, the W3C standards behind them and the GraphRAG method, with an honest account of when the extra effort is not worth it.

Short answer
A knowledge graph explicitly stores things and their relationships, such as a part, a supplier and a standard. GraphRAG has a language model extract such a graph from text and uses it to answer questions about connections and entire collections. That pays off for relationship and overview questions; for single facts, vector search usually stays simpler and cheaper.
Definition
Knowledge graph: A knowledge graph is a data structure that stores entities such as products, people, places or concepts as nodes, and their relationships as typed edges. Because relationships are modelled explicitly, it can answer questions about connections and paths that no single passage of text states outright. An agreed vocabulary defines what each edge means.
In the glossary: Knowledge graph, Retrieval-augmented generation, Retrieval, Embedding, Vector database, Hybrid search, Chunking, Query decomposition, Large language model, Hallucination, Evaluation
01
What is a knowledge graph, and how does it differ from a document collection?
A knowledge graph stores entities as nodes and relationships as named edges, for example "pump contains seal". A document collection stores text in which such relationships only appear implicitly. The graph makes connections directly queryable, even across several steps. In exchange, someone has to define which kinds of things and relationships exist, and keep the data current.
A search system over documents works with passages of text. It finds the passage stating that a seal comes from Supplier A, and a separate passage stating that pump P200 contains that seal. The question "Which pumps are affected if Supplier A fails?" requires connecting both passages. A knowledge graph holds exactly that connection as a stored fact.
| Subject | Predicate | Object |
|---|---|---|
| Pump P200 | contains | Seal D17 |
| Pump P300 | contains | Seal D17 |
| Seal D17 | supplied by | Supplier A |
| Seal D17 | meets | Material standard X |
The survey by Hogan and others (ACM Computing Surveys, 2021) covers knowledge graphs across data models, query languages, schema and knowledge extraction, and distinguishes open graphs such as Wikidata from enterprise-internal ones. Knowledge management with AI places knowledge graphs within the bigger picture of knowledge management.
02
RDF or property graph: which graph model fits which purpose?
RDF, the W3C's graph model, describes everything as subject-predicate-object statements with globally unique identifiers, and is built for exchange and linking across system boundaries. Property graphs store nodes and edges with arbitrary properties directly and are common in many graph databases. RDF wins on interoperability and formal semantics, property graphs on simple modelling within a single application.
Two graph models compared
| Criterion | RDF (W3C) | Property graph |
|---|---|---|
| Basic unit | A statement (triple) of subject, predicate, object | Nodes and edges, both carrying properties |
| Identifiers | IRIs, globally unique and linkable | Internal identifiers specific to the database |
| Properties on relationships | Via additional statements; RDF 1.2 allows statements about statements | Directly on the edge, for example a valid-from date or a source |
| Query language | SPARQL 1.1 (W3C Recommendation, 2013) | GQL (ISO/IEC 39075:2024) and vendor-specific languages |
| Schema and validation | RDFS and OWL 2 for meaning, SHACL for validation rules | Depends on the system, often less formal |
| Strength | Exchange, linking external vocabularies, reasoning | Quick to start with, path queries within one application |
| Weakness | Steeper learning curve, more verbose modelling | Weaker on cross-system exchange and formal meaning |
The RDF 1.1 Concepts specification (W3C, 2014) defines an RDF graph simply as a set of triples. The successor, RDF 1.2, adds triples that can themselves be the object of a statement. That makes it possible to record, for instance, which document a relationship came from, something property graphs solve through edge properties. For the example question from the first section, a SPARQL query looks like this:
PREFIX ex: <https://example.org/>
SELECT ?product WHERE {
?product ex:contains ?part .
?part ex:suppliedBy ex:SupplierA .
}03
What is an ontology, explained in plain language?
An ontology is an agreed, machine-readable vocabulary: it defines which kinds of things exist, which relationships between them are allowed, and which rules apply, such as a seal being a type of part. It makes sure that people and machines mean the same thing by "supplied by". Not every graph needs an elaborate ontology; a simpler level is often enough.
| Level | What it defines | Related standard | Often enough for |
|---|---|---|---|
| Glossary | Terms and definitions | none needed | Consistent language within a team |
| Thesaurus, taxonomy | Broader and narrower terms, synonyms, related terms | SKOS (W3C, 2009) | Search with synonyms, keyword systems |
| Ontology | Classes, permitted relationships, logical rules | OWL 2 (W3C, 2012) | Reasoning, integrating multiple sources |
| Validation rules | What shape data must have, for example exactly one manufacturer per part | SHACL (W3C, 2017) | Quality assurance for automated extraction |
A common mistake is starting with the complete ontology for an entire company. A small vocabulary for the questions actually being asked, growing as needed, holds up far better. SKOS suits this well, because it maps terms and synonyms without requiring logical rules. SHACL becomes important as soon as a language model supplies data, because validation rules catch statements that do not fit the vocabulary.
04
How do entities and relationships emerge from unstructured text?
Entities and relationships emerge in several steps: text is split into sections, a language model or a specialised model recognises things and relationships within it, the same thing under different names gets merged, and the result is checked against the vocabulary. Every statement should keep its source, so errors stay traceable and correctable.
Split
Documents are divided into sections (chunking). Sections that are too small tear relationships apart; sections that are too large overwhelm extraction.
Recognise entities
The model flags products, people, places, standards or concepts and assigns them to types from the vocabulary.
Extract relationships
Sentences become statements such as "contains" or "replaces". The GraphRAG paper (Microsoft Research, 2024) also extracts claims about entities.
Ask again
In the GraphRAG process, the model gets its own list handed back with a prompt to add any entities it missed. That raises the yield, along with the number of model calls.
Merge (entity resolution)
"Supplier A", the same company written with its legal suffix, and an abbreviation used in the ordering system all get recognised as the same entity. This is where most silent errors originate.
Validate and record provenance
Validation rules reject statements that do not fit; every statement points back to the document and section it came from.
Typical failure patterns include invented relationships that the text only hints at, dropped negations ("does not contain seal D17"), missing time validity ("supplied by, until 2023") and duplicate nodes caused by name variants. Structured sources such as bills of materials or master data deliver relationships more reliably than any text extraction, and belong in the graph first wherever they exist.
05
How does GraphRAG, the method from Microsoft Research, work?
GraphRAG uses a language model to build an entity graph from the source texts, groups tightly connected entities hierarchically into communities, and has a summary written for each community. It answers overview questions by generating partial answers from these summaries and merging them. It answers questions about individual entities through their neighbourhood in the graph.
- 01Text sectionsSource documents split
- 02ExtractionEntities, relationships, claims
- 03GraphMerged nodes and edges
- 04CommunitiesHierarchical, via the Leiden algorithm
- 05SummariesOne per community
- 06AnswerGlobal via summaries, local via neighbourhood
The paper "From Local to Global: A Graph RAG Approach to Query-Focused Summarization" by Edge and others appeared on arXiv in April 2024, with a revised version in February 2025. It addresses a weakness of classic retrieval-augmented generation: questions like "What are the main themes in these documents?" are not a search for one passage, but a summary over the whole collection. Such overview questions were studied on datasets of around one million tokens (Microsoft Research, 2024).
For the communities, GraphRAG uses the Leiden algorithm by Traag, Waltman and van Eck (Scientific Reports, 2019), which, unlike its predecessor Louvain, only ever produces well-connected communities, recursively down to the smallest subgroups. For a global question, partial answers are generated in parallel per summary, ranked by usefulness, and condensed into a final answer up to the limit of the context window.
The evaluation had a language model score answers pairwise on comprehensiveness, diversity, reader empowerment and directness. GraphRAG led on comprehensiveness and diversity; classic vector RAG delivered the more direct answers. The open-source project's documentation now describes several query modes: global search over community summaries, local search over an entity's neighbours, a hybrid called DRIFT, and plain vector search. Query decomposition and the advanced RAG toolkit shows where GraphRAG sits alongside decomposition and RAG fusion.

06
When does a graph beat vector search, and when does it not?
A graph beats vector search on questions that trace relationships across several steps, on aggregations such as "how many" or "which ones", and on overview questions across an entire collection. For questions pointing to a single passage, for fast-changing documents and for small collections, vector search combined with keyword search is usually the better and simpler choice.
| Question type | Example | Vector or hybrid search | Knowledge graph | GraphRAG global |
|---|---|---|---|---|
| Single fact | What torque applies to bolt S4? | well suited | possible, often overkill | unsuitable |
| Relationship over several steps | Which pumps depend on Supplier A? | unreliable | well suited | limited |
| Complete enumeration | Which products meet standard X? | incomplete, hit count limited | well suited, if the graph is complete | unsuitable |
| Overview of the collection | Which themes run through all the complaints? | weak | only with additional analysis | well suited |
| New documents usable straight away | What does today's circular say? | well suited | only after extraction | only after re-indexing |
Decision path
Do your questions need a graph?
Answer these for the ten to twenty questions users ask most often.
All questions and results as a list
- Do many of these questions require tracing relationships over two or more steps, or enumerating everything?
- Yes, continue with: Are the relationships already structured, for example in bills of materials, master data or a database?
- No, continue with: Do users often ask for an overview across many documents rather than a single passage?
- Are the relationships already structured, for example in bills of materials, master data or a database?
- Yes, Result: Graph from structured sources
- No, only in text, Result: Extraction as a small pilot
- Do users often ask for an overview across many documents rather than a single passage?
- Yes, Result: Consider GraphRAG or a cheaper variant
- No, Result: Stick with hybrid search
- Result: Graph from structured sourcesWhat to work out: which small vocabulary covers the questions, which systems stay the source of truth, and how the graph gets updated when things change. Text can supplement the graph through classic search.
- Result: Extraction as a small pilotWhat to work out: a narrowly scoped document collection, validation rules for extracted statements, and a test-question set that compares graph and vector search directly.
- Result: Consider GraphRAG or a cheaper variantWhat to work out: how often the collection changes, what re-indexing involves, and whether lower-effort indexing variants meet the requirements.
- Result: Stick with hybrid searchWhat to work out: the quality of chunking, keyword search and re-ranking. A graph here would mainly add upkeep.
Both approaches can be combined; Semantic search in the enterprise explains how full text, vectors and hybrid search work.
07
Why is upkeep the biggest cost driver of a knowledge graph?
Upkeep drives the cost because a graph has to be updated every time the sources change: extracting new entities, merging duplicates, removing stale relationships, adjusting the vocabulary. With GraphRAG, many model calls for extraction and summarisation come on top. The query itself is rarely the problem; keeping the graph correct and current is what gets expensive.
Microsoft's GraphRAG GitHub repository explicitly points out that indexing can be an expensive operation, and recommends starting small and tuning the prompts to your own data, because the default settings do not give the best results. In November 2024, Microsoft Research introduced a variant called LazyGraphRAG that shifts model calls from indexing to query time; according to Microsoft Research (2024), that brings indexing costs down to the level of vector RAG, at 0.1% of those for full GraphRAG.
Checklist
Before you build a knowledge graph
Tick off what already has a clear answer. Nothing here is saved.
A graph adds to the running costs of a RAG system; see What a RAG system actually costs to run.
08
Which W3C standards belong to knowledge graphs, and what does each one do?
The W3C has standardised the building blocks of the semantic web: RDF as the data model, SPARQL as the query language, OWL for ontologies, SKOS for thesauri and taxonomies, SHACL for validation rules and JSON-LD for embedding in JSON. For property graphs, ISO/IEC has published its own query language, GQL. The standards are stable, which makes long-term data management easier.
SKOS Reference
W3C Recommendation for thesauri, taxonomies and keyword systems.
OWL 2, second edition
W3C Recommendation for ontologies with classes, relationships and logical rules.
SPARQL 1.1 Query Language
W3C Recommendation for querying RDF graphs.
RDF 1.1 Concepts and Abstract Syntax
W3C Recommendation defining the RDF graph and triples.
SHACL
W3C Recommendation for validating RDF graphs against shape constraints.
JSON-LD 1.1
W3C Recommendation for expressing linked data in JSON.
RDF 1.2 Concepts
Successor version with triples as the object of other statements.
Today
ISO/IEC 39075:2024 defines GQL, a database language for property graphs, developed within the standards body ISO/IEC JTC 1/SC 32. JSON-LD is often the first point of contact with RDF, because it is what marks up structured data on web pages. A graph built on these standards can be exported and linked to public vocabularies or Wikidata, without being tied to any one product.
09
Which myths about knowledge graphs and GraphRAG persist?
The most persistent myths are that GraphRAG always outperforms classic RAG, that a language model builds a graph from documents without error, that a project must start with a complete ontology, and that a graph replaces existing systems. Each of these assumptions leads to projects that generate more effort than benefit, even though the underlying approach itself holds up.
Four assumptions, tested fairly
No
The GraphRAG paper shows advantages in comprehensiveness and diversity for overview questions. Vector RAG led on directness, and for single facts the graph brings no benefit, only overhead.
Not without review
Extraction produces duplicates, invents relationships the text only hinted at, and drops negations. Validation rules, stored provenance and spot checks make these errors visible.
Rarely a good idea
A small vocabulary for the questions actually being asked carries further than a comprehensive model nobody maintains. SKOS is enough to get started in many cases.
No
The graph connects things and makes them queryable. The systems of record stay the source; without that separation, contradictory versions of the truth emerge.
10
How does a mid-sized company get started with a knowledge graph?
A workable starting point begins with a handful of questions that cannot be answered today, a narrowly scoped area, and structured sources that already contain the relationships. Next come a small vocabulary, a graph with stored provenance, and a direct comparison against vector search using the same test questions. Extraction from text only becomes worthwhile once the graph helps measurably.
Say a pump manufacturer with 250 employees (a made-up example) wants to answer which products are affected by a supplier change or a revised material standard. Bills of materials and supplier master data already contain the relationships. The first graph is built from those without any language model; inspection reports follow later through extraction.
- Collect ten to twenty real questions that currently trigger follow-up queries or manual work.
- Check which relationships are needed for them and where they already exist in structured form.
- Define a small vocabulary, with an owner for every class.
- Build the graph from structured sources, storing provenance for every statement.
- Run the same test questions against both the graph and vector search, and compare.
- Only then add extraction from text, with validation rules and spot checks.
If an AI agent needs to query the graph as a tool, AI agents in knowledge work covers the loop of planning, querying and checking. Graphify shows that a graph can structure software knowledge too, turning a codebase into a locally queryable graph.
Read more on iiterate.de
Fundamentals in Knowledge
- Knowledge Knowledge management with AI Places knowledge graphs within the lifecycle from capture to maintenance.
- Knowledge Retrieval-augmented generation explained The classic RAG pipeline that GraphRAG competes against.
- Knowledge Semantic search in the enterprise Full text, vectors and hybrid search as an alternative or complement to the graph.
- Knowledge AI agents in knowledge work How an agent queries a graph as a tool and checks the results.
- Knowledge Checking AI answers How a test-question set makes graph and vector search measurably comparable.
Signals for further reading
- Signal Query decomposition and the advanced RAG toolkit Maps GraphRAG, decomposition and HyDE to the specific failure each one fixes.
- Signal F-RAG (RAG fusion) A different RAG extension that raises recall through multiple query variants.
- Signal Graphify: a codebase as a knowledge graph How a locally generated graph gives AI assistants structure instead of file search.
- Signal What a RAG system actually costs to run The ongoing cost items that a graph adds further items to.
Implementation and terms
- Consulting RAG implementation Building RAG applications on company data, including on your own infrastructure.
- Tool RAG readiness check A self-test of whether your data and organisation are ready for a retrieval system.
- Glossary Knowledge graph in the glossary The short definition of the term, with related entries.
Frequently asked questions
Is a knowledge graph the same thing as a graph database?
No. A knowledge graph is a model of entities, relationships and their meaning. A graph database is software that stores and queries graphs. A knowledge graph can live in an RDF database, a property graph database, or even in relational tables. Conversely, not every graph stored in a graph database is a knowledge graph, for instance a plain network protocol trace.
Does GraphRAG absolutely require a graph database?
The method assumes a graph, communities and their summaries, not any particular storage system. Whether a graph database makes sense depends on whether the graph also needs to be queried, maintained and linked to other systems outside GraphRAG. For a pure pilot, that is often unnecessary; for an ongoing, actively maintained enterprise graph, it usually is.
Can GraphRAG be used with locally run language models?
Yes, in principle, because extraction and summarisation are tasks for a language model, and that model can run on your own hardware too. Two points deserve attention: extraction quality depends heavily on the model, and indexing generates a very large number of model calls, which locally mostly means compute time. Local language models explains the fundamentals.
What is the difference between a taxonomy and an ontology?
A taxonomy arranges terms into broader and narrower concepts, such as part, seal, O-ring. An ontology goes further: it also defines which relationships between classes are allowed and which logical rules apply, for instance that every part has exactly one manufacturer. The W3C standard for taxonomies and thesauri is SKOS; for ontologies, it is OWL 2.
How can you measure whether a graph actually improves answers?
With a test-question set split by question type: single facts, relationships over several steps, complete enumerations and overview questions. Every question runs against both vector search and the graph. Scoring by a language model, as in the GraphRAG paper, is useful, but should be backed up with human spot checks. Checking AI answers describes how to build such tests.
What does entity resolution mean, and why is it so difficult?
Entity resolution recognises that different spellings refer to the same thing, such as a company name, its abbreviation and a customer number. It is difficult because names are ambiguous, and incorrect merges distort relationships in ways that still look plausible afterwards. Matching against master data, stable identifiers and a review point for uncertain cases all work well in practice.
Can an existing knowledge graph be combined with classic RAG?
Yes, and that is often the most pragmatic route. The system recognises entities in the question, pulls their relationships from the graph, and uses them to filter or expand the vector search. The answer then rests on both text passages and structured facts at once, without needing a full GraphRAG process with community summaries.
Read on
Related topics
Sources
- 01 From Local to Global: A Graph RAG Approach to Query-Focused Summarization (Edge et al.) Microsoft Research, arXiv, 2024-04-24 · arxiv.org
- 02 GraphRAG: Unlocking LLM discovery on narrative private data Microsoft Research Blog, 2024-02-13 · microsoft.com
- 03 LazyGraphRAG: Setting a new standard for quality and cost Microsoft Research Blog, 2024-11-25 · microsoft.com
- 04 GraphRAG repository Microsoft, GitHub, 2026 · github.com
- 05 GraphRAG documentation Microsoft, 2026 · microsoft.github.io
- 06 From Louvain to Leiden: guaranteeing well-connected communities (Traag, Waltman, van Eck), Scientific Reports 9 arXiv, Scientific Reports, 2019 · arxiv.org
- 07 Knowledge Graphs (Hogan et al.), ACM Computing Surveys 54(4) arXiv, ACM, 2021 · arxiv.org
- 08 Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al.) arXiv, NeurIPS 2020, 2020-05-22 · arxiv.org
- 09 RDF 1.1 Concepts and Abstract Syntax W3C, 2014-02-25 · w3.org
- 10 RDF 1.2 Concepts and Abstract Syntax, Candidate Recommendation Snapshot W3C, 2026-04-07 · w3.org
- 11 SPARQL 1.1 Query Language W3C, 2013-03-21 · w3.org
- 12 OWL 2 Web Ontology Language Document Overview (Second Edition) W3C, 2012-12-11 · w3.org
- 13 SKOS Simple Knowledge Organization System Reference W3C, 2009-08-18 · w3.org
- 14 Shapes Constraint Language (SHACL) W3C, 2017-07-20 · w3.org
- 15 JSON-LD 1.1 W3C, 2020-07-16 · w3.org
- 16 ISO/IEC 39075:2024 Information technology, Database languages, GQL ISO/IEC, 2024 · iso.org
Let us talk about your project
Whether it is a prototype, an internal tool or an AI application: describe briefly what you are building or want to take into production.