open-standards/wai/vocab/v1.shapes.ttl
Transaction Science 22928147f3 wai: the parameter-set pin, component identity, pin-aware selection
SPEC §3.1 defines the pin a manifest carries (conditioning.prior, and a
WAI2 rendition's prior): id, sha256, determinism, and the optional form,
tier and supersedes. The digest covers the whole parameter set. A set of
several files is pinned through its listing, the new registered prior
form wai.prior.set. A sink verifies the pin before it decodes, reports a
refusal with one of an ordered set of snake_case reasons, and decodes
only from the set it verified. Tier is a closed vocabulary; supersedes is
informative.

A pin that does not resolve makes its capability unsupported for that
envelope: SPEC §4 dispatch continues at the fallback, §7.1 selection at
the next rendition, and an inert envelope's error names the reasons. A
rendition entry may carry id, sha256 and, on a companion,
companion_of_id. SPEC §7 gains a Digests subsection, and §8 says how a
MINOR revision adds an optional member.

In wai-rs: the manifest types are #[non_exhaustive] with builders; a new
pin module verifies pins in memory and on disk; Wai::dispatch_verified,
WaiMulti::pick and primary check pins and component digests; every
neural decoder reads through ParamSource; a codec-free `ffi` feature
carries the C envelope surface with wai_envelope_select and
wai_neural_decode_ex. wai-web wraps wai::container. New vectors: the
int_mlicpp set-form twin and the pin-conformance corpus with an
independent Python verifier, plus sha256.json sidecars for the vectors
of capabilities that decode against a parameter set.

Squashed from wai/stream-a-parameter-set-identity onto link 12. Conflicts
are resolved to keep both sides; the integration commits that follow
make the two streams agree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 05:51:50 -04:00

50 lines
3.2 KiB
Turtle

@prefix wai: <https://wai.transaction.science/vocab/v1#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
# WAI v1 SHACL shapes — validates Manifest and the NeuralPrior
# reference. Enforces the modality + path enums and the
# codec-against-registered-menu constraint.
wai:ManifestShape a sh:NodeShape ;
sh:targetClass wai:Manifest ;
sh:property [ sh:path wai:modality ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;
sh:in ( wai:Image wai:Audio wai:Video wai:Volume wai:Mesh wai:Compressed ) ] ;
sh:property [ sh:path wai:path ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;
sh:in ( wai:NeuralPath wai:ZerothPath ) ] ;
sh:property [ sh:path wai:codec ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;
sh:in ( wai:PNG wai:JPEG wai:AVIF wai:JPEGXL wai:FLAC wai:Opus wai:AV1 wai:zstd wai:XZ ) ] ;
sh:property [ sh:path wai:contentHash ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
sh:pattern "^[a-f0-9]{64}$" ] ;
sh:property [ sh:path wai:size ; sh:datatype xsd:nonNegativeInteger ; sh:minCount 1 ; sh:maxCount 1 ] ;
sh:property [ sh:path wai:mediaType ; sh:datatype xsd:string ; sh:maxCount 1 ;
sh:pattern "^[a-z]+/[A-Za-z0-9+._-]+$" ] ;
sh:property [ sh:path wai:encodedAt ; sh:datatype xsd:dateTime ; sh:maxCount 1 ] .
wai:NeuralPriorShape a sh:NodeShape ;
sh:targetClass wai:NeuralPrior ;
sh:property [ sh:path wai:sharedPriorUri ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
sh:property [ sh:path wai:sharedPriorHash ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
sh:pattern "^[a-f0-9]{64}$" ] .
# The parameter-set pin (SPEC §3.1). The JSON-LD context types no `prior` object,
# so the shape targets whatever `wai:prior` points at rather than a class.
# `pinTier` is a closed vocabulary; the tokens are the ones `codecs::TIER_TOKENS`
# holds.
wai:ParameterSetPinShape a sh:NodeShape ;
sh:targetObjectsOf wai:prior ;
sh:property [ sh:path wai:pinId ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
sh:property [ sh:path wai:pinSha256 ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
sh:pattern "^[a-f0-9]{64}$" ] ;
sh:property [ sh:path wai:pinDeterminism ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
sh:property [ sh:path wai:pinForm ; sh:datatype xsd:string ; sh:maxCount 1 ] ;
sh:property [ sh:path wai:pinTier ; sh:datatype xsd:string ; sh:maxCount 1 ;
sh:in ( "decode-equivalence" "entropy-consistency" "none" ) ] ;
sh:property [ sh:path wai:pinSupersedes ; sh:node wai:SupersedesShape ; sh:maxCount 1 ] .
# `supersedes` names a set as a pin names one, by `sha256` and, if it is pinned in a
# declared form, `form`; it has no `id`, `determinism` or `tier`.
wai:SupersedesShape a sh:NodeShape ;
sh:property [ sh:path wai:pinSha256 ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
sh:pattern "^[a-f0-9]{64}$" ] ;
sh:property [ sh:path wai:pinForm ; sh:datatype xsd:string ; sh:maxCount 1 ] .