Skip to main content

owl_structural_model/
property_schema.rs

1//! Checked construction for property schema families.
2use crate::{
3    Axiom, AxiomAnnotations, ClassExpression, ObjectPropertyExpression, OperandSet,
4    StructuralModelError, UnorderedPair,
5};
6impl<L, B> Axiom<L, B> {
7    /// Construct `EquivalentObjectProperties` without axiom annotations.
8    /// # Errors
9    /// Rejects fewer than the structural minimum number of source occurrences.
10    pub fn equivalent_object_properties(
11        properties: Vec<ObjectPropertyExpression>,
12    ) -> Result<Self, StructuralModelError> {
13        Ok(Self::EquivalentObjectProperties {
14            properties: OperandSet::try_new(properties)?,
15            annotations: AxiomAnnotations::empty(),
16        })
17    }
18    /// Construct `DisjointObjectProperties` without axiom annotations.
19    /// # Errors
20    /// Rejects fewer than the structural minimum number of source occurrences.
21    pub fn disjoint_object_properties(
22        properties: Vec<ObjectPropertyExpression>,
23    ) -> Result<Self, StructuralModelError> {
24        Ok(Self::DisjointObjectProperties {
25            properties: OperandSet::try_new(properties)?,
26            annotations: AxiomAnnotations::empty(),
27        })
28    }
29    /// Construct `InverseObjectProperties` without axiom annotations.
30    #[must_use]
31    pub fn inverse_object_properties(
32        first: ObjectPropertyExpression,
33        second: ObjectPropertyExpression,
34    ) -> Self {
35        Self::InverseObjectProperties {
36            properties: UnorderedPair::new(first, second),
37            annotations: AxiomAnnotations::empty(),
38        }
39    }
40    /// Construct `ObjectPropertyDomain` without axiom annotations.
41    #[must_use]
42    pub fn object_property_domain(
43        property: ObjectPropertyExpression,
44        domain: ClassExpression<L, B>,
45    ) -> Self {
46        Self::ObjectPropertyDomain {
47            property,
48            domain,
49            annotations: AxiomAnnotations::empty(),
50        }
51    }
52    /// Construct `ObjectPropertyRange` without axiom annotations.
53    #[must_use]
54    pub fn object_property_range(
55        property: ObjectPropertyExpression,
56        range: ClassExpression<L, B>,
57    ) -> Self {
58        Self::ObjectPropertyRange {
59            property,
60            range,
61            annotations: AxiomAnnotations::empty(),
62        }
63    }
64}