Skip to main content

snomed_classify/
skipped.rs

1//! Constructs `classify` recognizes but doesn't model, per
2//! `spec/13-classification.md`'s "Scope" section. Every occurrence is
3//! reported, never silently dropped without a trace.
4
5use std::fmt;
6
7use snomed_core::sctid::SctId;
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum SkippedConstruct {
11    /// A `ReflexiveObjectProperty` axiom — reflexivity isn't modeled.
12    ReflexiveProperty(SctId),
13    /// A `SubDataPropertyOf` axiom — data (concrete-value) property
14    /// hierarchy isn't modeled.
15    DataProperty(SctId),
16    /// A `DataHasValue` conjunct on `attribute`, dropped from whatever
17    /// intersection or existential filler it appeared in.
18    ConcreteValue { attribute: SctId },
19    /// A stated axiom shape `necessary_normal_form` couldn't turn into a
20    /// `(type, value)` attribute pair — e.g. a role group or ungrouped
21    /// existential whose filler isn't a plain concept (spec/14). `concept`
22    /// is the named subject whose stated profile the shape appeared in.
23    UnmodeledAttributeShape { concept: SctId },
24}
25
26impl fmt::Display for SkippedConstruct {
27    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28        match self {
29            SkippedConstruct::ReflexiveProperty(id) => {
30                write!(f, "ReflexiveObjectProperty(:{id}) is not modeled")
31            }
32            SkippedConstruct::DataProperty(id) => {
33                write!(f, "SubDataPropertyOf involving :{id} is not modeled")
34            }
35            SkippedConstruct::ConcreteValue { attribute } => {
36                write!(
37                    f,
38                    "DataHasValue on attribute :{attribute} was dropped (concrete values aren't classified)"
39                )
40            }
41            SkippedConstruct::UnmodeledAttributeShape { concept } => {
42                write!(
43                    f,
44                    "a stated attribute of :{concept} has an unmodeled shape (not a plain concept filler) and was dropped from its necessary normal form"
45                )
46            }
47        }
48    }
49}