1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Consistency check outcomes for production embedders.
use serde::Serialize;
/// Result of an ontology consistency check.
///
/// When [`complete`](Self::complete) is `false`, [`consistent`](Self::consistent) must not be
/// used as a proof — the reasoner hit a budget or resource limit before finishing.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
pub struct ConsistencyResult {
/// Whether the ontology is consistent (only meaningful when [`complete`](Self::complete)).
pub consistent: bool,
/// Whether the check ran to completion without budget or tableau limits.
pub complete: bool,
}
impl ConsistencyResult {
/// Proved consistent.
#[must_use]
pub const fn consistent() -> Self {
Self {
consistent: true,
complete: true,
}
}
/// Proved inconsistent.
#[must_use]
pub const fn inconsistent() -> Self {
Self {
consistent: false,
complete: true,
}
}
/// Check did not finish; do not treat as consistent or inconsistent.
#[must_use]
pub const fn incomplete() -> Self {
Self {
consistent: false,
complete: false,
}
}
/// Legacy bool API: error if incomplete.
pub fn into_bool(self) -> crate::Result<bool> {
if !self.complete {
return Err(crate::Error::IncompleteConsistency);
}
Ok(self.consistent)
}
}