@Override public void addFunctionalObjectPropertyAxiom(ObjectPropertyExpression prop) { checkSignature(prop); functionalObjectPropertyAxioms.add(prop); }
@Override public void addFunctionalDataPropertyAxiom(DataPropertyExpression prop) { checkSignature(prop); functionalDataPropertyAxioms.add(prop); }
/** * Adds an annotation subproperty axiom * <p> * SubAnnotationPropertyOf := 'SubAnnotationPropertyOf' '(' axiomAnnotations subAnnotationProperty superAnnotationProperty ')'<br> * subAnnotationProperty := AnnotationProperty<br> * superAnnotationProperty := AnnotationProperty * <p> * * @throws InconsistentOntologyException */ @Override public void addSubPropertyOfAxiom(AnnotationProperty ap1, AnnotationProperty ap2) { checkSignature(ap1); checkSignature(ap2); BinaryAxiom<AnnotationProperty> ax = new BinaryAxiomImpl<>(ap1, ap2); annotationAxioms.add(ax); }
/** * Normalizes and adds an object subproperty axiom * <p> * SubObjectPropertyOf := 'SubObjectPropertyOf' '(' axiomAnnotations * ObjectPropertyExpression ObjectPropertyExpression ')' * <p> * Implements rule [O1]:<br> * - ignore the axiom if the first argument is owl:bottomObjectProperty * or the second argument is owl:topObjectProperty<br> * - replace by a disjointness axiom if the second argument is owl:bottomObjectProperty * but the first one is not owl:topObjectProperty<br> * - inconsistency if the first is owl:topObjectProperty but the second is owl:bottomObjectProperty * * @throws InconsistentOntologyException * */ @Override public void addSubPropertyOfAxiom(ObjectPropertyExpression ope1, ObjectPropertyExpression ope2) throws InconsistentOntologyException { checkSignature(ope1); checkSignature(ope2); objectPropertyAxioms.addInclusion(ope1, ope2); }
/** * Normalizes and adds a data subproperty axiom * <p> * SubDataPropertyOf := 'SubDataPropertyOf' '(' axiomAnnotations * subDataPropertyExpression superDataPropertyExpression ')'<br> * subDataPropertyExpression := DataPropertyExpression<br> * superDataPropertyExpression := DataPropertyExpression * <p> * implements rule [D1]:<br> * - ignore the axiom if the first argument is owl:bottomDataProperty * or the second argument is owl:topDataProperty<br> * - replace by a disjointness axiom if the second argument is owl:bottomDataProperty * but the first one is not owl:topDataProperty<br> * - inconsistency if the first is owl:topDataProperty but the second is owl:bottomDataProperty * * @throws InconsistentOntologyException */ @Override public void addSubPropertyOfAxiom(DataPropertyExpression dpe1, DataPropertyExpression dpe2) throws InconsistentOntologyException { checkSignature(dpe1); checkSignature(dpe2); dataPropertyAxioms.addInclusion(dpe1, dpe2); }
@Override public void addAnnotationAssertion(AnnotationAssertion assertion) { checkSignature(assertion.getProperty()); annotationAssertions.add(assertion); }
@Override public void addClassAssertion(ClassAssertion assertion) { checkSignature(assertion.getConcept()); classAssertions.add(assertion); }
@Override public void addDataPropertyAssertion(DataPropertyAssertion assertion) { checkSignature(assertion.getProperty()); dataPropertyAssertions.add(assertion); }
@Override public void addObjectPropertyAssertion(ObjectPropertyAssertion assertion) { checkSignature(assertion.getProperty()); objectPropertyAssertions.add(assertion); }
private void checkSignature(DataPropertyRangeExpression desc) { checkSignature(desc.getProperty()); }
/** * Normalizes and adds data property disjointness axiom * <p> * DisjointDataProperties := 'DisjointDataProperties' '(' axiomAnnotations * DataPropertyExpression DataPropertyExpression { DataPropertyExpression } ')'<br> * <p> * Implements rule [D2]:<br> * - eliminates all occurrences of bot and if the result contains<br> * - no top and at least two elements then disjointness<br> * - one top then emptiness of all other elements<br> * - two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list) */ @Override public void addDisjointDataPropertiesAxiom(DataPropertyExpression... dpes) throws InconsistentOntologyException { for (DataPropertyExpression dpe : dpes) checkSignature(dpe); dataPropertyAxioms.addDisjointness(dpes); }
/** * Normalizes and adds class disjointness axiom * <p> * DisjointClasses := 'DisjointClasses' '(' axiomAnnotations * subClassExpression subClassExpression { subClassExpression } ')'<br> * <p> * Implements rule [C2]:<br> * - eliminates all occurrences of bot and if the result contains<br> * - no top and at least two elements then disjointness<br> * - one top then emptiness of all other elements<br> * - two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list) */ @Override public void addDisjointClassesAxiom(ClassExpression... ces) throws InconsistentOntologyException { for (ClassExpression c : ces) checkSignature(c); classAxioms.addDisjointness(ces); }
/** * Normalizes and adds object property disjointness axiom * <p> * DisjointObjectProperties := 'DisjointObjectProperties' '(' axiomAnnotations * ObjectPropertyExpression ObjectPropertyExpression { ObjectPropertyExpression } ')'<br> * <p> * Implements rule [O2]:<br> * - eliminates all occurrences of bot and if the result contains<br> * - no top and at least two elements then disjointness<br> * - one top then emptiness of all other elements<br> * - two tops then inconsistency (this behavior is an extension of OWL 2, where duplicates are removed from the list) */ @Override public void addDisjointObjectPropertiesAxiom(ObjectPropertyExpression... opes) throws InconsistentOntologyException { for (ObjectPropertyExpression p : opes) checkSignature(p); objectPropertyAxioms.addDisjointness(opes); }
/** * Normalizes and adds subclass axiom * <p> * SubClassOf := 'SubClassOf' '(' axiomAnnotations subClassExpression superClassExpression ')' * <p> * Implements rule [C1]:<br> * - ignore the axiom if the first argument is owl:Nothing or the second argument is owl:Thing<br> * - replace by a disjointness axiom if the second argument is owl:Nothing but the first is not owl:Thing<br> * - inconsistency if the first argument is owl:Thing but the second one is not owl:Nothing * <p> * Implements rules [D5] and [O5] (in conjunction with DataSomeValuesFromImpl and ObjectSomeValuesFromImpl)<br> * - if the first argument is syntactically "equivalent" to owl:Thing, then replace it by owl:Thing * * @throws InconsistentOntologyException */ @Override public void addSubClassOfAxiom(ClassExpression ce1, ClassExpression ce2) throws InconsistentOntologyException { checkSignature(ce1); checkSignature(ce2); if (ce1.isTop()) ce1 = ClassImpl.owlThing; // rules [D5] and [O5] classAxioms.addInclusion(ce1, ce2); }
private void checkSignature(ClassExpression desc) { if (desc instanceof OClass) { OClass cl = (OClass) desc; if (!vocabulary.concepts.containsKey(cl.getName())) throw new IllegalArgumentException(CLASS_NOT_FOUND + desc); } else if (desc instanceof ObjectSomeValuesFrom) { checkSignature(((ObjectSomeValuesFrom) desc).getProperty()); } else { assert (desc instanceof DataSomeValuesFrom); checkSignature(((DataSomeValuesFrom) desc).getProperty()); } }
/** * Normalizes and adds a data property range axiom * <p> * DataPropertyRange := 'DataPropertyRange' '(' axiomAnnotations DataPropertyExpression DataRange ')' * <p> * 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 * * @throws InconsistentOntologyException */ @Override public void addDataPropertyRangeAxiom(DataPropertyRangeExpression range, Datatype datatype) throws InconsistentOntologyException { checkSignature(range); checkSignature(datatype); if (datatype.equals(DatatypeImpl.rdfsLiteral)) return; // otherwise the datatype is not top if (range.getProperty().isBottom()) return; if (range.getProperty().isTop()) throw new InconsistentOntologyException(); BinaryAxiom<DataRangeExpression> ax = new BinaryAxiomImpl<>(range, datatype); subDataRangeAxioms.add(ax); }