public class OntologyBuilderImpl extends Object implements OntologyBuilder
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotationAssertion(AnnotationProperty ap,
ObjectConstant o,
Constant c)
inserts an annotation property assertion
|
void |
addClassAssertion(OClass ce,
ObjectConstant o)
inserts a class assertion
(does nothing if ce is the top class, cf.
|
void |
addDataPropertyAssertion(DataPropertyExpression dpe,
ObjectConstant o,
RDFLiteralConstant v)
inserts a data property assertion
(does nothing if dpe is the top property, cf.
|
void |
addDataPropertyRangeAxiom(DataPropertyRangeExpression range,
Datatype datatype)
Normalizes and adds a data property range axiom
|
void |
addDisjointClassesAxiom(ClassExpression... ces)
Normalizes and adds class disjointness axiom
|
void |
addDisjointDataPropertiesAxiom(DataPropertyExpression... dpes)
Normalizes and adds data property disjointness axiom
|
void |
addDisjointObjectPropertiesAxiom(ObjectPropertyExpression... opes)
Normalizes and adds object property disjointness axiom
|
void |
addFunctionalDataPropertyAxiom(DataPropertyExpression prop) |
void |
addFunctionalObjectPropertyAxiom(ObjectPropertyExpression prop) |
void |
addIrreflexiveObjectPropertyAxiom(ObjectPropertyExpression ope)
Normalizes and adds an irreflexive object property axiom
|
void |
addObjectPropertyAssertion(ObjectPropertyExpression ope,
ObjectConstant o1,
ObjectConstant o)
inserts an object property assertion
(ensures that the property is not inverse by swapping arguments if necessary)
(does nothing if ope is the top property, cf.
|
void |
addReflexiveObjectPropertyAxiom(ObjectPropertyExpression ope)
Normalizes and adds a reflexive object property axiom
|
void |
addSubClassOfAxiom(ClassExpression ce1,
ClassExpression ce2)
Normalizes and adds subclass axiom
|
void |
addSubPropertyOfAxiom(DataPropertyExpression dpe1,
DataPropertyExpression dpe2)
Normalizes and adds a data subproperty axiom
|
void |
addSubPropertyOfAxiom(ObjectPropertyExpression ope1,
ObjectPropertyExpression ope2)
Normalizes and adds an object subproperty axiom
|
OntologyVocabularyCategory<AnnotationProperty> |
annotationProperties() |
static ABoxAssertionSupplier |
assertionSupplier(org.apache.commons.rdf.api.RDF rdfFactory) |
Ontology |
build() |
static OntologyBuilder |
builder(org.apache.commons.rdf.api.RDF rdfFactory) |
OntologyVocabularyCategory<OClass> |
classes() |
static AnnotationAssertion |
createAnnotationAssertion(AnnotationProperty ap,
ObjectConstant o,
Constant c)
Creates an annotation assertion
AnnotationAssertion := 'AnnotationAssertion' '(' axiomAnnotations AnnotationProperty AnnotationSubject AnnotationValue ')'
AnnotationSubject := IRI | AnonymousIndividual
|
ObjectPropertyExpression |
createAuxiliaryObjectProperty()
create an auxiliary object property
(auxiliary properties result from ontology normalization)
|
static ClassAssertion |
createClassAssertion(OClass ce,
ObjectConstant object)
Creates a class assertion
|
static DataPropertyAssertion |
createDataPropertyAssertion(DataPropertyExpression dpe,
ObjectConstant o1,
RDFLiteralConstant o2)
Creates a data property assertion
|
static ObjectPropertyAssertion |
createObjectPropertyAssertion(ObjectPropertyExpression ope,
ObjectConstant o1,
ObjectConstant o2)
Creates an object property assertion
|
OntologyVocabularyCategory<DataPropertyExpression> |
dataProperties() |
AnnotationProperty |
declareAnnotationProperty(org.apache.commons.rdf.api.IRI iri) |
OClass |
declareClass(org.apache.commons.rdf.api.IRI iri)
declare an entity
|
DataPropertyExpression |
declareDataProperty(org.apache.commons.rdf.api.IRI uri) |
ObjectPropertyExpression |
declareObjectProperty(org.apache.commons.rdf.api.IRI iri) |
Datatype |
getDatatype(String uri) |
OntologyVocabularyCategory<ObjectPropertyExpression> |
objectProperties() |
public static OntologyBuilder builder(org.apache.commons.rdf.api.RDF rdfFactory)
public static ABoxAssertionSupplier assertionSupplier(org.apache.commons.rdf.api.RDF rdfFactory)
public OntologyVocabularyCategory<OClass> classes()
classes in interface OntologyBuilderpublic OntologyVocabularyCategory<ObjectPropertyExpression> objectProperties()
objectProperties in interface OntologyBuilderpublic OntologyVocabularyCategory<DataPropertyExpression> dataProperties()
dataProperties in interface OntologyBuilderpublic OntologyVocabularyCategory<AnnotationProperty> annotationProperties()
annotationProperties in interface OntologyBuilderpublic OClass declareClass(org.apache.commons.rdf.api.IRI iri)
OntologyBuilderdeclareClass in interface OntologyBuilderpublic ObjectPropertyExpression declareObjectProperty(org.apache.commons.rdf.api.IRI iri)
declareObjectProperty in interface OntologyBuilderpublic DataPropertyExpression declareDataProperty(org.apache.commons.rdf.api.IRI uri)
declareDataProperty in interface OntologyBuilderpublic AnnotationProperty declareAnnotationProperty(org.apache.commons.rdf.api.IRI iri)
declareAnnotationProperty in interface OntologyBuilderpublic Datatype getDatatype(String uri)
getDatatype in interface OntologyBuilderpublic void addSubClassOfAxiom(ClassExpression ce1, ClassExpression ce2) throws InconsistentOntologyException
SubClassOf := 'SubClassOf' '(' axiomAnnotations subClassExpression superClassExpression ')'
Implements rule [C1]:
- ignore the axiom if the first argument is owl:Nothing or the second argument is owl:Thing
- replace by a disjointness axiom if the second argument is owl:Nothing but the first is not owl:Thing
- inconsistency if the first argument is owl:Thing but the second one is not owl:Nothing
Implements rules [D5] and [O5] (in conjunction with DataSomeValuesFromImpl and ObjectSomeValuesFromImpl)
- if the first argument is syntactically "equivalent" to owl:Thing, then replace it by owl:Thing
addSubClassOfAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addDataPropertyRangeAxiom(DataPropertyRangeExpression range, Datatype datatype) throws InconsistentOntologyException
DataPropertyRange := 'DataPropertyRange' '(' axiomAnnotations DataPropertyExpression DataRange ')'
Implements rule [D3]: - ignore if the property is bot or the range is rdfs:Literal (top datatype) - inconsistency if the property is top but the range is not rdfs:Literal
addDataPropertyRangeAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addSubPropertyOfAxiom(ObjectPropertyExpression ope1, ObjectPropertyExpression ope2) throws InconsistentOntologyException
SubObjectPropertyOf := 'SubObjectPropertyOf' '(' axiomAnnotations ObjectPropertyExpression ObjectPropertyExpression ')'
Implements rule [O1]:
- ignore the axiom if the first argument is owl:bottomObjectProperty
or the second argument is owl:topObjectProperty
- replace by a disjointness axiom if the second argument is owl:bottomObjectProperty
but the first one is not owl:topObjectProperty
- inconsistency if the first is owl:topObjectProperty but the second is owl:bottomObjectProperty
addSubPropertyOfAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addSubPropertyOfAxiom(DataPropertyExpression dpe1, DataPropertyExpression dpe2) throws InconsistentOntologyException
SubDataPropertyOf := 'SubDataPropertyOf' '(' axiomAnnotations
subDataPropertyExpression superDataPropertyExpression ')'
subDataPropertyExpression := DataPropertyExpression
superDataPropertyExpression := DataPropertyExpression
implements rule [D1]:
- ignore the axiom if the first argument is owl:bottomDataProperty
or the second argument is owl:topDataProperty
- replace by a disjointness axiom if the second argument is owl:bottomDataProperty
but the first one is not owl:topDataProperty
- inconsistency if the first is owl:topDataProperty but the second is owl:bottomDataProperty
addSubPropertyOfAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addDisjointClassesAxiom(ClassExpression... ces) throws InconsistentOntologyException
DisjointClasses := 'DisjointClasses' '(' axiomAnnotations
subClassExpression subClassExpression { subClassExpression } ')'
Implements rule [C2]:
- eliminates all occurrences of bot and if the result contains
- no top and at least two elements then disjointness
- one top then emptiness of all other elements
- two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list)
addDisjointClassesAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addDisjointObjectPropertiesAxiom(ObjectPropertyExpression... opes) throws InconsistentOntologyException
DisjointObjectProperties := 'DisjointObjectProperties' '(' axiomAnnotations
ObjectPropertyExpression ObjectPropertyExpression { ObjectPropertyExpression } ')'
Implements rule [O2]:
- eliminates all occurrences of bot and if the result contains
- no top and at least two elements then disjointness
- one top then emptiness of all other elements
- two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list)
addDisjointObjectPropertiesAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addDisjointDataPropertiesAxiom(DataPropertyExpression... dpes) throws InconsistentOntologyException
DisjointDataProperties := 'DisjointDataProperties' '(' axiomAnnotations
DataPropertyExpression DataPropertyExpression { DataPropertyExpression } ')'
Implements rule [D2]:
- eliminates all occurrences of bot and if the result contains
- no top and at least two elements then disjointness
- one top then emptiness of all other elements
- two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list)
addDisjointDataPropertiesAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addReflexiveObjectPropertyAxiom(ObjectPropertyExpression ope) throws InconsistentOntologyException
ReflexiveObjectProperty := 'ReflexiveObjectProperty' '(' axiomAnnotations ObjectPropertyExpression ')'
Implements rule [O3]:
- ignores if top (which is reflexive by definition)
- inconsistency if bot (which is not reflexive)
- otherwise, removes the inverse if required
addReflexiveObjectPropertyAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addIrreflexiveObjectPropertyAxiom(ObjectPropertyExpression ope) throws InconsistentOntologyException
ReflexiveObjectProperty := 'ReflexiveObjectProperty' '(' axiomAnnotations ObjectPropertyExpression ')'
Implements rule [O3]:
- ignores if bot (which is irreflexive by definition)
- inconsistency if top (which is reflexive)
- otherwise, removes the inverse if required
addIrreflexiveObjectPropertyAxiom in interface OntologyBuilderInconsistentOntologyExceptionpublic void addFunctionalObjectPropertyAxiom(ObjectPropertyExpression prop)
addFunctionalObjectPropertyAxiom in interface OntologyBuilderpublic void addFunctionalDataPropertyAxiom(DataPropertyExpression prop)
addFunctionalDataPropertyAxiom in interface OntologyBuilderpublic static ClassAssertion createClassAssertion(OClass ce, ObjectConstant object) throws InconsistentOntologyException
ClassAssertion := 'ClassAssertion' '(' axiomAnnotations Class Individual ')'
Implements rule [C4]: - ignore (return null) if the class is top - inconsistency if the class is bot
InconsistentOntologyExceptionpublic static ObjectPropertyAssertion createObjectPropertyAssertion(ObjectPropertyExpression ope, ObjectConstant o1, ObjectConstant o2) throws InconsistentOntologyException
ObjectPropertyAssertion := 'ObjectPropertyAssertion' '(' axiomAnnotations ObjectPropertyExpression sourceIndividual targetIndividual ')'
Implements rule [O4]: - ignore (return null) if the property is top - inconsistency if the property is bot - swap the arguments to eliminate inverses
InconsistentOntologyExceptionpublic static DataPropertyAssertion createDataPropertyAssertion(DataPropertyExpression dpe, ObjectConstant o1, RDFLiteralConstant o2) throws InconsistentOntologyException
DataPropertyAssertion := 'DataPropertyAssertion' '(' axiomAnnotations DataPropertyExpression sourceIndividual targetValue ')'
Implements rule [D4]: - ignore (return null) if the property is top - inconsistency if the property is bot
InconsistentOntologyExceptionpublic static AnnotationAssertion createAnnotationAssertion(AnnotationProperty ap, ObjectConstant o, Constant c)
public void addClassAssertion(OClass ce, ObjectConstant o) throws InconsistentOntologyException
OntologyBuilderaddClassAssertion in interface OntologyBuilderInconsistentOntologyException - if ce is the bottom class ([C4])public void addObjectPropertyAssertion(ObjectPropertyExpression ope, ObjectConstant o1, ObjectConstant o) throws InconsistentOntologyException
OntologyBuilderaddObjectPropertyAssertion in interface OntologyBuilderInconsistentOntologyException - if ope is the bottom property ([O4])public void addDataPropertyAssertion(DataPropertyExpression dpe, ObjectConstant o, RDFLiteralConstant v) throws InconsistentOntologyException
OntologyBuilderaddDataPropertyAssertion in interface OntologyBuilderInconsistentOntologyException - if dpe is the bottom property ([D4])public void addAnnotationAssertion(AnnotationProperty ap, ObjectConstant o, Constant c)
OntologyBuilderaddAnnotationAssertion in interface OntologyBuilderpublic Ontology build()
build in interface OntologyBuilderpublic ObjectPropertyExpression createAuxiliaryObjectProperty()
OntologyBuildercreateAuxiliaryObjectProperty in interface OntologyBuilderCopyright © 2009–2020 Free University of Bozen-Bolzano. All rights reserved.