Module horned_owl::model

source ·
Expand description

This module implements the basic data data structure for OWL2.

Overview

This module consists of a core data model, most of which are concrete implementations.

An Ontology is represented with an interface similar to a HashSet but using a trait. No methods are provided to search or access the contents of an Ontology which are instead provided by implementations. Each Ontology is a set of AnnotatedAxiom instances, which consists of an Axiom and a set of Annotation. The Axiom itself is a large enum representing the different axioms that OWL2 supports. Efficiency is gained from the use of an IRI which is a newtype over an Rc<String>.

Naming

The OWL specification is large and complicated. This library, therefore, takes efforts to be as regular and predictable as possible. Names have been chosen to reflect the OWL structural specification, (see https://www.w3.org/TR/owl2-syntax/).

The core data structures use both C-style structs and tuples structs. The aim is for this to maximize usability. The rules are as follows:

  1. Use tuples where all the entities are of the same type and semantically equivalent
  2. Use structs where entities are not equivalent.
  3. Where values are equivalent and bounded in number to two, use a tuple with two values.
  4. Where values are equivalent, but unbounded, use a Vec, either as part of a tuple or struct.
  5. Where structs are used, variables names should be short, identify the type is unique, or be descriptive if not.

Example

  • Rule 1:
// TransitiveObjectProperty(ObjectProperty)
let b = Build::new_rc();
let top = TransitiveObjectProperty(ObjectPropertyExpression::ObjectProperty
                         (b.object_property("http://www.example.com/op")));
  • Rule 2:
// ObjectSomeValuesFrom{ope:PropertyExpression, ce:ClassExpression}
let b = Build::new_rc();
let some = ClassExpression::ObjectSomeValuesFrom{
                ope: b.object_property("http://www.example.com/p").into(),
                bce: b.class("http://www.example.com/c").into()
};
  • Rule 3:
// InverseObjectProperty(ObjectProperty, ObjectProperty)
let b = Build::new_rc();
let iop = InverseObjectProperties
            (b.object_property("http://www.example.com/op1"),
             b.object_property("http://www.example.com/op2"));
  • Rule 4:
// EquivalentClasses(Vec<ClassExpression>)
let b = Build::new_rc();
let ec = EquivalentClasses
          (vec!(b.class("http://www.example.com/op1").into(),
                b.class("http://www.example.com/op2").into()));
  • Rule 5:
//ObjectPropertyAssertion {
//ope: ObjectPropertyExpression,
//from: Individual,
//to: Individual,
//}
let b = Build::new_rc();
let opa = ObjectPropertyAssertion {
    ope: b.object_property("http://www.example.com/op").into(),
    from: b.named_individual("http://www.example.com/i1").into(),
    to: b.named_individual("http://www.example.com/i2").into(),
};

Structs

An AnnotatedAxiom is an Axiom with one orpmore Annotation.
Data associated with a part of the ontology.
An annotation assertion axiom
An OWL AnnotationProperty is a relationship between a part of an ontology and an Annotation.
Assert the domain of an AnnotationProperty
Assert the range of an AnnotationProperty
The asymmetric characteristic.
Build creates new IRI and NamedEntity instances.
An OWL Class is a group of individuals.
A class assertion expression.
An OWL DataProperty is a relationship between part of an ontology and some concrete information.
A data property assertion.
The domain of a DataProperty.
The range of a DataProperty.
An OWL Datatype is a specific kind of data, such as an integer, string or so forth.
Defintion of a datatype.
Declares that an IRI represents an AnnotationProperty in the Ontology.
Declares that an IRI represents a Class in the Ontology
Declares that an IRI represents a DataProperty in the ontology.
Declare that an IRI represents a Datatype in the ontology.
Declare that an IRI represents a NamedIndividual in the ontology.
Declares that an IRI represents an ObjectProperty in the Ontology.
A different individuals expression.
A disjoint relationship between two ClassExpression
A disjoint data property relationship.
A disjoint object property relationship.
A disjoint union expression between one ClassExpression and a set of others.
An equivalance relationship between two ClassExpression.
An equivalent data property relationship.
An equivalent object properties relationship.
The functional DataProperty characteristic.
The functional characteristic.
A key
An IRI is an internationalized version of an URI/URL.
Declares that an IRI is an import of this ontology
The inverse functional characteristic
An inverse relationship between two object properties.
The irreflexive characteristic
An OWL NamedIndividual is an individual in the ontology which is specifically known about and can be identified by name.
A negative data property assertion.
A negative object property assertion.
An OWL ObjectProperty is a relationship between two individuals.
An object property assertion.
The domain of the object property.
The range of the object property.
An annotation associated with this Ontology
An ontology identifier
The reflexive characteristic
A same individual expression.
An sub-property assertion for annotation properties.
A subclass relationship between two ClassExpression.
A sub data property relationship.
A sub property relationship between two object properties.
The symmetric characteristic
A transitive relationship between two object properties.

Enums

The value of an annotation
An axiom
Contains all different kinds of axiom
A class expression
An OWL entity that is directly resolvable to an IRI
A object property expression
A property expression
A sub-object property expression

Traits

An interface providing access to the AxiomKind
Add or remove axioms to an MutableOntology
Access or change the OntologyID of an Ontology

Type Definitions