If you have written software for more than a few years, you have already modeled graphs. You just drew them as classes, foreign keys and parent_id columns. A labeled property graph (LPG) is the model that stops pretending otherwise. This article covers where it came from, what it teaches about modeling, and where it starts to hurt. It then shows how LPG Modeler removes the part that hurts, with numbers you can reproduce.
A short history, told through developers’ pain
1960s–70s: the network model. Data was pointers. CODASYL databases let you navigate from record to record by following links. It was fast and it was brittle: change the structure and every program that walked it broke.
1970: the relational model. Codd’s answer was to separate what you mean from how it is stored. Tables, keys and joins won, for good reasons. Relationships became a second-class citizen, though: a foreign key, and later a join table, that you reconstruct on every query.
1976: entity–relationship modeling. Chen gave developers the vocabulary we still sketch on whiteboards: entities, attributes, relationships. The whiteboard was a graph. The database was not.
1999–2004: RDF and the semantic web. The W3C standardized graphs of triples, with ontologies (OWL) and later shape constraints (SHACL). It was rigorous and global, but properties on a relationship needed workarounds such as reification, and most application developers found it heavy.
Around 2007: the property graph becomes a product. Neo4j shipped a database that stored nodes and relationships directly, with key–value properties on both. Tinkerpop and Gremlin followed around 2009, then Cypher, then openCypher (2015). This is the labeled property graph:
Nodes carry one or more labels (
:Truck,:Vehicle) and properties.Relationships are first-class, directed, typed, and carry properties of their own.
There is no mandatory schema, which is why developers adopted it so quickly.
2023–2024: the standards arrive. SQL:2023 added property graph queries (SQL/PGQ). In April 2024 ISO published GQL (ISO/IEC 39075), the first new ISO database language since SQL. The research community proposed PG-Schema for describing graph types. LPG is now a standardized family rather than a vendor idiom.
The pattern across fifty years: each model fixed the previous model’s pain for developers, and each time the pain was the distance between how we think about the domain and what we have to write. The LPG’s contribution is that the distance is short. A relationship is a thing you can name and attach data to.
What developers can learn from LPG modeling
1. Model the questions, not the tables. In a graph you design for traversal: what can this type relate to, and what do I need to ask? That discipline improves relational and object models too.
2. Relationships deserve to be nouns. DRIVES {since: 2024-01-01} is a modeling decision, not a join table that happens to have a date column. Once relationships carry properties, a whole class of “link entity” boilerplate disappears.
3. Labels are a typing system, and a loose one. A node can be :Truck:Vehicle:Asset at once. That is powerful, and it is the first place teams get into trouble. Without a schema, two services spell the same property createdAt and created_at and nothing complains until production.
4. “Schema-optional” is not “schema-free.” The schema exists whether or not you write it down. If it lives only in the heads of the team and in scattered CREATE CONSTRAINT statements, it drifts. The lesson from the standards work (PG-Schema, GQL graph types, SHACL) is that you eventually want a declared, checkable schema.
5. Reuse and subtyping are different claims. This is the one that matters most for what follows, so it gets its own section.
Inheritance is is-a. A mixin is carries.
Most graph models start flat: one node type per thing, every property spelled out. Then duplication appears, and developers reach for one of two tools.
Inheritance says what a thing is.
Truckis aVehicle, which is anAsset. An abstract parent can carry a key and edges down to every descendant: every asset can be stationed at a depot is one statement, not one per subtype.A mixin says what a thing carries.
Timestampedis a bag of properties (createdAt,updatedAt) that a type applies. It has no supertype and no identity. A type may apply several.
Conflating them is the classic mistake. createdAt on twenty types does not make twenty subtypes of a Timestamped. It makes a hierarchy shaped by which properties happen to travel together instead of by what things are. Keep the two tools separate and each does its own job well.
The cost of doing this by hand in a raw LPG
A raw LPG has no extends, no mixins, and (depending on the engine) barely any schema. So you do the work yourself, once per engine:
Copy inherited properties into every concrete type’s table or constraint set.
Re-declare the shared edge for every concrete subtype.
Repeat all of it for each target: Neo4j constraints, Memgraph, FalkorDB, LadybugDB DDL, SHACL for validation, an OWL ontology, GQL graph types.
Remember, in every one of those files, the fact that
Timestampedchanged.
None of this is hard. All of it is where bugs breed, because it is the same fact stated many times.
Enter LPG Modeler
LPG Modeler is a VS Code extension and CLI built around one idea: design the property graph once, and generate every schema from it.
Author as reviewable YAML, validated by a contributed JSON Schema, so completion and hover work out of the box.
Edit on a canvas beside the file. Every canvas action becomes a targeted text edit; layout coordinates live in a sidecar, so moving a box produces no semantic diff.
Inheritance and mixins as separate first-class tools. Abstract hierarchies are drawn with a dashed border and emit no table. Mixins are applied with checkboxes in the inspector, and a mixin panel lists every type that applies it, so you see what a change touches before making it. Both are flattened before any generator sees the model.
Nine targets from one model: LadybugDB, Neo4j, FalkorDB, Memgraph, SHACL, OWL, GQL graph types, PG-Schema and LinkML.
Honest about loss. Anything a target cannot enforce becomes an editor diagnostic and a comment at the lossy line. Nothing disappears quietly.
Import what you have from SHACL, OWL or a live database, and run in CI to gate pull requests on schema validity.
What it looks like
This is the checked-in fleet example, a three-level hierarchy with three mixins:
mixins:
Timestamped:
props:
createdAt: { type: zoneddatetime, required: true }
updatedAt: { type: zoneddatetime }
nodes:
Asset: # abstract root: carries the key
abstract: true
key: [assetTag]
Vehicle: # abstract middle: adds vin, fuel
abstract: true
extends: Asset
Truck: # three levels deep
extends: Vehicle
mixins: [Timestamped, Located]
props:
axles: { type: int, min: 2, max: 6 }
edges:
STATIONED_AT: # declared once, on the root
from: Asset
to: DepotTruck declares two properties of its own. It receives assetTag from Asset, vin and fuel from Vehicle, and four more from two mixins. The edge STATIONED_AT is written once and reaches every concrete asset.
The acceleration, measured
I ran the real CLI on fleet.lpg.yaml and counted. The comparison is against writing the same flattened schemas by hand, as you would in a raw LPG. These are counts of what you write and maintain, not stopwatch timings; how fast you type is your own business.
Raw LPG, by handWith LPG ModelerProperty declarations you write29 (every inherited and mixin property copied into every concrete type)16 (each declared once)Lines of source you author and review~895 across nine target files87 (non-comment, non-blank lines of YAML)Places to edit when Timestamped changesEvery concrete type that uses it, in every target file1 (the mixin)Places to edit to add an edge every asset needsOne per concrete subtype, per target1 (declare it on Asset)Targets that can drift apart9 independent hand-written files0 (all generated from one model)Lossy features reportedWhatever you rememberEvery one, as a diagnostic and an inline comment
Reading the numbers:
29 → 16 declarations. Inheritance and mixins mean each property is stated where it belongs and flattened for you. The ratio grows with the model: a mixin applied to twenty types turns twenty declarations into one.
895 → 87 lines, roughly a tenfold reduction in what a human must write and review. The generated files still exist, but they are build output, not source. A reviewer reads 87 lines of intent instead of 895 lines of consequence.
One-place changes. This is the real speedup. Adding a field to
Timestampedis a one-line diff in one file; the CLI regenerates every target consistently. By hand it is a scavenger hunt, and the hunt is where schemas diverge.
A fair caveat: fleet is a small example, and generated files are verbose by nature, so the line ratio is partly the nature of DDL. The structural numbers (declarations, edit points, drift risk) are the ones that scale with your domain, and they scale in your favor.
Try it
npx lpg-modeler-cli check fleet.lpg.yaml
npx lpg-modeler-cli emit fleet.lpg.yaml --target ladybug --target shacl --out ./schemaOr start from what you already run:
npx lpg-modeler-cli import domain.shacl.ttl domain.owl.ttl --out domain.lpg.yamlInstall the extension from the VS Code Marketplace, or read the documentation and examples.
Takeaways
- 1.
The LPG exists because developers wanted the model in their head and the model in the database to be the same shape.
- 2.
Model relationships as nouns, design for traversal, and write the schema down even when the database does not force you to.
- 3.
Inheritance (is-a) and mixins (carries) are different tools. Enforcing the distinction keeps the model honest.
- 4.
Anything stated nine times will eventually be stated nine different ways. State it once and generate the rest.
Originally published on Sovereign Agentic AI on Substack.