axiothOntology Hub

Learn what an ontology is / Part 2. Representing and connecting data · Lesson 10 of 16

RDF graphs and property graphs (LPG)

Both are graphs; they differ in how edges carry values, in identifiers and in standards.

"Graph database" covers two models. One is RDF, as seen so far. The other is the labelled property graph (LPG) used by products such as Neo4j. Draw the same fact, "Minji has kept Nabi since 2021", both ways.

Draw the same fact three ways

"Minji has kept Nabi since 2021"

:KEEPSsince: 2021Minji:PersonNabi:Cat

The value since sits directly on the KEEPS edge. Two nodes, one edge. Person and Cat are labels on the nodes.

(minji:Person {name: "Minji"})-[:KEEPS {since: 2021}]->(nabi:Cat {name: "Nabi"})

What differs

RDFLPG
Basic unitTriple (subject, predicate, object)Nodes and edges, both with key-value properties
NamesGlobal IRIs; data from other organisations merges as isInternal ids and labels inside one database
Properties on an edgeNot directly; use an intermediate node or RDF 1.2Directly on the edge
Schema and meaningW3C standards: RDFS, OWL, SHACLProduct-specific constraints; no standard semantics
QuerySPARQL (W3C)Cypher, and the ISO standard GQL
InferenceDefined by the standardsNot part of the model; strong at path traversal and graph algorithms
Good fitIntegrating many sources, shared vocabularies, open dataPath analysis inside one system, recommendation, fraud detection

One question, two languages

// LPG (Cypher / GQL)
MATCH (p:Person)-[k:KEEPS]->(c:Cat)
WHERE k.since < 2022
RETURN p.name, c.name
# RDF (SPARQL), with "keeping" as a node
SELECT ?person ?cat WHERE {
  ?k a ex:Keeping ; ex:keeper ?person ; ex:pet ?cat ; ex:since ?y .
  FILTER (?y < 2022)
}

Do you have to choose?

No. An ontology is the blueprint that fixes what is what; where you store data that follows it is a separate choice. Tools exist that bring an RDF ontology into an LPG as labels and relationship names, and RDF 1.2 narrows the gap on edge values.

To combine data from many places so that meanings line up, RDF is the easier path. To traverse and analyse data in one place quickly, LPG is. An ontology serves as the shared vocabulary for both.

Read more in the specifications