Shifty¶
Shifty is a SHACL/SHACL-AF inference and validation engine for RDF graphs. It is available from Python, the command line, C++17, Rust, and WebAssembly.
Quick start¶
Validate a data graph against a shapes graph:
shifty validate --shapes shapes.ttl --data data.ttl
conforms: false — 1 violation in 2 findings
Finding 1 of 2
target class(ex:Person)
severity Violation
shape ex:PersonShape
failure at least 1 value(s) required along ex:email, found 0
path ex:email
found 0 value(s) along the path; at least 1 required
requirement ∃[1..] ex:email
affects ex:bob
value node (the focus node itself)
also fails Finding 2
Finding 2 of 2
target class(ex:Person)
severity Violation
shape ex:PersonShape
failure test(datatype(xsd:string)) not satisfied
path ex:name
requirement test(datatype(xsd:string))
affects ex:bob
value node "123"^^xsd:integer
also fails Finding 1
notation
∃[m..n] p . X between m and n values along p satisfy X
Run SHACL-AF rules to a fixed point:
shifty infer --shapes rules.ttl --data data.ttl
The structured Python interface returns a validation decision and reasons:
import shifty
result = shifty.validate_algebra("data.ttl", "shapes.ttl")
print("conforms:", result.conforms)
for violation in result.violations:
print(violation.focus_node)
conforms: False
<http://example.org/bob>
The playground runs the WebAssembly build locally in the browser, so graphs entered there do not leave the machine.
Validation interfaces¶
Shifty compiles SHACL into the path and shape algebra developed in Ahmetaj et al., Common Foundations for SHACL, ShEx, and PG-Schema (The Web Conference 2025). The compiled representation supports normalization, shared subexpressions, indexed target selection, and cost-based planning before evaluation begins.
Two result interfaces are available:
Interface |
Result |
|---|---|
Native algebraic |
|
W3C-compatible |
|
The native representation also supports evidence, passing-node property witnesses, and shape-map bindings. See Result interfaces for the tradeoffs between the two result models and Introducing the Shifty SHACL Engine for the original rationale.
Interface support¶
|
|
Install the |
|
Link the C++17 static library and use its prepared-validator API. |
|
Use the engine crates directly; API details live on docs.rs. |
|
Run Shifty locally in the browser. |
Common tasks¶
Install Shifty, validate a small graph, and fix one failure. |
|
Choose graph visibility, report format, severity threshold, and named entry shapes. |
|
Execute SHACL-AF rules and retrieve the inferred triples. |
|
Trace a finding through its compiled constraint and supporting triples. |
|
Query which focus nodes and values matched selected shapes. |
|
Inspect the lowered algebra, normalization, recursion strata, and plan. |
|
Explore candidate graph edits with the experimental repair API. |
Note
Symbolic repair is experimental. Its API may change; see Repair a graph for its current scope.
Documentation¶
Guided introductions to validation, results, and evidence. |
|
Procedures for specific validation and inference tasks. |
|
Interfaces, options, fields, and feature-support boundaries. |
|
Design, semantics, and performance tradeoffs. |
|
Validation performance across real building models, tracked per release. |
The documentation contribution guide describes the page conventions and preview workflow. Documentation issues can be filed on GitHub.