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
53
54
55
56
57
58
59
60
//! Checked construction for class axiom families.
use crate::{Axiom, AxiomAnnotations, ClassExpression, Entity, OperandSet, StructuralModelError};
use iri_rfc3987::Iri;
impl<L, B> Axiom<L, B> {
/// Construct `Declaration` without axiom annotations.
#[must_use]
pub fn declaration(entity: Entity) -> Self {
Self::Declaration {
entity,
annotations: AxiomAnnotations::empty(),
}
}
/// Construct `SubClassOf` without axiom annotations.
#[must_use]
pub fn sub_class_of(
sub_class: ClassExpression<L, B>,
super_class: ClassExpression<L, B>,
) -> Self {
Self::SubClassOf {
sub_class,
super_class,
annotations: AxiomAnnotations::empty(),
}
}
/// Construct `EquivalentClasses` without axiom annotations.
/// # Errors
/// Rejects fewer than the structural minimum number of source occurrences.
pub fn equivalent_classes(
classes: Vec<ClassExpression<L, B>>,
) -> Result<Self, StructuralModelError> {
Ok(Self::EquivalentClasses {
classes: OperandSet::try_new(classes)?,
annotations: AxiomAnnotations::empty(),
})
}
/// Construct `DisjointClasses` without axiom annotations.
/// # Errors
/// Rejects fewer than the structural minimum number of source occurrences.
pub fn disjoint_classes(
classes: Vec<ClassExpression<L, B>>,
) -> Result<Self, StructuralModelError> {
Ok(Self::DisjointClasses {
classes: OperandSet::try_new(classes)?,
annotations: AxiomAnnotations::empty(),
})
}
/// Construct `DisjointUnion` without axiom annotations.
/// # Errors
/// Rejects fewer than the structural minimum number of source occurrences.
pub fn disjoint_union(
class: Iri<String>,
classes: Vec<ClassExpression<L, B>>,
) -> Result<Self, StructuralModelError> {
Ok(Self::DisjointUnion {
class,
classes: OperandSet::try_new(classes)?,
annotations: AxiomAnnotations::empty(),
})
}
}