private void checkSignature(ObjectPropertyExpression prop) { if (prop.isInverse()) prop = prop.getInverse(); if (!vocabulary.containsObjectProperty(prop.getName()) && !auxObjectProperties.contains(prop)) throw new IllegalArgumentException(OBJECT_PROPERTY_NOT_FOUND + prop); }
/** * Normalizes and adds a reflexive object property axiom * <p> * ReflexiveObjectProperty := 'ReflexiveObjectProperty' '(' axiomAnnotations ObjectPropertyExpression ')' * <p> * Implements rule [O3]:<br> * - ignores if top (which is reflexive by definition)<br> * - inconsistency if bot (which is not reflexive)<br> * - otherwise, removes the inverse if required * * @throws InconsistentOntologyException */ @Override public void addReflexiveObjectPropertyAxiom(ObjectPropertyExpression ope) throws InconsistentOntologyException { if (ope.isTop()) return; if (ope.isBottom()) throw new InconsistentOntologyException(); if (ope.isInverse()) reflexiveObjectPropertyAxioms.add(ope.getInverse()); else reflexiveObjectPropertyAxioms.add(ope); }
/** * Normalizes and adds an irreflexive object property axiom * <p> * ReflexiveObjectProperty := 'ReflexiveObjectProperty' '(' axiomAnnotations ObjectPropertyExpression ')' * <p> * Implements rule [O3]:<br> * - ignores if bot (which is irreflexive by definition)<br> * - inconsistency if top (which is reflexive)<br> * - otherwise, removes the inverse if required * * @throws InconsistentOntologyException */ @Override public void addIrreflexiveObjectPropertyAxiom(ObjectPropertyExpression ope) throws InconsistentOntologyException { if (ope.isTop()) throw new InconsistentOntologyException(); if (ope.isBottom()) return; if (ope.isInverse()) irreflexiveObjectPropertyAxioms.add(ope.getInverse()); else irreflexiveObjectPropertyAxioms.add(ope); }
/** * Creates an object property assertion * <p> * ObjectPropertyAssertion := 'ObjectPropertyAssertion' '(' axiomAnnotations * ObjectPropertyExpression sourceIndividual targetIndividual ')' * <p> * Implements rule [O4]: * - ignore (return null) if the property is top * - inconsistency if the property is bot * - swap the arguments to eliminate inverses */ public ObjectPropertyAssertion createObjectPropertyAssertion(ObjectPropertyExpression ope, ObjectConstant o1, ObjectConstant o2) throws InconsistentOntologyException { if (ope.isTop()) return null; if (ope.isBottom()) throw new InconsistentOntologyException(); if (ope.isInverse()) return new ObjectPropertyAssertionImpl(ope.getInverse(), o2, o1); else return new ObjectPropertyAssertionImpl(ope, o1, o2); }