uor-foundation 0.3.0

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

//! `query/` namespace — Information extraction queries. Users initiate queries; the kernel resolves them against the ring substrate..
//!
//! Space: Bridge

use crate::enums::TriadProjection;
use crate::HostTypes;

/// A request for information from the UOR kernel. The root abstraction for all query types.
pub trait Query<H: HostTypes> {
    /// The type of input the query accepts.
    fn input_type(&self) -> &H::HostString;
    /// The type of output the query produces.
    fn output_type(&self) -> &H::HostString;
}

/// A query for the ring-coordinate position of a datum: its stratum, spectrum, and address within the ring geometry.
pub trait CoordinateQuery<H: HostTypes>: Query<H> {
    /// The typed coordinate kind this query extracts. Replaces the string-valued query:coordinate property with a typed reference to a TriadProjection individual.
    fn has_triad_projection(&self) -> TriadProjection;
}

/// A query for a metric value between two datums: ring distance, Hamming distance, or their divergence (curvature).
pub trait MetricQuery<H: HostTypes>: Query<H> {}

/// A query for the canonical representation of a datum or term: its normal form under the active resolver strategy.
pub trait RepresentationQuery<H: HostTypes>: Query<H> {}

/// A Query with a known source address, a typed relation constraint, and an open target partition:FreeRank. Represents any question of the form: given this source symbol and relation type, what is the target? The relation type is read from the observable coordinate triple (d_R, d_H, d_I) — not externally supplied. Applies across NLP, ARC-AGI grids, music, images, sensor streams, and logical formulae.
pub trait RelationQuery<H: HostTypes>: Query<H> {
    /// Associated type for `Element`.
    type Element: crate::kernel::address::Element<H>;
    /// The ring address of the grounded source symbol.
    fn source_address(&self) -> &Self::Element;
    /// Associated type for `Constraint`.
    type Constraint: crate::user::type_::Constraint<H>;
    /// The transformation type, expressed as a type:Conjunction composed from the primitive BoundConstraint basis. At inference time this is the output of an observable coordinate read on example pairs — computed from (d_R, d_H, d_I). Not an externally supplied input; read from the representation space.
    fn relation_type(&self) -> &Self::Constraint;
    /// Associated type for `FreeRank`.
    type FreeRank: crate::bridge::partition::FreeRank<H>;
    /// The open site budget for the unknown target. Begins fully free; closes to isClosed = true upon resolution.
    fn target_site(&self) -> &Self::FreeRank;
    /// Associated type for `GroundingMap`.
    type GroundingMap: crate::user::morphism::GroundingMap<H>;
    /// The GroundingMap that resolved the source symbol to its ring address.
    fn grounding_map(&self) -> &Self::GroundingMap;
    /// Associated type for `ProjectionMap`.
    type ProjectionMap: crate::user::morphism::ProjectionMap<H>;
    /// The ProjectionMap that will render the resolved address neighbourhood back to surface symbols.
    fn projection_map(&self) -> &Self::ProjectionMap;
    /// Associated type for `Context`.
    type Context: crate::user::state::Context<H>;
    /// Accumulated session state carrying all state:Binding instances produced by prior queries. Each binding records a resolved address, its datum, and the type under which it was resolved. Prior bindings monotonically reduce the free site space for subsequent queries.
    fn session_context(&self) -> &Self::Context;
}

/// A RelationQuery that explicitly declares its session membership, allowing the conformance suite to validate session-scoped site reduction across multi-turn Prism deployments.
pub trait SessionQuery<H: HostTypes>: RelationQuery<H> {
    /// Associated type for `Session`.
    type Session: crate::user::state::Session<H>;
    /// The session this query belongs to.
    fn session_membership(&self) -> &Self::Session;
}

/// The stratum coordinate: the layer position of a datum within the ring's stratification.
pub mod two_adic_valuation {}

/// The spectrum coordinate: the spectral decomposition of a datum under the ring's Fourier analysis.
pub mod walsh_hadamard_image {}

/// The address coordinate: the content-addressable position of a datum in the Braille glyph encoding. Renamed from RingElement in v0.2.2 W8 to unify vocabulary with the schema:Triad bundling properties.
pub mod address {}