Triple store

Also known as: RDF store

On this page 7

A triple store, also called an RDF store, is a database built to store and query data expressed as subject-predicate-object statements in the Resource Description Framework (RDF). Among the database models used in databases, it is the purpose-built engine for linked data and knowledge graphs, where every fact is a small, self-describing edge between globally identified resources.

A triple store accepts data in standard RDF serializations, answers queries written in SPARQL, and can often infer new facts from ontologies expressed in RDFS or OWL. These capabilities make it a common foundation for semantic integration, metadata catalogs and domain knowledge graphs.

How a triple store represents data

A triple store models all information as triples, each stating one fact: a subject resource, a predicate naming the relationship, and an object that is either another resource or a literal value. Resources are identified by IRIs, globally unique identifiers that let data from different sources merge without key collisions.

Because every fact has the same shape, a triple store needs no fixed schema before loading data. New properties appear simply as new predicates, and the collection of triples forms a directed, labeled graph that can be extended indefinitely.

The table below shows how a few facts about an employee look when broken into triples.

SubjectPredicateObject
ex:alicerdf:typeex:Employee
ex:aliceex:worksForex:acme
ex:alicefoaf:name“Alice Novak” (literal)
ex:acmeex:locatedInex:berlin
Example facts expressed as RDF triples

Most modern engines are in fact quad stores: they add a fourth element, the named graph, which groups triples by source, version or access policy. Named graphs make provenance tracking and selective deletion practical without changing the underlying triple model.

Storage, indexing and query processing

Internally, a triple store relies on dictionary encoding and multiple permutation indexes to make graph patterns fast. Long IRIs and literals are replaced by compact integer identifiers, and the resulting ID triples are stored in several sort orders so that any pattern with one or two known positions can be answered by a range scan.

The following table explains which index permutation serves which kind of query pattern.

Index orderPattern it serves bestTypical question
SPOKnown subjectWhat do we know about this resource
POSKnown predicate and objectWhich resources have this type or value
OSPKnown objectWhat points to this resource
GSPOKnown named graphWhich facts came from this source
Common index permutations in a triple store

A SPARQL query is a set of triple patterns with variables. The engine turns each pattern into an index scan and combines the results through joins, so query planning, join order selection and cardinality estimation dominate performance. A query with ten patterns may require nine joins, which explains why optimizer quality separates engines more than raw storage speed.

Many products add reasoning. With forward chaining, inferred triples are materialized at load time, which speeds queries but increases storage and update cost; with backward chaining, inferences are computed at query time, which keeps data compact but slows complex queries.

Triple store compared with other database models

The closest neighbor of a triple store is the property graph database, and both belong to the broader graph database family. The key differences lie in identifiers, standards and how attributes on relationships are handled.

AspectTriple storeProperty graphRelational database
Basic unitTriple or quadNode and edge with propertiesRow in a table
IdentifiersGlobal IRIsLocal internal IDsLocal primary keys
Query languageSPARQL (W3C standard)Cypher, Gremlin or GQLSQL
SchemaOptional ontology, open worldOptional, often implicitRequired before loading
Edge attributesReification or RDF-starNative edge propertiesColumns in a join table
Built-in inferenceRDFS and OWL reasoningRareViews and triggers only
Triple store, property graph and relational model compared

The triple store excels at integrating heterogeneous sources and publishing interoperable data, while property graphs are often simpler for deep traversal workloads such as path finding. The gap has narrowed with RDF-star and the RDF 1.2 work, which allow statements about statements, and with multi-model products that expose both interfaces.

When to choose a triple store

A triple store is the right choice when meaning, identity and interoperability matter more than raw transaction throughput. Typical domains include life sciences, publishing, government open data, cultural heritage and enterprise metadata management.

SituationRecommendationReason
Many sources with differing schemasTriple storeGlobal IRIs and shared vocabularies ease merging
Need for logical inferenceTriple store with a reasonerRDFS and OWL rules derive implicit facts
High-volume order processingRelational databaseMature transactions and predictable performance
Real-time path and traversal queriesProperty graph databaseOptimized adjacency and traversal engines
Publishing linked open dataTriple store with a SPARQL endpointStandard protocol for external consumers
Decision guide for adopting a triple store

Data quality in a schema-flexible store is enforced with SHACL shapes, which validate that resources carry required properties and correct value types. Without such validation, the open world assumption of RDF means that a missing property is never treated as an error by the store itself.

Limitations and common pitfalls

The flexibility of a triple store comes with real performance and modeling costs that teams often underestimate. The following problems appear frequently:

  • Join explosion: queries touching many predicates trigger long join chains, so poorly selective patterns can run for minutes.
  • Materialization growth: forward-chained reasoning can multiply the triple count several times over.
  • Literal-heavy workloads: full-text and numeric aggregation are weaker than in search engines or columnar stores unless extensions are used.
  • Vocabulary sprawl: without governance, teams mint overlapping predicates that defeat the integration goal.
  • Update cost: bulk loading is fast, but frequent small updates maintain several indexes and may degrade throughput.

Scaling beyond a single machine is possible, yet distributed SPARQL joins remain expensive because related triples rarely share a partition. Many deployments therefore keep the triple store as an integration and reasoning layer while operational data stays in other systems.

A plain-language summary

A triple store keeps information as millions of short three-part sentences, such as “Alice works for Acme” or “Acme is located in Berlin”. Each sentence links two things, and together the sentences form a web of connected facts.

Every person, place or idea has a unique web-style name. So facts from different organizations can share one store and still fit together. The store can answer questions that span all of them. It can even work out facts nobody wrote down, such as that Alice works in Germany.

An example from practice

A pharmaceutical research group needs to connect internal compound data with public sources on genes, proteins and diseases. Each source uses different identifiers and table layouts, so a relational warehouse would require constant schema rework.

The group loads about two billion triples into a triple store, keeping each source in its own named graph, and maps internal terms to shared ontologies. Scientists then run SPARQL queries such as “compounds tested against proteins linked to a given disease pathway”, which join across five sources in a single query. SHACL validation runs on every load to reject records missing required identifiers.

The outcome is a unified knowledge graph that answers in seconds questions that previously took analysts days of manual spreadsheet matching, while each source can still be refreshed independently by replacing its named graph.