Volodymyr Pavlyshyn

Projects · open source

shacl2cypher

Validate a property graph with shapes, not hand-written queries.

SHACL is the W3C language for saying what a graph must look like — every Person has a name, works for at most one Company. shacl2cypher reads those shapes and compiles each constraint into a named, read-only Cypher query: one that lists the violations, and one that counts them.

It can run the queries itself against Neo4j 5, LadybugDB or FalkorDB and report what it finds as a table, JSON, JUnit or SARIF — so the same shapes that document a model can fail a CI build. A CLI in Rust, with Python and Node packages whose output is byte-identical to it.

shacl shape read-only cypher sh:path ex:name sh:minCount 1 MATCH (n:Person) WHERE n.name IS NULL compile “Person id=p3: Person needs a name.” neo4j · ladybugdb · falkordb the shapes that document the model now test it

What it does

Read-only by construction
Neo4j queries run in a transaction that is always rolled back; LadybugDB files open read-only; FalkorDB uses GRAPH.RO_QUERY.
Most of SHACL Core
Cardinality, datatypes, ranges, patterns, sh:in, sh:closed, logical and qualified shapes, and property paths.
Deterministic output
A manifest with provenance and one structural rule id per constraint. Input order never changes a name or a query.
Tested against the standard
Conformance fixtures on all three engines, cross-checked with pySHACL, plus the W3C SHACL Core suite on Neo4j.

In a terminal

STATUS   SEVERITY   VIOLATIONS  RULE
failed   Violation           1  PersonShape.name.minCount
         - Person id=p3: Person needs a name
failed   Warning             1  PersonShape.name.pattern
failed   Violation           1  PersonShape.worksFor.maxCount

3 rules: 0 passed, 3 failed; 3 violations in 42 ms
$ shacl2cypher validate shapes.ttl --ladybug graph.lbug --node-key id

← All projects