Skip to main content

ontologos_core/engine/
mod.rs

1//! Profile engine routing types (DIP boundary — no engine implementations).
2
3/// Dispatch key for a profile-specific reasoning engine.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum EngineKind {
6    /// OWL EL completion-based classification.
7    El,
8    /// RDFS materialization via reasonable.
9    Rdfs,
10    /// OWL RL forward-chaining saturation.
11    Rl,
12    /// OWL ALC tableau-lite classification.
13    Alc,
14    /// OWL 2 DL coupled saturation + tableau.
15    Dl,
16    /// DLSafe SWRL with DL classification.
17    Swrl,
18    /// Auto-detected hybrid ontology (multiple profile modules).
19    Hybrid,
20}
21
22/// OWL 2 profile detected during Auto routing (mirrors `ontologos_profile::OwlProfile`).
23#[derive(Debug, Clone, Copy, PartialEq, Eq)]
24pub enum DetectedProfileKind {
25    /// OWL 2 EL.
26    El,
27    /// OWL 2 RL.
28    Rl,
29    /// OWL 2 QL.
30    Ql,
31    /// OWL 2 DL.
32    Dl,
33}
34
35/// Result of profile → engine resolution.
36#[derive(Debug, Clone, Copy, PartialEq, Eq)]
37pub struct ResolvedRoute {
38    /// Engine to dispatch to.
39    pub kind: EngineKind,
40    /// Profile detected during Auto resolution, if applicable.
41    pub detected: Option<DetectedProfileKind>,
42}
43
44impl ResolvedRoute {
45    /// Build a route for an explicit profile selection.
46    #[must_use]
47    pub fn explicit(kind: EngineKind) -> Self {
48        Self {
49            kind,
50            detected: None,
51        }
52    }
53
54    /// Build a route from Auto detection.
55    #[must_use]
56    pub fn auto(kind: EngineKind, detected: DetectedProfileKind) -> Self {
57        Self {
58            kind,
59            detected: Some(detected),
60        }
61    }
62}
63
64/// Whether class/property assertion entailment should use the DL tableau path.
65#[must_use]
66pub const fn uses_dl_entailment(kind: EngineKind) -> bool {
67    matches!(
68        kind,
69        EngineKind::Alc | EngineKind::Dl | EngineKind::Swrl | EngineKind::Hybrid
70    )
71}