[][src]Module horned_owl::model

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();
let top = TransitiveObjectProperty(ObjectPropertyExpression::ObjectProperty
                         (b.object_property("http://www.example.com/op")));
  • Rule 2:
// ObjectSomeValuesFrom{ope:PropertyExpression, ce:ClassExpression}
let b = Build::new();
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();
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();
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: NamedIndividual,
//to: NamedIndividual,
//}
let b = Build::new();
let opa = ObjectPropertyAssertion {
    ope: b.object_property("http://www.example.com/op").into(),
    from: b.named_individual("http://www.example.com/i1"),
    to: b.named_individual("http://www.example.com/i2"),
};

Structs

AnnotatedAxiom

An AnnotatedAxiom is an Axiom with one orpmore Annotation.

Annotation

Data associated with a part of the ontology.

AnnotationAssertion

An annotation assertion axiom

AnnotationProperty

An OWL AnnotationProperty is a relationship between a part of an ontology and an Annotation.

AnnotationPropertyDomain

Assert the domain of an AnnotationProperty

AnnotationPropertyRange

Assert the range of an AnnotationProperty

AsymmetricObjectProperty

The asymmetric characteristic.

Build

Build creates new IRI and NamedEntity instances.

Class

An OWL Class is a group of individuals.

ClassAssertion

A class assertion expression.

DataProperty

An OWL DataProperty is a relationship between part of an ontology and some concrete information.

DataPropertyAssertion

A data property assertion.

DataPropertyDomain

The domain of a DataProperty.

DataPropertyRange

The range of a DataProperty.

Datatype

An OWL Datatype is a specific kind of data, such as an integer, string or so forth.

DatatypeDefinition

Defintion of a datatype.

DeclareAnnotationProperty

Declares that an IRI represents an AnnotationProperty in the Ontology.

DeclareClass

Declares that an IRI represents a Class in the Ontology

DeclareDataProperty

Declares that an IRI represents a DataProperty in the ontology.

DeclareDatatype

Declare that an IRI represents a Datatype in the ontology.

DeclareNamedIndividual

Declare that an IRI represents a NamedIndividual in the ontology.

DeclareObjectProperty

Declares that an IRI represents an ObjectProperty in the Ontology.

DifferentIndividuals

A different individuals expression.

DisjointClasses

A disjoint relationship between two ClassExpression

DisjointDataProperties

A disjoint data property relationship.

DisjointObjectProperties

A disjoint object property relationship.

DisjointUnion

A disjoint union expression between one ClassExpression and a set of others.

EquivalentClasses

An equivalance relationship between two ClassExpression.

EquivalentDataProperties

An equivalent data property relationship.

EquivalentObjectProperties

An equivalent object properties relationship.

FacetRestriction
FunctionalDataProperty

The functional DataProperty characteristic.

FunctionalObjectProperty

The functional characteristic.

HasKey

A key

IRI

An IRI is an internationalized version of an URI/URL.

Import

Declares that an IRI is an import of this ontology

InverseFunctionalObjectProperty

The inverse functional characteristic

InverseObjectProperties

An inverse relationship between two object properties.

IrreflexiveObjectProperty

The irreflexive characteristic

NamedIndividual

An OWL NamedIndividual is an individual in the ontology which is specifically known about and can be identified by name.

NegativeDataPropertyAssertion

A negative data property assertion.

NegativeObjectPropertyAssertion

A negative object property assertion.

ObjectProperty

An OWL ObjectProperty is a relationship between two individuals.

ObjectPropertyAssertion

An object property assertion.

ObjectPropertyDomain

The domain of the object property.

ObjectPropertyRange

The range of the object property.

OntologyAnnotation

An annotation associated with this Ontology

OntologyID

An ontology identifier

ReflexiveObjectProperty

The reflexive characteristic

SameIndividual

A same individual expression.

SubAnnotationPropertyOf

An sub-property assertion for annotation properties.

SubClassOf

A subclass relationship between two ClassExpression.

SubDataPropertyOf

A sub data property relationship.

SubObjectPropertyOf

A sub property relationship between two object properties.

SymmetricObjectProperty

The symmetric characteristic

TransitiveObjectProperty

A transitive relationship between two object properties.

Enums

AnnotationValue

The value of an annotation

Axiom

An axiom

AxiomKind

Contains all different kinds of axiom

ClassExpression

A class expression

DataRange
Facet
Literal
NamedEntity

An OWL entity that is directly resolvable to an IRI

NamedEntityKind
ObjectPropertyExpression

A object property expression

PropertyExpression

A property expression

SubObjectPropertyExpression

A sub-object property expression

Traits

Kinded

An interface providing access to the AxiomKind

MutableOntology

Add or remove axioms to an MutableOntology

Ontology

Access or change the OntologyID of an Ontology