Article
graphlava and Neptune OneGraph: one statement model, two scales
Amazon's OneGraph idea says you should not have to choose between RDF and property graphs: store statements, and let both views read them. Neptune Analytics runs that idea as a managed cloud service. graphlava is designed to run the same idea inside one process, in one file, on a laptop or a phone.
The lock-in problem
A team that picks RDF gets IRIs, named graphs, SPARQL and reasoning. A team that picks a property graph gets nodes and edges with properties, and Cypher or Gremlin. Moving between them later is expensive, because the two models disagree on basic things: what an edge is, whether an edge can have properties, whether a property can be talked about, and what identifies a node.
In 2023 Ora Lassila, Michael Schmidt and colleagues at Amazon described this as graph model lock-in, and proposed OneGraph (1G) as the way out. In 1G every piece of information is a statement with an identity. RDF triples, property-graph edges and property-graph properties are all statements, and a statement can carry further statements.
The same year, Ewout Gelling, George Fletcher and Michael Schmidt formalised the idea as Statement Graphs (full version at DASFAA 2024). They define images for RDF, RDF-star and property graphs, and a combined OneGraph image. Their prototype, the 1G Playground, keeps one statement graph and derives a TinkerPop store for Gremlin and an RDF4J store for SPARQL from it.
In August 2024 Neptune Analytics added openCypher queries over RDF data. The Neptune team's ISWC 2024 paper, openCypher over RDF: Connecting Two Worlds, describes how RDF and property-graph data are both loaded into OneGraph's internal model as relationship statements and property statements, and names statement graphs as directly inspired by OneGraph. How Neptune lays these out in memory or on disk is not public, and this article does not guess.
The same unit
graphlava (working name meta-core in its specs) starts from the same unit. A statement is a subject, predicate and object with a stable 64-bit ID, and that ID can be the subject of another statement. Its Cypher mapping, planned for v1, lines up with the 1G vocabulary almost term for term:
| Property-graph concept | OneGraph and Statement Graphs (as published) | graphlava (as specified) |
|---|---|---|
| Node | a resource that statements are about | any non-literal term: IRI, blank node, statement, graph or hyperedge; id(n) is its 64-bit ID |
Relationship -[r:T]-> | a relationship statement | a statement (a, T, b) whose ID is r |
Node property n.name | a property statement | an inline property (n, :name, literal) |
Relationship property r.since | a property statement about a statement | an inline property of the statement r |
Label :Person | a label statement | (n, rdf:type, :Person), so labels and RDF classes are the same thing |
The relationship/property split is the same in both. In graphlava it is a routing rule: a statement whose object is a node goes into the triple orderings, and a statement whose object is a literal is stored in its subject's property record. There is no per-property choice. A Cypher property is never exposed as a relationship, and a relationship always connects two nodes.
Global names and local IDs
The hardest problem 1G names is identity. RDF names things with global IRIs. A property graph names them with local IDs that mean nothing outside the database. A unified store has to let a SPARQL query and a Cypher query refer to the same edge.
graphlava's answer is that everything is an ID first. IRIs are interned in a dictionary and become IDs; statements, graphs and hyperedges are allocated IDs. Names are a projection. Two rules connect the two worlds:
- A Cypher relationship variable binds the statement ID, and
id(r)returns it. That same value is the SPARQL 1.2 reifier of the statement. - The spec recommends returning reifiers to SPARQL clients as IRIs of the form
urn:meta-core:stmt:{id}; the exact form is still open. A client can send that IRI back in a later query, and the parser maps it to the ID without a dictionary lookup.
# SPARQL: the reifier ?r is the statement ID
SELECT ?who ?c WHERE {
<< ?who :worksAt :acme ~ ?r >> .
?r :confidence ?c .
}
# Cypher (v1): r binds the same ID
MATCH (a:Person {name: 'Alice'})-[r:WORKS_AT]->(c)
WHERE r.confidence > 0.8
RETURN c.name, id(r)
Some parts of the mapping are still open in the specs: how Cypher type names, labels and property keys map to IRIs, how far Cypher's null and comparison rules are emulated over RDF terms, and whether predicates created from Cypher default to allowing parallel edges. graphlava has not settled them yet.
Sets and bags
RDF has set semantics: a triple is there or it is not. Property graphs allow two parallel edges of the same type between the same nodes. The OneGraph image allows duplicate statements to cover both.
graphlava picks per predicate. By default there is at most one statement per (s, p, o), and inserting an existing one returns its ID. A predicate declared multi in the meta-model allows parallel statements, each with its own ID. The default keeps index keys narrow and joins free of duplicate removal. The cost is a documented Cypher deviation: CREATE of an existing relationship on a non-multi predicate binds the existing one.
Where graphlava adds physical structure
A logical model leaves the layout open. graphlava has to fix one, and it fixes it for small, frequent writes and short reads, not for analytics over a large cluster.
Identity only where it is used
An inline property has no statement ID until something annotates it. Then it is promoted: it gets an ID and moves into the orderings. The same holds for hyperedge roles, graph memberships and derived facts. In 1G terms, every property statement is addressable; in graphlava, every property statement can become addressable, and pays for that only when it does.
n-ary hyperedges
1G and the statement-graph images are built from triples. graphlava adds a hyperedge: one record with a declared type and named roles, plus an incidence index per role filler. A meeting with an agent, a target and a topic is one record, not a node plus three statements. Its date is an inline property of the record, since roles hold only nodes (ADR 0028). Queries see role triples, produced from the record:
SELECT ?a ?t ?w WHERE { ?e a :Meeting ; :agent ?a ; :target ?t ; :when ?w }
In Cypher a hyperedge is a node with role relationships, so both surfaces see the same structure.
Nested graphs that cost nothing per member
Each statement's ID is allocated from a chunk leased to one graph, so the home graph is read off the ID. Graphs nest as a DAG. GRAPH :g matches g and every graph under it; GRAPH! :g keeps standard SPARQL semantics. The planner turns a scope into an ID-range scan or an ID filter, so a query over a small episode graph is designed to cost in proportion to the episode. One statement can belong to several graphs: inserting it into a second graph adds a membership, and deleting it inside one graph removes only that membership (ADR 0024).
Rules inside the engine
SPARQL, Datalog and Cypher all lower to one extended-Datalog IR. Datalog is a query surface in its own right in v0, and SPARQL can call it through a reserved local service:
# @materialized arrives in v1; in v0 the same rules run on demand
@prefix : <http://example.org/> .
@materialized
ancestor(?x, ?y) :- :parent(?x, ?y) .
ancestor(?x, ?z) :- ancestor(?x, ?y), :parent(?y, ?z) .
?- ancestor(:alice, ?who) .
Different scales on purpose
| Neptune Analytics with OneGraph | graphlava | |
|---|---|---|
| What it is | A managed AWS service, in production | An embedded Rust library, in design |
| Where it runs | AWS | Inside the application: Linux, macOS, Windows, iOS, Android |
| Storage | Not public | One redb file, one owner process |
| Unit | Relationship and property statements | Statements with 64-bit IDs; inline properties; hyperedge records |
| Languages | openCypher over RDF, among others | SPARQL 1.2 and Datalog (v0), Cypher subset (v1) |
| Duplicates | Allowed in the OneGraph image | Per predicate: set by default, multi on request |
| n-ary relations | Not in the published images | Native hyperedges |
| Graph nesting | Named graphs through membership statements; no nesting in the published images | DAG with transitive scope |
| Scale target | Graph analytics as a cloud service | 10M to 1B statements per file on desktop, a few GB on phones (to be measured) |
Neptune is the stronger system for anything that needs a managed service, a shared graph for many users, large-scale analytics, or software that runs today. graphlava aims at a different place: one agent's memory, next to the agent, in the same process, with no network between them. Those are design goals, and every number in its specs still reads "to be measured".
The takeaway
OneGraph showed that one statement model can carry RDF and property graphs together, and Neptune showed it holds up in production. graphlava takes that model as given. Its own contribution is physical: IDs that survive updates, identity that appears only when something needs it, n-ary records, and nested graphs that are free to belong to. The model is shared. The scale and the trade-offs are not.
References
- O. Lassila, M. Schmidt et al. The OneGraph Vision: Challenges of Breaking the Graph Model Lock-In. Semantic Web Journal 14(1), 2023.
- E. Gelling, G. Fletcher, M. Schmidt. Bridging graph data models: RDF, RDF-star, and property graphs as directed acyclic graphs [extended abstract]. arXiv:2304.13097, 2023.
- E. Gelling, G. Fletcher, M. Schmidt. Statement Graphs: Unifying the Graph Data Model Landscape. DASFAA 2024, LNCS, pp. 364–376.
- M. Schmidt et al. (Amazon Neptune team). openCypher over RDF: Connecting Two Worlds. ISWC 2024 Posters, Demos and Industry Tracks, CEUR-WS Vol. 3828.
- AWS. Amazon Neptune Analytics now supports openCypher queries over RDF graphs. August 2024.
- graphlava specifications: data model, hyperedges, named and nested graphs, SPARQL 1.2, Cypher subset; decision records 0004 and 0005. github.com/Volland/graphlava.