Expand description
ikigai-shacl — SHACL validation as an ikigai resource.
urn:shacl:validate validates a piped RDF data graph against a SHACL shapes graph. The
validation report is itself an RDF graph: the default text/turtle output is the SHACL
ValidationReport (conforms + a node per violation), skolemized under a content address of the
report so it carries no blank node (every one is named under REPORT_SCHEME), and
application/json gives a structured
Report — {conforms, violations: [{focus_node, path, component, message, value}]} —
content-negotiated structured errors for free. Both faces carry the same facts: the
sh:resultMessage with its {?value}-style template resolved, the offending sh:value,
and the sh:resultPath.
shapes is taken by reference (the ROC-idiomatic form: a shapes graph is a resource
you point at, sourced through the kernel — cacheable, golden-threaded); inline Turtle is
also accepted. So the endpoint is async (the one await is the shapes resolution).
§Two validators, one resource (ledger #1176)
rudof(the default feature): rudof’s consolidatedshaclcrate, all of SHACL Core and SHACL-SPARQL’ssh:select, behind the bounds inrudof_engine. A heavy dependency tree, and one that cannot be built without a network stack on native (rudof’s IRI crate links reqwest, and its RDF crate turns on tokio).core_shacl, always compiled: a subset validator with no rudof, no network stack and no recursion over either graph, for a host that turnsrudofoff. It REFUSES, by name, every SHACL term outside that subset rather than skip a constraint it does not understand. Vocab 0.5.7 shapes usesh:orand require rudof. Itssh:sparql/sh:selectconstraints come with thesparqlfeature (whichrudofimplies), and with it oxigraph’s store and ikigai-store’s guards and time budget. With default features off it is the CORE constraints alone, on oxrdf and oxttl (ledger #2107): small enough for an in-page wasm kernel, bounded by work rather than time (core_shacl::MAX_VALIDATION_WORK), and refusing a SHACL-SPARQL construct by name.
With both compiled the endpoint uses rudof; tests/differential.rs runs both over one corpus
and requires the same verdicts. The module feature (a lazy-loadable WASM module) implies
rudof. The JavaScript shacl-engine remains a third implementation of the same
urn:shacl:validate resource, held to the parity corpus (see js-parity/).
Modules§
- core_
shacl - A SHACL subset validator with no rudof, no network stack and no recursion (ledger #1176).
Structs§
- Quoted
Triple - The value of a
Term::Triple: an RDF-star quoted triple. - Report
- The
application/jsonface ofurn:shacl:validate:conforms+ oneReportResultpersh:result, sorted. The exact shape, pinned — this is what a consumer parses: - Report
Result - One validation result as the
application/jsonface reports it. The first three keys are the parityViolationsignature and keep their names and order;messageandvaluefollow. Sorted by these fields in this order, so a report is deterministic. - Validation
Outcome - The portable validation outcome:
conforms+ the sorted violation signatures. This is the parity contract intests/corpus/*/expected.json(seetests/parity.rs); the endpoint’sapplication/jsonface is the richerReport. - Violation
- One conformance violation, reduced to its implementation-independent signature — the
spec-defined parts every SHACL validator agrees on. (Deliberately omits
sh:resultMessageand blank-node ids, which legitimately differ between validators.) This is the cross-impl parity contract: rudof (native) and shacl-engine (browser) must produce the same set. The endpoint’s JSON face is the richerReportResult; a signature is its first three keys.
Enums§
- Term
- An RDF term in the SPARQL 1.1 Query Results JSON encoding —
{"type": "uri" | "bnode" | "literal", "value": …}, a literal carrying"xml:lang"when language-tagged and"datatype"when typed (a plainxsd:stringcarries neither, as in that spec). An RDF-star quoted triple is{"type": "triple", "value": {subject, predicate, object}}(the SPARQL 1.2 form).
Constants§
- MAX_
DATA_ RECURSION - How deep validation may recurse along the DATA, counted in nested shape validations: the
shapes graph’s own depth, plus the shapes in its recursive groups that move along a path
times the data nodes along the longest chain of those paths’ links (a cycle in the data
counting all of its nodes, as a recursive group of shapes does). 16,384 admits a
self-recursive
foaf:knows-style shape (two shapes a link) over about 8,000 people in one chain or one strongly connected group. A cycle is no escape: rudof cuts it where it closes, so a ring of 3,000 recursed as deep as a chain of 3,000 and aborted the same way. Validation is given a stack grown for each level the data can reach, so the bound, not the thread, is what refuses. - MAX_
SHAPE_ DEPTH - How deep the shapes graph may nest, counted in NODES along the longest chain of shape
references and path operators, a recursive group counting all its shapes. The same 64, and
far from both ends: the deepest shapes graphs in the ecosystem measure 5 (ikigai-vocab’s
shapes.ttland ikigai-core’sfn.shape.ttl, 2026-10-10, by the ignoredmeasuretest; this crate’s parity corpus is 3), while a debug build compiled 100 levels ofsh:noton a 2 MiB thread and aborted at 300, and compiling now runs on 16 MiB or more. - MAX_
TURTLE_ NESTING - How deep caller RDF may nest RDF 1.2 triple terms and reified triples (
<<( … )>>,<< … >>), counted per<<; for RDF/XML, per nested element carryingrdf:parseType. The same number asikigai_store::limits::MAX_SPARQL_NESTINGand ikigai-shacl’s: one bound on caller nesting across the doors. Real data nests these a handful deep; a debug build survived 300 levels on a 2 MiB thread and aborted at 3000. - REPORT_
SCHEME - The prefix every node of the report graph is named under:
urn:ikigai:shacl:report:<content id of the report graph>:<blank-node label>. A consumer can recognize a node this crate minted by this prefix, and nothing else in a report carries it. - SPACE_
ID - The name
spaceclaims:urn:iki:space:shacl.
Functions§
- space
- The space binding
urn:shacl:validate. It is configuration-free (no parameters, nothing read while building it), so it names itselfSPACE_ID; the name goes on LAST, because binding a door after naming drops the name (core 0.1.89). - validate_
outcome - Validate
data_ttlagainstshapes_ttl, returning the portableValidationOutcome— the parity contract. - validate_
report - Validate
data_ttlagainstshapes_ttl, returning the fullReport— what theapplication/jsonface serializes. rudof with therudoffeature, elsecore_shacl. Withsparql(whichrudofimplies), within the base time budget (5 s), past which it is refused with a typedError::OverBudget(a library call carries no capability to grant more); without it, withincore_shacl::MAX_VALIDATION_WORK, past which it is refused with a typedError::InvalidArgument. - validate_
turtle - Validate
data_ttlagainstshapes_ttl, returning the report graph as Turtle — what the defaulttext/turtleface serves. rudof with therudoffeature, elsecore_shacl; within the same bound asvalidate_report.