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); }
@Override public void merge(ImmutableOntologyVocabulary v) { if (v instanceof OntologyVocabularyImpl) { OntologyVocabularyImpl vi = (OntologyVocabularyImpl)v; concepts.putAll(vi.concepts); objectProperties.putAll(vi.objectProperties); dataProperties.putAll(vi.dataProperties); annotationProperties.putAll(vi.annotationProperties); } else { for (OClass oc : v.getClasses()) if (!oc.isTop() && !oc.isBottom()) concepts.put(oc.getName(), oc); for (ObjectPropertyExpression ope : v.getObjectProperties()) if (!ope.isTop() && !ope.isBottom()) objectProperties.put(ope.getName(), ope); for (DataPropertyExpression dpe : v.getDataProperties()) if (!dpe.isTop() && !dpe.isBottom()) dataProperties.put(dpe.getName(), dpe); for (AnnotationProperty ap : v.getAnnotationProperties()) annotationProperties.put(ap.getName(), ap); } }
if (!next.isTop() && !next.isBottom()) { Predicate entity = next.getPredicate(); if (nextEmptyEntity(entity)) { nEmptyRoles++;
@Override public boolean isTop() { return property.isTop(); } }
@Override public boolean isBottom() { return property.isBottom(); }
String propFunc = pfa.getName(); String strQuery = String.format(strQueryFunc, propFunc, propFunc);
/** * 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); }