Chapter 4
Statement graphs
Give every statement an identifier and let that identifier stand where a node can. That one rule is enough to hold RDF, RDF-star, property graphs and the four metagraph kinds. This chapter defines it and shows how graphlava lays it out.
The unit: an identified statement
A statement is a subject, a predicate and an object, plus an identifier:
s1 = (:alice, :worksAt, :acme)
The identifier s1 is a term. It can be the subject or the object of another statement. The predicate cannot be a statement; it is always a plain name. That asymmetry keeps queries tractable: every pattern still has a known relation in the middle.
s2 = (s1, :confidence, 0.9)
s3 = (s1, :source, :chat12)
Compare classic RDF reification, which spends four triples to make a handle for one fact:
_:r rdf:type rdf:Statement .
_:r rdf:subject :alice .
_:r rdf:predicate :worksAt .
_:r rdf:object :acme .
_:r :confidence 0.9 .
In a statement graph the handle comes with the fact.
The model, formally
Gelling, Fletcher and Schmidt define a statement graph as a directed acyclic graph with two kinds of vertices (arXiv:2304.13097, 2023; DASFAA 2024):
- Leaves hold values: IRIs, blank nodes, literals, property-graph labels and keys. Each value appears once.
- Internal vertices are statement identifiers. Each has exactly three outgoing edges, labelled subject, predicate and object. The subject and object may lead to another statement; the predicate may not.
The model gives no meaning by itself. Meaning comes from images: restricted forms that encode each familiar data model.
| Image | What is allowed |
|---|---|
| RDF | Triple statements plus membership statements (t, in, g) for named graphs. Statements are referenced only by memberships. No two statements with the same three targets. |
| RDF-star | As RDF, but a triple may have another triple as subject or object. |
| Property graph | Edge statements between nodes, label statements, and property statements on nodes or edges. Label and property statements cannot be referenced. |
| OneGraph | A mix of the RDF-star and property-graph images in one graph, with duplicate statements allowed. |
The OneGraph image comes from Amazon's 1G vision, the model behind Neptune Analytics, which runs openCypher over RDF data. The images show that one statement-centric model holds all three common graph models without loss.
Why the identifier is the minimum
Chapter 3 listed what a metagraph needs. Each item becomes an ordinary statement once statements have identifiers:
| Metagraph need | As statements |
|---|---|
| An edge as a vertex | (s1, :confidence, 0.9): the subject is a statement |
| A vertex as a container | (s1, :in, :session7): a membership statement |
| Nesting containers | (:session7, :in, :aliceMemory) |
| A hyperedge | a node e1 with role statements (e1, :agent, :alice), … |
| A relationship between relationships | (e1, :ledTo, s9) |
| The model as data | (:Meeting, :hasRole, :agent) |
Without identifiers, every row of this table needs a different mechanism: reification triples, quads, a separate n-ary node convention, a schema file. With identifiers they are one mechanism. That is why this book uses statement graphs as the common substrate for hypergraphs and metagraphs.
A naming clash. tiramemsu's own docs use "statement graph" for something narrower: a named graph whose name is a statement, so an edge can hold a subgraph. In this book "statement graph" always means the Gelling, Fletcher and Schmidt model.
graphlava: one ID space
In graphlava every term is one 64-bit ID. The top bits are a kind tag, so the kind of any ID is known without a lookup:
| Tag | Kind | Subject | Predicate | Object |
|---|---|---|---|---|
0x1 | IRI | yes | yes | yes |
0x2 | blank node | yes | no | yes |
0x3 | dictionary literal | no | no | yes |
0x4 | statement | yes | no | yes |
0x5 | graph | yes | no | yes |
0x6 | hyperedge | yes | no | yes |
0x8–0xF | inline literal: bit 63 set, value inside the ID (prefix 10 a double, 11 a 4-bit subtype such as integer, date or short string) | no | no | yes |
The spec's rule is the statement-graph rule: a predicate is always an IRI, a literal is never a subject, and any other kind can be a subject or an object. Statements, graphs and hyperedges are all first-class terms in one ID space, so a join never has to ask which table an ID came from.
In SPARQL, a statement ID is the RDF 1.2 reifier. The spec recommends returning it to clients as an IRI, <urn:meta-core:stmt:{id}>, which maps back to the ID without a dictionary lookup (recommended; the form is still open).
Where graphlava differs from the paper
| Topic | Statement graphs | graphlava (spec) |
|---|---|---|
| Identity under change | A statement is its three targets. | Updating a statement's object keeps its ID, so annotations stay attached. |
| Duplicates | Forbidden in RDF images, allowed in OneGraph. | One statement per (s, p, o) by default; a predicate declared multi allows several, each with its own ID. |
| Hyperedges | A node plus role statements. | A native record; role statements are virtual (chapter 5). |
| Which statements have IDs | All of them. | Literal-valued properties, hyperedge roles, graph memberships and derived facts are statements to every query, but get an ID only when something annotates them (chapter 6). |
| Graph nesting | Membership statements. | Membership plus a nesting DAG with cycle checks and transitive scope (chapter 7). |
The last two rows are the important ones. Logically, everything is a statement. Physically, graphlava pays for an ID only where one is used.
In graphlava. A statement is a subject–predicate–object fact with a stable 64-bit ID. Statement, graph and hyperedge IDs are terms like IRIs, so they can stand in subject or object position. The statement ID is the SPARQL 1.2 reifier, and binding it costs no join.
Takeaways
- A statement graph is (s, p, o) with an identifier, where s and o may be statements and p may not.
- Images show that RDF, RDF-star and property graphs are all restricted statement graphs.
- An identifier per statement is the one feature every metagraph power needs.
- graphlava keeps the logical model and gives IDs lazily: virtual statements are promoted when annotated.