CLI reference¶
Binary |
|
Stability |
Stable |
Related |
shifty <COMMAND>
version Print the shifty CLI version
inspect Show a layer's view of a shapes graph
validate Validate a data graph against a shapes graph
infer Run SHACL-AF rule inference (forward chaining to a fixpoint)
repair Show symbolic-repair structures for a data graph's violations
Common conventions¶
--shapes and --data accept local paths or http(s) URLs. Both are
repeatable, and multiple sources are merged into one graph before anything
else.
--data defaults to --shapes when omitted, which makes the single graph
serve as both. When both are given, the schema is compiled only from
--shapes; SHACL vocabulary in the data graph is ignored. See
Shapes graphs and data graphs.
--base sets the base IRI used while parsing relative IRIs.
Invalid shapes diagnostics, such as malformed SPARQL or an unresolved query
prefix, make validate, infer, and repair exit with an error. They
are not treated as unsupported features and cannot silently remove a constraint
or rule. inspect remains diagnostic-oriented and shows lowering output.
shifty validate¶
shifty validate --shapes <SHAPES> [--data <DATA>] [OPTIONS]
Flag |
Meaning |
|---|---|
|
Shapes file(s) or URL(s). Repeatable. Required. |
|
Data file(s) or URL(s). Repeatable. Defaults to |
|
Base IRI for parsing. |
|
|
|
Emit a W3C |
|
Skip SHACL-AF rule inference before validating. |
|
|
|
Use only this named shape as a validation entry point. Repeatable.
Alias: |
|
|
|
Write the data graph validation actually read, as Turtle, to |
|
Write the merged shapes graph, as Turtle, to |
|
Print input, shape, cache, and SPARQL execution telemetry afterwards. See --profile. |
Default output for the first-validation example:
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
The summary groups by finding. affects lists the focus nodes with that
failure; value node identifies an offending value when one exists. One
focus node can appear under several findings.
Graph modes¶
Mode |
Behaviour |
|---|---|
|
Focus nodes and evaluation use the data graph only. |
|
Focus nodes from data; path traversal, class hierarchy, and SPARQL see data ∪ shapes. |
|
Focus nodes and evaluation both see data ∪ shapes. |
Named entry points¶
--shape-name restricts which target-bearing statements select focus nodes.
Helper shapes reached through sh:node, sh:property, qualified value
shapes, and boolean shape expressions are still evaluated normally. IRIs may be
bare or in angle brackets.
shifty infer¶
shifty infer --shapes <SHAPES> [--data <DATA>] [OPTIONS]
Flag |
Meaning |
|---|---|
|
Shapes/rules file(s) or URL(s). Repeatable. Required. |
|
Data file(s) or URL(s). Repeatable. Defaults to |
|
Base IRI for parsing. |
|
|
|
Print input, shape, cache, and SPARQL execution telemetry afterwards. See --profile. |
inferred 1 triple(s):
<http://example.org/r1> <http://example.org/area> "3"^^<http://www.w3.org/2001/XMLSchema#integer>
Only the derived triples are printed. The CLI does not write a merged graph;
use the Python API’s InferResult.graph() for that (Run SHACL-AF inference).
shifty repair¶
shifty repair --shapes <SHAPES> [--data <DATA>] [OPTIONS]
Flag |
Meaning |
|---|---|
|
Shapes file(s) or URL(s). Repeatable. Required. |
|
Data file(s) or URL(s). Repeatable. Defaults to |
|
Base IRI for parsing. |
|
|
|
|
|
Skip SHACL-AF rule inference before witnessing. |
|
Run the fixpoint driver and emit the repaired data graph as N-Triples.
Overrides |
Stage |
What it prints |
|---|---|
|
The witness tree per failing focus node — why each violates. |
|
The synthesized repair template per failing focus node — how it could be fixed, with holes and decision points left open. |
|
A concrete delta found by the built-in enumeration driver. |
The enumeration driver binds holes from terms already present in the graph. It is meant for inspection; Repair a graph covers driving the loop yourself.
shifty inspect¶
shifty inspect [--stage <STAGE>] [--format <FORMAT>] [--base <BASE>] <FILE>
The shapes file is a positional argument, not --shapes, and no data
graph is read.
Stage |
What it prints |
|---|---|
|
The raw parsed RDF triples, before lowering. |
|
The lowered formalism IR. |
|
The IR after common-subexpression elimination and simplification. |
|
The recursion and stratification analysis. |
|
The physical plan: focus sources and cost-ordered shape checks. |
|
Which SPARQL constraint queries lower to the native executor and which fall back to Spareval. |
|
Static default/shapes graph reads by statement, rule, and function; query/path identities, function calls, possible rule writes, and conservative coverage. This stage does not read a data graph or report runtime index choices. |
--format text (default) works for every stage. --format json works
except for capability;
--format dot emits Graphviz for the algebra and normalized stages
and is rejected for the others.
See Inspect how shapes were compiled for how to read each stage.
shifty version¶
shifty version
Prints the installed CLI version.
--profile¶
validate and infer accept --profile, which appends a telemetry
block to stdout after the normal output — after the sh:ValidationReport
document under --report, so it never interrupts it.
The block opens with the inputs: for each of --shapes and --data, the
format that parsed each source and the number of triples it contributed.
conforms: true
profile: shapes: 28 triples from shapes.ttl [turtle]
profile: data: 633 triples from ontology.ttl.md [turtle]
profile: stage: shapes load: 1.234 ms
profile: stage: compile: 2.345 ms
profile: stage: data load: 3.456 ms
profile: stage: session and inference: 4.567 ms
profile: inference: 0 triples added before validation
profile: stage: first validation: 5.678 ms
profile: stage: export: 0.009 ms
profile: 2 distinct shape(s)/rule(s)
rule[0]: 1 call(s), 24µs total, 24µs avg
...
The format is the one that succeeded, not the one the extension suggests. A
document is identified by content type, then by extension, then by sniffing its
first non-comment token, and finally by trying each supported format in turn;
ontology.ttl.md above is literate Turtle — markdown prose on # comment
lines, statements indented — and is reported as turtle because Turtle is
what read it.
This is how to tell an empty result from an unread input: a shape whose target
predicate never appears in the data conforms vacuously, and conforms: true
alone cannot distinguish that from a document that failed to contribute
anything. With several sources the header gives the merged graph’s size and
each source’s own contribution:
profile: data: 2 triples from 2 sources (1 triple dropped as duplicate)
first.ttl: 1 triple [turtle]
second.ttl: 2 triples [turtle]
validate also reports what rule inference added before validation, or
skipped (--no-infer). Both commands time input loading, compilation,
session construction (including inference), and output formatting;
validate additionally times the first validation or report. The storage
line counts Store and encoded-dataset
builds, source and local rows, committed inference rows, optional index bytes,
and index builds declined by the budget. A second line attributes source and
access-catalog compilation time, source and session encoding time, plus
inference commit batches and their total time. The
primary-pair-buffer line reports allocated PSO pair capacities separately for
shared source and session partitions; it excludes dictionary strings and map
nodes. The graph-materialization line counts full union Graph copies and lazy
compatibility projections; compiled validation should report zero for both
unless a caller requests a
public graph getter. Each optional index decision then names the source or
session scope, index direction, predicate when applicable, compiled-demand or
observed-probe reason, estimated
and allocated bytes, budget, build time, and whether admission succeeded. Scan
lines count calls and candidate rows by graph scope and bound positions
(S, P, O); they help identify repeated broad scans even when an
index builds successfully. Reach-cache lines count hits, misses, insertions,
and result IDs declined by its separate admission cap. Then come per-shape and
per-rule wall-clock time, shape-cache hit rate
and peak size, and per-query SPARQL execution time. These are timings from one run,
rather than benchmark samples.
--dump-data and --dump-shapes¶
validate can write out the two graphs it evaluated, as Turtle, to a path or
to stdout with -:
shifty validate --shapes shapes.ttl --data ontology.ttl \
--dump-data used-data.ttl --dump-shapes used-shapes.ttl
Neither graph is the file on disk, which is the reason the flags exist:
The data graph is post-inference. Unless
--no-inferis given, SHACL-AF rules run before validation and their conclusions are part of what the constraints see. A shape that fails on a triple appearing in no input document is failing on an inferred one, and the dump is where to find it.The shapes graph is every
--shapessource merged, so a constraint that only exists after two files are combined shows up here as it was evaluated.Under the default
--graph-mode unionthe evaluator reads the two together; they are dumped separately, as they are held.
Blank node labels are the parser’s own, so they are stable within a run but need not match the source document’s.
Both dumps are written before the validation result, so a run that goes on to
fail still leaves them behind. With - and --report on the same command
line, the dumped graph comes first and the report follows.
Seeing what inference contributed:
$ shifty validate --shapes shapes.ttl --data alias.ttl --dump-data - --profile
@prefix bro: <https://ontology.brickschema.org/2.0/#bro:> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
bro:AHU rdfs:subClassOf bro:AirHandlingUnit ;
a rdfs:Class ;
bro:aliasClassOf bro:AirHandlingUnit .
bro:AirHandlingUnit rdfs:subClassOf bro:AHU ;
a rdfs:Class .
conforms: true
profile: data: 3 triples from alias.ttl [turtle]
profile: inference: 2 triples added before validation
The two rdfs:subClassOf statements are in no input file; a rule derived
them.