Every option, field and exit code
For version 0.2.0. Run shacl2cypher <command> --help for the options of the binary you have installed.
compile · validate · schema dump · s2c: annotations · supported SHACL · datatypes · manifest · rows · reports · exit codes
compile
Compile shapes files (Turtle .ttl, N-Triples .nt, TriG .trig) into manifest.json and queries.cypher.
shacl2cypher compile [OPTIONS] --dialect <DIALECT> <SHAPES>...
- --dialect neo4j|ladybug
- Target Cypher dialect. Required.
- --schema <FILE>
- Schema snapshot JSON. Required for
ladybug. Optional forneo4j, where it adds evidence for resolution and diagnostics. - --ontology <FILE>
- Repeatable. Files contributing
rdfs:subClassOfstatements for class expansion. - --node-key <PROPERTY>
- Property identifying nodes in rows when a shape has no
s2c:key. Also needed when IRI constants are compared with relationship values. - --neo4j-labels explicit|inherited
explicit(default) matches every subclass label.inheritedassumes nodes already carry their superclass labels.- --strict
- Fail on any label, property or relationship type chosen by convention alone.
- --lenient
- Record unsupported features as
unsupportedrules instead of failing. - --verbose
- Include all focus properties in detail rows.
- --max-path-depth <N>
- Upper bound for
sh:zeroOrMorePath/sh:oneOrMorePath. Default 10; LadybugDB allows at most 30. - --allow-remote-imports
- Fetch
owl:importsof http(s) IRIs (30 s timeout, 16 MB cap). - --fail-on-schema-mismatch
- Turn static schema diagnostics into one compile error.
- -o, --output <DIR>
- Output directory. Default: the working directory.
Compile errors print one error: line per problem with file:line, write no files and exit 1. Static diagnostics print as warning: file:line: code: message.
validate
Validate a database against shapes files, compiled in memory for the connected dialect, or against a compiled manifest.
shacl2cypher validate [OPTIONS] [SHAPES]...
It accepts every compile option except --dialect and -o, plus:
- --manifest <FILE>
- Run a manifest written by
compile. A manifest for another dialect is rejected. - --connect <URI>
- Neo4j Bolt URI, e.g.
bolt://localhost:7687. - --user, --password, --database
- Neo4j credentials (
NEO4J_USER,NEO4J_PASSWORD) and database name. - --ladybug <FILE>
- LadybugDB database file, opened read-only. A missing file is an error.
- --format table|json|junit|sarif
- Report format. Default
table. - -o, --output <FILE>
- Write the report to a file instead of stdout.
- --limit <N>
- Violations listed per rule. Default 100;
0lists all. - --sample-size <N>
- Focus samples per summary row. Default 5.
- --timeout <SECONDS>
- Per-query timeout. A timed-out rule is reported and the other rules still run.
- --fail-on violation|warning|info
- Lowest severity whose violations fail the run. Default
violation.
Every rule with queries runs its summary query. Rules with violations then run their detail query.
schema dump
shacl2cypher schema dump (--connect <URI> | --ladybug <FILE>) [-o schema.json]
Writes a snapshot that compile --schema accepts unchanged:
{
"nodeTypes": [{ "name": "Person", "properties": [{ "name": "email", "type": "STRING" }] }],
"relTypes": [{ "name": "KNOWS", "endpoints": [{ "from": "Person", "to": "Person" }],
"properties": [{ "name": "since", "type": "DATE" }] }]
}
Types: STRING, INT64/INT32/INT16/INT8, UINT64…UINT8, DOUBLE, FLOAT, DECIMAL, BOOLEAN, DATE, LOCAL_DATETIME, ZONED_DATETIME, LOCAL_TIME, ZONED_TIME, DURATION, POINT, BLOB, ANY and LIST<T>. On Neo4j the snapshot reflects observed data: mixed types become ANY, and endpoints come from a scan of every relationship.
The s2c: annotation vocabulary
Declare @prefix s2c: <https://w3id.org/shacl2cypher#> . Other SHACL engines ignore these triples. Parsing is strict: an unknown s2c: predicate, an invalid value or a wrong subject is a compile error.
| Annotation | Subject | Meaning |
|---|---|---|
s2c:label | class IRI or node shape | label / node table name |
s2c:property | predicate or property shape | property key |
s2c:relationship | predicate or property shape | relationship type / rel table |
s2c:direction | predicate or property shape | "out" or "in" |
s2c:key | node shape | identifying property of the focus label |
s2c:datatype | predicate or property shape | exact native type, e.g. "LOCAL_DATETIME" |
s2c:collection | predicate or property shape | "list" (one value per element) or "scalar" |
s2c:iriAsString | property shape | IRI constants as "local" names (default) or "full" IRIs |
s2c:targetRelationship | node shape | every relationship of this type is a focus |
s2c:name | any shape | explicit rule name |
Supported SHACL
| Group | Features |
|---|---|
| Targets | sh:targetClass, implicit class targets, sh:targetSubjectsOf, sh:targetObjectsOf, s2c:targetRelationship |
| Cardinality | sh:minCount, sh:maxCount |
| Value type | sh:datatype, sh:nodeKind, sh:class |
| Ranges | sh:minInclusive, sh:maxInclusive, sh:minExclusive, sh:maxExclusive |
| Strings | sh:minLength, sh:maxLength, sh:pattern with sh:flags (i, s, m, x, q) |
| Other | sh:in, sh:hasValue, sh:equals, sh:disjoint, sh:lessThan, sh:lessThanOrEquals, sh:closed, sh:ignoredProperties |
| Metadata | sh:severity, sh:message (with {$this}/{?value}), sh:deactivated |
| Logical | sh:node, sh:not, sh:and, sh:or, sh:xone |
| Qualified | sh:qualifiedValueShape, sh:qualifiedMinCount, sh:qualifiedMaxCount, sh:qualifiedValueShapesDisjoint |
| Paths | sequence, sh:inversePath, sh:alternativePath, sh:zeroOrMorePath, sh:oneOrMorePath, sh:zeroOrOnePath |
Rejected at compile time (or unsupported rules with --lenient): sh:targetNode, SHACL-SPARQL, sh:languageIn, sh:uniqueLang, rdf:langString, and recursive shapes. Property shapes nested inside property shapes are not supported yet.
Datatypes
| XSD | Neo4j 5 | LadybugDB |
|---|---|---|
xsd:string, xsd:anyURI | IS :: STRING | STRING |
xsd:integer, long, int, short, byte | IS :: INTEGER plus a range check for narrow types | INT64/INT32/INT16/INT8 |
xsd:decimal, double, float | IS :: FLOAT (decimal is lossy) | DECIMAL/DOUBLE/FLOAT |
xsd:boolean | IS :: BOOLEAN | BOOL |
xsd:date | IS :: DATE | DATE |
xsd:dateTime | ZONED DATETIME or LOCAL DATETIME | TIMESTAMP |
xsd:duration | IS :: DURATION | INTERVAL |
rdf:langString | compile error | compile error |
Manifest
Top-level fields: schemaVersion, compilerVersion, dialect, inputs ({path, role, sha256}), schemaSnapshotHash, options, rules, staticDiagnostics, recommendedIndexes.
Each rule: name, ruleId, fingerprint, shape, path, constraint, severity, status, costClass, source, statusReason, pathDepthCap, message and queries (detail, summary, or null).
| Status | Meaning |
|---|---|
compiled | Has queries. |
guaranteed-by-schema | The enforced schema (LadybugDB) already guarantees it; no query. |
schema-mismatch | The enforced schema contradicts it; a static diagnostic explains why. |
deactivated | sh:deactivated true. |
unsupported | A rejected feature, recorded under --lenient. |
Cost classes, most to least expensive: unbounded-path, quadratic (pair constraints over relationship paths), scan+expand (any traversal), scan.
Rule ids are structural, e.g. ex:PersonShape/ex:address/sh:or[0]/ex:street/sh:minCount. Names use local names (PersonShape.name.minCount). On a collision, a 6-hex content hash is appended.
Result rows
Detail rows (one per violation, capped by $limit): ruleId, shape, path, constraint, severity, focus, value, message, details.
- Node focus:
{label, key, keyValue, elementId}. Relationship focus:{type, startKey, endKey, elementId}. detailslists the inner rule ids that failed for nested shapes, e.g.["ex:AddressShape/ex:zip/sh:pattern"].
Summary rows (exactly one per rule, even with zero violations): ruleId, severity, violationCount, sample.
Reports
| Format | Content |
|---|---|
table | status, severity, count and time per rule, up to 10 violations each, then totals |
json | the full report: conforms, complete, a summary, and every rule with durationMs and detail rows |
junit | one test case per rule; violations are failures, timeouts and query errors are errors |
sarif | SARIF 2.1.0, one result per violation located at the constraint's shapes file and line |
Rule statuses in a report: passed, failed, timeout, error, skipped (deactivated, unsupported, schema-mismatch), guaranteed-by-schema.
Exit codes
| Code | Meaning |
|---|---|
0 | No rule at or above --fail-on has violations, and every query completed. |
1 | A rule at or above --fail-on has violations. For compile: compile errors. |
2 | Usage or setup error: bad arguments, compile errors during validate, unreachable database, or no backend compiled in. |
3 | Nothing failed, but a query timed out or errored, so the result is incomplete. |