uor-foundation 0.1.2

UOR Foundation — typed Rust traits for the complete ontology. Import and implement.
Documentation
// @generated by uor-crate from uor-ontology — do not edit manually

//! `conformance/` namespace — SHACL-equivalent constraint shapes defining what a Prism implementation must provide at each extension point. Machine-verifiable contracts..
//!
//! Space: Bridge

use crate::Primitives;

/// A constraint shape that a Prism-declared extension must satisfy. Analogous to sh:NodeShape in SHACL.
pub trait Shape<P: Primitives> {
    /// The OWL class that instances of this shape must belong to.
    fn target_class(&self) -> &P::String;
    /// Associated type for `PropertyConstraint`.
    type PropertyConstraint: PropertyConstraint<P>;
    /// A required property in this shape.
    fn required_property(&self) -> &[Self::PropertyConstraint];
}

/// A single required property within a shape: the property URI, its expected range, minimum and maximum cardinality.
pub trait PropertyConstraint<P: Primitives> {
    /// The property URI that must be present.
    fn constraint_property(&self) -> &P::String;
    /// The expected range of the required property.
    fn constraint_range(&self) -> &P::String;
    /// Minimum cardinality of the required property.
    fn min_count(&self) -> P::NonNegativeInteger;
    /// Maximum cardinality (0 = unbounded).
    fn max_count(&self) -> P::NonNegativeInteger;
}

/// Shape for declaring a new QuantumLevel beyond Q3.
pub trait QuantumLevelShape<P: Primitives>: Shape<P> {}

/// Shape for declaring an ExternalEffect.
pub trait EffectShape<P: Primitives>: Shape<P> {}

/// Shape for declaring a ParallelProduct.
pub trait ParallelShape<P: Primitives>: Shape<P> {}

/// Shape for declaring a ProductiveStream (targets stream:Unfold, the coinductive constructor).
pub trait StreamShape<P: Primitives>: Shape<P> {}

/// Shape for declaring a new DispatchRule in a DispatchTable.
pub trait DispatchShape<P: Primitives>: Shape<P> {}

/// Shape for declaring a Lease with LinearFiber allocation.
pub trait LeaseShape<P: Primitives>: Shape<P> {}

/// Shape for declaring a GroundingMap from surface data to the ring.
pub trait GroundingShape<P: Primitives>: Shape<P> {}

/// The result of validating an extension against a shape: conforms (boolean), and violation details if non-conformant.
pub trait ValidationResult<P: Primitives> {
    /// Associated type for `Shape`.
    type Shape: Shape<P>;
    /// The shape that was validated against.
    fn validation_shape(&self) -> &Self::Shape;
    /// The instance that was validated.
    fn validation_target(&self) -> &P::String;
    /// True iff the target satisfies all constraints of the shape.
    fn conforms(&self) -> P::Boolean;
}

/// Shape for user-declared predicates. Requires a bounded evaluator (termination witness) and input type declaration.
pub trait PredicateShape<P: Primitives>: Shape<P> {}