Skip to main content

inference_engine/reasoning/context/
mod.rs

1//! Source preparation followed by isolated target-relative context.
2mod engine;
3mod error;
4use super::{
5    LiteralTypingLimits, OccurrenceLimits, Rdfs12SourceConfig, Rdfs12SourceReport, RunLimits,
6    RunReport,
7};
8pub use engine::Rdfs12Context;
9pub use error::Rdfs12ContextError;
10use serde::{Deserialize, Serialize};
11use std::num::{NonZeroU32, NonZeroU64};
12
13/// Explicit resource limits for one immutable target-context augmentation.
14/// Backend attempt-wide scratch, dictionary, metadata and I/O limits also apply.
15#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
16#[serde(deny_unknown_fields)]
17pub struct Rdfs12TargetConfig {
18    /// Cumulative novel target-vocabulary container axioms.
19    pub axioms: NonZeroU64,
20    /// Depth, appearances and work per traversal of the original target.
21    pub traversal: OccurrenceLimits,
22    /// Target literal occurrence, novel output and streamed lexical-byte caps.
23    pub literals: LiteralTypingLimits,
24    /// Core fixpoint limits and the target occurrence phase's novel-output cap.
25    pub structural: RunLimits,
26    /// Maximum owned metadata bytes for one container descriptor.
27    pub iri_bytes: NonZeroU32,
28}
29
30/// Separate explicit source and target-context resource configurations.
31#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
32#[serde(deny_unknown_fields)]
33pub struct Rdfs12ContextConfig {
34    /// Source-only preparation and diagnostic budgets.
35    pub source: Rdfs12SourceConfig,
36    /// Original-target augmentation and subsequent core budgets.
37    pub target: Rdfs12TargetConfig,
38}
39
40/// Completed target-context phase counters, never an entailment verdict.
41#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
42#[serde(deny_unknown_fields)]
43pub struct Rdfs12TargetReport {
44    /// Novel container-vocabulary axioms from actual recursive target appearances.
45    pub seeded: u64,
46    /// Novel facts from all target-context phases, including core consequences.
47    pub inferred: u64,
48    /// Original target term appearances inspected for resource typing.
49    pub occurrences: u64,
50    /// Original target triple-term appearances awaiting validated construction.
51    /// Their resource denotation has not been assumed from target occurrence.
52    pub deferred_triple_terms: u64,
53    /// Original target literal appearances inspected, including duplicates.
54    pub literals: u64,
55    /// Exact streamed lexical bytes across those literal appearances.
56    pub lexical_bytes: u64,
57    /// Completed shared core fixpoint after the original-target phases.
58    pub core: RunReport,
59}
60
61/// Source/context preparation result; no negative or full-consistency decision.
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
63#[serde(deny_unknown_fields)]
64pub enum Rdfs12ContextOutcome {
65    /// Source phases and original-target augmentation completed.
66    /// Goal-relevant construction and the full entailment procedure remain separate.
67    Prepared {
68        /// Completed source-only work and supported diagnostic count.
69        source: Rdfs12SourceReport,
70        /// Completed target-context work, separate from source diagnostics.
71        target: Rdfs12TargetReport,
72    },
73    /// Supported source conflicts were retained before reading any target rows.
74    /// Do not promote scratch or interpret this as an entailment verdict.
75    SourceConflicting(Rdfs12SourceReport),
76}