Struct horned_owl::model::Ontology
source · pub struct Ontology {
pub id: OntologyID,
/* private fields */
}
Expand description
An ontology
An ontology consists of a identifier and set of axiom
Fields
id: OntologyID
Implementations
sourceimpl Ontology
impl Ontology
sourcepub fn ontology_annotation(&self) -> impl Iterator<Item = &OntologyAnnotation>
pub fn ontology_annotation(&self) -> impl Iterator<Item = &OntologyAnnotation>
Return all instances of OntologyAnnotation in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn declare_class(&self) -> impl Iterator<Item = &DeclareClass>
pub fn declare_class(&self) -> impl Iterator<Item = &DeclareClass>
Return all instances of DeclareClass in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn declare_object_property(
&self
) -> impl Iterator<Item = &DeclareObjectProperty>
pub fn declare_object_property(
&self
) -> impl Iterator<Item = &DeclareObjectProperty>
Return all instances of DeclareObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn declare_annotation_property(
&self
) -> impl Iterator<Item = &DeclareAnnotationProperty>
pub fn declare_annotation_property(
&self
) -> impl Iterator<Item = &DeclareAnnotationProperty>
Return all instances of DeclareAnnotationProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn declare_data_property(
&self
) -> impl Iterator<Item = &DeclareDataProperty>
pub fn declare_data_property(
&self
) -> impl Iterator<Item = &DeclareDataProperty>
Return all instances of DeclareDataProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn declare_named_individual(
&self
) -> impl Iterator<Item = &DeclareNamedIndividual>
pub fn declare_named_individual(
&self
) -> impl Iterator<Item = &DeclareNamedIndividual>
Return all instances of DeclareNamedIndividual in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn declare_datatype(&self) -> impl Iterator<Item = &DeclareDatatype>
pub fn declare_datatype(&self) -> impl Iterator<Item = &DeclareDatatype>
Return all instances of DeclareDatatype in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn sub_class(&self) -> impl Iterator<Item = &SubClassOf>
pub fn sub_class(&self) -> impl Iterator<Item = &SubClassOf>
Return all instances of SubClassOf in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn equivalent_class(&self) -> impl Iterator<Item = &EquivalentClasses>
pub fn equivalent_class(&self) -> impl Iterator<Item = &EquivalentClasses>
Return all instances of EquivalentClasses in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn disjoint_class(&self) -> impl Iterator<Item = &DisjointClasses>
pub fn disjoint_class(&self) -> impl Iterator<Item = &DisjointClasses>
Return all instances of DisjointClasses in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn sub_object_property(&self) -> impl Iterator<Item = &SubObjectPropertyOf>
pub fn sub_object_property(&self) -> impl Iterator<Item = &SubObjectPropertyOf>
Return all instances of SubObjectPropertyOf in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn equivalent_object_properties(
&self
) -> impl Iterator<Item = &EquivalentObjectProperties>
pub fn equivalent_object_properties(
&self
) -> impl Iterator<Item = &EquivalentObjectProperties>
Return all instances of EquivalentObjectProperties in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn disjoint_object_properties(
&self
) -> impl Iterator<Item = &DisjointObjectProperties>
pub fn disjoint_object_properties(
&self
) -> impl Iterator<Item = &DisjointObjectProperties>
Return all instances of DisjointObjectProperties in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn inverse_object_properties(
&self
) -> impl Iterator<Item = &InverseObjectProperties>
pub fn inverse_object_properties(
&self
) -> impl Iterator<Item = &InverseObjectProperties>
Return all instances of InverseObjectProperties in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn object_property_domain(
&self
) -> impl Iterator<Item = &ObjectPropertyDomain>
pub fn object_property_domain(
&self
) -> impl Iterator<Item = &ObjectPropertyDomain>
Return all instances of ObjectPropertyDomain in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn object_property_range(
&self
) -> impl Iterator<Item = &ObjectPropertyRange>
pub fn object_property_range(
&self
) -> impl Iterator<Item = &ObjectPropertyRange>
Return all instances of ObjectPropertyRange in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn functional_object_property(
&self
) -> impl Iterator<Item = &FunctionalObjectProperty>
pub fn functional_object_property(
&self
) -> impl Iterator<Item = &FunctionalObjectProperty>
Return all instances of FunctionalObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn inverse_functional_object_property(
&self
) -> impl Iterator<Item = &InverseFunctionalObjectProperty>
pub fn inverse_functional_object_property(
&self
) -> impl Iterator<Item = &InverseFunctionalObjectProperty>
Return all instances of InverseFunctionalObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn reflexive_object_property(
&self
) -> impl Iterator<Item = &ReflexiveObjectProperty>
pub fn reflexive_object_property(
&self
) -> impl Iterator<Item = &ReflexiveObjectProperty>
Return all instances of ReflexiveObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn irreflexive_object_property(
&self
) -> impl Iterator<Item = &IrreflexiveObjectProperty>
pub fn irreflexive_object_property(
&self
) -> impl Iterator<Item = &IrreflexiveObjectProperty>
Return all instances of IrreflexiveObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn symmetric_object_property(
&self
) -> impl Iterator<Item = &SymmetricObjectProperty>
pub fn symmetric_object_property(
&self
) -> impl Iterator<Item = &SymmetricObjectProperty>
Return all instances of SymmetricObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn assymmetric_object_property(
&self
) -> impl Iterator<Item = &AsymmetricObjectProperty>
pub fn assymmetric_object_property(
&self
) -> impl Iterator<Item = &AsymmetricObjectProperty>
Return all instances of AsymmetricObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn transitive_object_property(
&self
) -> impl Iterator<Item = &TransitiveObjectProperty>
pub fn transitive_object_property(
&self
) -> impl Iterator<Item = &TransitiveObjectProperty>
Return all instances of TransitiveObjectProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn sub_data_property_of(&self) -> impl Iterator<Item = &SubDataPropertyOf>
pub fn sub_data_property_of(&self) -> impl Iterator<Item = &SubDataPropertyOf>
Return all instances of SubDataPropertyOf in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn equivalent_data_properties(
&self
) -> impl Iterator<Item = &EquivalentDataProperties>
pub fn equivalent_data_properties(
&self
) -> impl Iterator<Item = &EquivalentDataProperties>
Return all instances of EquivalentDataProperties in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn disjoint_data_properties(
&self
) -> impl Iterator<Item = &DisjointDataProperties>
pub fn disjoint_data_properties(
&self
) -> impl Iterator<Item = &DisjointDataProperties>
Return all instances of DisjointDataProperties in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn data_property_domain(&self) -> impl Iterator<Item = &DataPropertyDomain>
pub fn data_property_domain(&self) -> impl Iterator<Item = &DataPropertyDomain>
Return all instances of DataPropertyDomain in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn data_property_range(&self) -> impl Iterator<Item = &DataPropertyRange>
pub fn data_property_range(&self) -> impl Iterator<Item = &DataPropertyRange>
Return all instances of DataPropertyRange in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn functional_data_property(
&self
) -> impl Iterator<Item = &FunctionalDataProperty>
pub fn functional_data_property(
&self
) -> impl Iterator<Item = &FunctionalDataProperty>
Return all instances of FunctionalDataProperty in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn datatype_definition(&self) -> impl Iterator<Item = &DatatypeDefinition>
pub fn datatype_definition(&self) -> impl Iterator<Item = &DatatypeDefinition>
Return all instances of DatatypeDefinition in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn same_individual(&self) -> impl Iterator<Item = &SameIndividual>
pub fn same_individual(&self) -> impl Iterator<Item = &SameIndividual>
Return all instances of SameIndividual in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn different_individuals(
&self
) -> impl Iterator<Item = &DifferentIndividuals>
pub fn different_individuals(
&self
) -> impl Iterator<Item = &DifferentIndividuals>
Return all instances of DifferentIndividuals in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn class_assertion(&self) -> impl Iterator<Item = &ClassAssertion>
pub fn class_assertion(&self) -> impl Iterator<Item = &ClassAssertion>
Return all instances of ClassAssertion in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn object_property_assertion(
&self
) -> impl Iterator<Item = &ObjectPropertyAssertion>
pub fn object_property_assertion(
&self
) -> impl Iterator<Item = &ObjectPropertyAssertion>
Return all instances of ObjectPropertyAssertion in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn negative_object_property_assertion(
&self
) -> impl Iterator<Item = &NegativeObjectPropertyAssertion>
pub fn negative_object_property_assertion(
&self
) -> impl Iterator<Item = &NegativeObjectPropertyAssertion>
Return all instances of NegativeObjectPropertyAssertion in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn data_property_assertion(
&self
) -> impl Iterator<Item = &DataPropertyAssertion>
pub fn data_property_assertion(
&self
) -> impl Iterator<Item = &DataPropertyAssertion>
Return all instances of DataPropertyAssertion in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn negative_data_property_assertion(
&self
) -> impl Iterator<Item = &NegativeDataPropertyAssertion>
pub fn negative_data_property_assertion(
&self
) -> impl Iterator<Item = &NegativeDataPropertyAssertion>
Return all instances of NegativeDataPropertyAssertion in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn annotation_assertion(&self) -> impl Iterator<Item = &AnnotationAssertion>
pub fn annotation_assertion(&self) -> impl Iterator<Item = &AnnotationAssertion>
Return all instances of AnnotationAssertion in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn sub_annotation_property_of(
&self
) -> impl Iterator<Item = &SubAnnotationPropertyOf>
pub fn sub_annotation_property_of(
&self
) -> impl Iterator<Item = &SubAnnotationPropertyOf>
Return all instances of SubAnnotationPropertyOf in the ontology.
sourceimpl Ontology
impl Ontology
sourcepub fn new() -> Ontology
pub fn new() -> Ontology
Create a new ontology.
Examples
let o = Ontology::new();
let o2 = Ontology::new();
assert_eq!(o, o2);
sourcepub fn insert<A>(&mut self, ax: A) -> boolwhere
A: Into<AnnotatedAxiom>,
pub fn insert<A>(&mut self, ax: A) -> boolwhere
A: Into<AnnotatedAxiom>,
Insert an axiom into the ontology.
Examples
let mut o = Ontology::new();
let b = Build::new();
o.insert(DeclareClass(b.class("http://www.example.com/a")));
o.insert(DeclareObjectProperty(b.object_property("http://www.example.com/r")));
See declare
for an easier way to declare named entities.
sourcepub fn declare<N>(&mut self, ne: N) -> boolwhere
N: Into<NamedEntity>,
pub fn declare<N>(&mut self, ne: N) -> boolwhere
N: Into<NamedEntity>,
Declare an NamedEntity for the ontology.
Examples
let mut o = Ontology::new();
let b = Build::new();
o.declare(b.class("http://www.example.com/a"));
o.declare(b.object_property("http://www.example.com/r"));
sourcepub fn annotated_axiom(
&self,
axk: AxiomKind
) -> impl Iterator<Item = &AnnotatedAxiom>
pub fn annotated_axiom(
&self,
axk: AxiomKind
) -> impl Iterator<Item = &AnnotatedAxiom>
Fetch the AnnotatedAxiom for a given kind
Examples
let mut o = Ontology::new();
let b = Build::new();
o.declare(b.class("http://www.example.com/a"));
o.declare(b.object_property("http://www.example.com/r"));
assert_eq!(o.annotated_axiom(AxiomKind::DeclareClass).count(), 1);
See also axiom
for access to the Axiom
without annotations.
sourcepub fn axiom(&self, axk: AxiomKind) -> impl Iterator<Item = &Axiom>
pub fn axiom(&self, axk: AxiomKind) -> impl Iterator<Item = &Axiom>
Fetch the Axiom for a given kind
Examples
let mut o = Ontology::new();
let b = Build::new();
o.declare(b.class("http://www.example.com/a"));
o.declare(b.object_property("http://www.example.com/r"));
assert_eq!(o.axiom(AxiomKind::DeclareClass).count(), 1);
See methods such as declare_class
for access to the Axiom
struct directly.
sourceimpl Ontology
impl Ontology
sourcepub fn direct_subclass<C>(&self, c: C) -> impl Iterator<Item = &ClassExpression>where
C: Into<ClassExpression>,
pub fn direct_subclass<C>(&self, c: C) -> impl Iterator<Item = &ClassExpression>where
C: Into<ClassExpression>,
Returns all direct subclasses
Examples
let mut o = Ontology::new();
let b = Build::new();
let sup = b.class("http://www.example.com/super");
let sub = b.class("http://www.example.com/sub");
let subsub = b.class("http://www.example.com/subsub");
o.insert(SubClassOf::new((&sup).into(), (&sub).into()));
o.insert(SubClassOf::new((&sub).into(), (&subsub).into()));
let subs:Vec<&ClassExpression> = o.direct_subclass(&sup).collect();
assert_eq!(vec![&ClassExpression::Class(sub)],subs);
sourcepub fn is_subclass<C>(&self, super_class: C, sub_class: C) -> boolwhere
C: Into<ClassExpression>,
pub fn is_subclass<C>(&self, super_class: C, sub_class: C) -> boolwhere
C: Into<ClassExpression>,
Returns true is subclass
is a subclass of superclass
Examples
let mut o = Ontology::new();
let b = Build::new();
let sup = b.class("http://www.example.com/super");
let sub = b.class("http://www.example.com/sub");
let subsub = b.class("http://www.example.com/subsub");
o.insert(SubClassOf::new((&sup).into(), (&sub).into()));
o.insert(SubClassOf::new((&sub).into(), (&subsub).into()));
assert!(o.is_subclass(&sup, &sub));
assert!(!o.is_subclass(&sub, &sup));
assert!(!o.is_subclass(&sup, &subsub));