pub enum Constraint {
Show 19 variants
MinCount(u32),
MaxCount(u32),
Datatype(&'static str),
NodeKind(NodeKind),
Class(&'static [&'static str]),
In(&'static [&'static str]),
HasValue(&'static str),
MaxLength(u32),
MinLength(u32),
RefClass(&'static [&'static str]),
MinInclusive(f64),
MaxInclusive(f64),
MinExclusive(f64),
MaxExclusive(f64),
LessThan(&'static str),
LessThanOrEquals(&'static str),
NotClass(&'static [&'static str]),
QualifiedIn {
allowed: &'static [&'static str],
min: u32,
},
Length(u32),
}Expand description
A single check on the values a Path yields.
Variants§
MinCount(u32)
MaxCount(u32)
Datatype(&'static str)
The xsd type’s local name ("integer", "dateTime", …). A bag holds
strings, so this is a real parse check rather than the tautology it was
against a typed struct.
NodeKind(NodeKind)
Class(&'static [&'static str])
sh:class — the referenced element must be an instance of this
family-qualified class, or a descendant of it. Already expanded, so the
check is a set membership.
In(&'static [&'static str])
sh:in — the value must be one of these. Enum IRIs are stored as the
decoder stores them: fragment only.
HasValue(&'static str)
sh:hasValue, and sh:in with exactly one member after
simplification.
MaxLength(u32)
MinLength(u32)
RefClass(&'static [&'static str])
The referenced element’s class must be one of these family-qualified
names. Produced by sh:in on a path ending in rdf:type.
Only checked when the referenced element is present. Phase-1 validation runs per file, so a reference out of the current file is normal and is a different rule’s business — reporting it here would make every cross-file association a value-type violation.
MinInclusive(f64)
sh:minInclusive and friends. Compared as f64; a value that does not
parse as a number is skipped, the way a typed numeric field that failed
to parse is None — malformed numbers are sh:datatype’s business.
MaxInclusive(f64)
MinExclusive(f64)
MaxExclusive(f64)
LessThan(&'static str)
sh:lessThan — this property’s value must be below the named field’s
on the same element. Only checked when both are present and numeric.
LessThanOrEquals(&'static str)
NotClass(&'static [&'static str])
sh:not [ sh:class X ] — the referenced element must not be an
instance of these family-qualified classes. Silent when the referenced
element is absent, like Constraint::Class.
QualifiedIn
sh:qualifiedValueShape [ sh:in (..) ] with sh:qualifiedMinCount —
at least min values must be among allowed. NCP uses it to ask
whether a dataset declares conformance to one of a set of profiles.
Length(u32)
sh:length — exactly this many characters, e.g. the 16 of an EIC code.