Shifty

Formalism-first SHACL validation and SHACL-AF inference — available as a CLI, Python library, and browser playground.

PyPI Crates.io docs.rs GitHub BSD-3-Clause
pip install pyshifty cargo install --path crates/shifty-cli

Shifty implements both SHACL Core validation and SHACL-AF forward-chaining inference, grounded in the algebraic treatment of Common Foundations for SHACL, ShEx, and PG-Schema. Shapes are compiled to a path algebra (π) and shape grammar (φ) before evaluation — the same IR drives both validation and inference.

  • Full SHACL Core validation — node and property shapes, all standard constraint components

  • SHACL-AF inferencesh:rule evaluation (Triple Rules and SPARQL Construct Rules) to a fixed point

  • Algebraic IR — normalization, CSE, and cost-ordered physical planning before any execution

  • Multiple frontends — CLI, Python bindings (pyshifty), and a browser-native WebAssembly module

Quick start

CLI — validate a data graph against SHACL shapes:

shifty validate --shapes shapes.ttl --data data.ttl

Run SHACL-AF rules to a fixed point and print the inferred triples:

shifty infer --shapes rules.ttl --data data.ttl

Python — validate with a pyshacl-compatible interface:

import shifty

conforms, report_graph, results_text = shifty.validate(data, shapes)

Run inference and retrieve the extended graph:

result = shifty.infer(data, rules)
g = result.graph()           # rdflib.Graph with original + inferred triples

Browseropen the live playground to run validation and inference entirely in your browser with no installation required.

Contents