Expand description
Lower a loaded shapes graph into the formalism Schema.
This is the semantic boundary of the implementation. Above it, SHACL is an RDF graph: the meaning of one shape may be spread across many triples and RDF lists, and references may form cycles. Below it, every later phase sees a small graph of focus-node predicates. Keeping that translation here makes the evaluator, normalizer, planner, and evidence system independent of the accidental layout of the source graph.
Every SHACL Core construct collapses into the small IR, applying the sugar
rules from the gap analysis (class → path, minCount/maxCount → Count,
per-value constraints wrapped in ∀π = ∃≤0 π.¬φ, xone → ∧∨¬, …). Each
shape lowers to a focus-node predicate φ, so sh:property/sh:node
compose by conjunction. Unsupported AF constructs emit diagnostics rather
than becoming an implicit, weaker constraint.
The lowering pass first discovers deterministic roots and then lowers helper shapes on demand. It reserves a slot before reading a shape body, which is sufficient to represent recursive references without a special recursive AST. The body is assembled as a conjunction, source metadata is attached, and targets/rules/custom components are derived from the same source map.
The result keeps two identities: ShapeId is the compact execution identity,
while Schema::sources points back to the authored RDF resource. Provenance
stays outside the evaluator so the execution IR can remain small and
canonical.
Structs§
Functions§
- canonical_
sparql_ query - Build the canonical, prefix-expanded form of a SHACL SPARQL query string.
- lower
- Lower a loaded graph into a schema plus diagnostics.