Knowledge graph

On this page 7

A knowledge graph is a structured representation of knowledge in which entities are nodes and typed relationships are edges, organized by a schema or ontology that gives each node and relation a defined meaning. In artificial intelligence, and particularly in retrieval & knowledge systems, it lets software store facts such as which company acquired which firm, query them precisely and reason over connections that are scattered across many documents.

Knowledge graphs complement statistical methods such as embeddings and semantic search. Where a vector index finds text that is similar to a query, a knowledge graph answers questions that depend on explicit, verifiable relationships, which is why it is increasingly combined with language models in approaches such as GraphRAG.

How a knowledge graph represents knowledge

The basic unit of a knowledge graph is a fact expressed as a triple: subject, predicate and object, for example a drug, the relation treats and a disease. Entities carry unique identifiers, types such as Person or Organization, and attributes such as dates or quantities. A schema or ontology defines which types exist, which relations may connect them and which constraints apply.

Because every entity has one identifier, facts gathered from different sources about the same thing merge onto the same node. This identity layer is what distinguishes a knowledge graph from a set of unconnected records and makes multi-hop questions possible.

ElementRoleExample
Entity or nodeA uniquely identified thingA specific company or person
Relation or edgeA typed link between entitiesEmploys, located in, part of
Attribute or propertyA literal value on a node or edgeFounding year, start date
Class or typeA category of entitiesOrganization, Product, Disease
OntologyFormal definitions and constraintsEvery employee is a Person
ProvenanceWhere and when a fact came fromSource document, extraction date
Building blocks of a knowledge graph

Data models, standards and query languages

Two data models dominate practice. The RDF model represents everything as triples with globally unique identifiers and is standardized together with the OWL ontology language and the SPARQL query language. The labeled property graph model allows properties directly on nodes and edges and is queried with languages such as Cypher and the standardized GQL.

AspectRDF and OWLLabeled property graph
Basic unitTriple with identifiersNode and edge with properties
Edge propertiesThrough reification or RDF-starNative
Query languageSPARQLCypher, GQL
ReasoningFormal inference from ontologiesMostly application logic and algorithms
Typical strengthData integration across organizationsDeveloper-friendly traversal and analytics
RDF graphs compared with labeled property graphs

Validation languages such as SHACL check that data conforms to expected shapes, for example that every product has exactly one manufacturer. Choosing a model depends more on integration and reasoning needs than on performance alone.

How knowledge graphs are built and maintained

Construction combines structured sources, such as databases and catalogs, with information extraction from text. The extraction pipeline usually performs named entity recognition, entity linking to existing identifiers and relation extraction, increasingly with language models doing much of the work.

StepPurposeTypical difficulty
Schema designDefine types and relationsBalancing detail against usability
Entity extractionFind mentions of entitiesAmbiguous names and abbreviations
Entity resolutionMerge mentions of the same entityFalse merges and missed duplicates
Relation extractionIdentify typed linksImplicit or negated statements
Validation and curationCheck constraints and qualityScale of manual review
UpdatingKeep facts currentExpiring and conflicting facts
Main construction steps

Entity resolution is usually the hardest step. Merging two different people with the same name corrupts every downstream answer, while failing to merge duplicates splits knowledge across nodes and hides connections.

Knowledge graphs in retrieval and AI systems

In retrieval-augmented generation, a knowledge graph supplies precise, connected context to a language model. Instead of retrieving only text chunks by vector similarity, the system identifies entities in the question, traverses their relationships and passes the relevant subgraph or its source passages to the model, which improves grounding and traceability.

MethodWhat it retrievesBest for
Vector search with embeddingsSemantically similar chunksOpen questions over unstructured text
BM25 keyword searchChunks with matching termsExact names, codes and rare terms
Knowledge graph queryEntities and explicit relationsMulti-hop, aggregate and constraint questions
GraphRAGGraph structure plus source textCorpus-wide themes and connected facts
Knowledge graph compared with neighboring retrieval methods

Graphs also support graph algorithms such as shortest paths, centrality and community detection, and knowledge graph embeddings that encode nodes as vectors for link prediction, the task of inferring missing relations.

Limitations and common pitfalls

Knowledge graphs are expensive to build and maintain, and their value depends on coverage and accuracy. A graph is always incomplete, so the absence of a fact does not mean the fact is false, a principle known as the open-world assumption in RDF reasoning.

  • Over-engineered ontologies slow adoption; start with the relations that answer real questions.
  • Missing provenance makes facts impossible to audit or retract.
  • Stale facts such as former roles or prices mislead unless facts carry validity dates.
  • Automated extraction errors compound across hops; sample and review extracted triples.
  • Unclear ownership of the schema leads to duplicate relations with overlapping meanings.

Successful projects usually begin with a narrow, high-value domain, measure answer quality on real questions and expand the schema only when new questions require it.

In simple terms

A knowledge graph is like a detailed map of how things are connected. Each dot on the map is a thing, such as a person, a company or a city. Each line says how two things relate. For example, a person works for a company, and the company is based in a city.

Because the connections are written down clearly, a computer can follow them from dot to dot. This lets it answer questions that no single document answers. It could find which suppliers of a company sit in a flooded region. The main idea is simple: knowing the connections is often as important as knowing the facts.

A practical example

A pharmaceutical research team maintains a knowledge graph linking drugs, protein targets, genes, diseases, clinical trials and publications. Facts come from curated databases and from language-model extraction over several hundred thousand abstracts, with every extracted triple linked to its source sentence and a confidence score.

When researchers ask which approved drugs act on targets associated with a rare disease, the system traverses disease to gene to protein to drug in seconds and returns a ranked list with supporting evidence. An assistant built on the graph explains each candidate using the linked passages. Scientists still validate every lead, but the graph reduces literature review from weeks to days and makes each suggestion traceable to its evidence.