Skip to main content

Module validate

Module validate 

Source
Expand description

Comprehensive graph-level SHACL validation.

ShaclCompiler lowers a shape to SlgOpcodes for the firewall (LLM-rule gating). This module is the complementary data validator: it interprets the full ShaclConstraint vocabulary against a graph of NQuins and produces a real ValidationReport — the path a “validate this data against this shape” request (e.g. the docs playground, ingestion-time conformance) actually takes.

§Values are hashes — string constraints need a resolver

Quin object fields hold either an inline-typed literal (numeric/boolean, decodable here via [frame_layout]) or the q_hash of a lexical value (IRIs and strings — one-way). Numeric/cardinality/value-type/structural constraints are therefore fully enforceable on the bare graph. String-shaped constraints (sh:pattern, sh:minLength/maxLength, sh:languageIn, sh:uniqueLang) need the original lexical form, so the caller supplies a resolve: hash -> Option<String>. When a value cannot be resolved, a string-shaped constraint reports a Violation (the value cannot be shown to conform) rather than silently passing — fail closed.

Cold path: ValidationReport is Vec-backed (allocation is expected here, as in the existing sparql_shacl validator); the zero-heap invariant covers the hot path, not shape validation.

Structs§

ShaclEngine
Engine binding shapes + graph for a validation pass.

Functions§

object_as_f64
Decode an inline-typed object field to an f64, or None if the object is a pointer / IRI hash / un-typed (i.e. not a comparable number).

Type Aliases§

Resolver
A lexical-value resolver: maps a value hash back to its original string when available (used only by string-shaped constraints).