@NonNull @Override public Boolean visit(@NonNull OWLEquivalentObjectPropertiesAxiom axiom) { return axiom.getProperties().size() == 1 || (axiom.getProperties().size() == 2 && axiom.getProperties().stream() .anyMatch(p -> p.isOWLTopObjectProperty())); }
else if (superProperty.isOWLTopObjectProperty()) return true; else if (subProperty.isOWLBottomObjectProperty()) Set<OWLObjectPropertyExpression> subPropertySuperProperties = subPropertyAxioms.stream() .filter(sdpa -> sdpa.getSubProperty().equals(subProperty)).map(sdpa -> sdpa.getSuperProperty()) .filter(supP -> !supP.isOWLTopObjectProperty() && !supP.equals(superProperty) && !supP.equals(subProperty)) .collect(Collectors.toSet()); Set<OWLObjectPropertyExpression> common = new HashSet<>(superPropertySubProperties);
protected void chainCycle(OWLSubPropertyChainOfAxiom axiom) { OWLObjectPropertyExpression superProp = axiom.getSuperProperty(); if (superProp.isOWLTopObjectProperty() || axiom.isEncodingOfTransitiveProperty()) { // TOP or TRANSITIVE_PROP: no violation can occur return; } List<OWLObjectPropertyExpression> chain = axiom.getPropertyChain(); OWLObjectPropertyExpression first = chain.get(0); OWLObjectPropertyExpression last = chain.get(chain.size() - 1); checkCenter(superProp, chain); checkExtremes(superProp, first, last); checkExtremes(superProp, last, first); }
protected void chainCycle(OWLSubPropertyChainOfAxiom axiom) { OWLObjectPropertyExpression superProp = axiom.getSuperProperty(); if (superProp.isOWLTopObjectProperty() || axiom.isEncodingOfTransitiveProperty()) { // TOP or TRANSITIVE_PROP: no violation can occur return; } List<OWLObjectPropertyExpression> chain = axiom.getPropertyChain(); OWLObjectPropertyExpression first = chain.get(0); OWLObjectPropertyExpression last = chain.get(chain.size() - 1); checkCenter(superProp, chain); checkExtremes(superProp, first, last); checkExtremes(superProp, last, first); }
protected void chainCycle(OWLSubPropertyChainOfAxiom axiom) { OWLObjectPropertyExpression superProp = axiom.getSuperProperty(); if (superProp.isOWLTopObjectProperty() || axiom.isEncodingOfTransitiveProperty()) { // TOP or TRANSITIVE_PROP: no violation can occur return; } List<OWLObjectPropertyExpression> chain = axiom.getPropertyChain(); OWLObjectPropertyExpression first = chain.get(0); OWLObjectPropertyExpression last = chain.get(chain.size() - 1); checkCenter(superProp, chain); checkExtremes(superProp, first, last); checkExtremes(superProp, last, first); }
@NonNull @Override public Boolean visit(@NonNull OWLObjectPropertyAssertionAxiom axiom) { return axiom.getProperty().isOWLTopObjectProperty(); }
public void visit(OWLSubPropertyChainOfAxiom axiom) { List<OWLObjectPropertyExpression> subPropertyChain=axiom.getPropertyChain(); if (!containsBottomObjectProperty(subPropertyChain) && !axiom.getSuperProperty().isOWLTopObjectProperty()) { OWLObjectPropertyExpression superObjectPropertyExpression=axiom.getSuperProperty(); if (subPropertyChain.size()==1) addInclusion(subPropertyChain.get(0),superObjectPropertyExpression); else if (subPropertyChain.size()==2 && subPropertyChain.get(0).equals(superObjectPropertyExpression) && subPropertyChain.get(1).equals(superObjectPropertyExpression)) makeTransitive(axiom.getSuperProperty()); else if (subPropertyChain.size()==0) throw new IllegalArgumentException("Error: In OWL 2 DL, an empty property chain in property chain axioms is not allowd, but the ontology contains an axiom that the empty chain is a subproperty of "+superObjectPropertyExpression+"."); else { OWLObjectPropertyExpression[] subObjectProperties=new OWLObjectPropertyExpression[subPropertyChain.size()]; subPropertyChain.toArray(subObjectProperties); addInclusion(subObjectProperties,superObjectPropertyExpression); } } for (OWLObjectPropertyExpression objectPropertyExpression : subPropertyChain) m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(objectPropertyExpression.getNamedProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSuperProperty().getNamedProperty()); } protected boolean containsBottomObjectProperty(List<OWLObjectPropertyExpression> properties) {
@Override public void visit(OWLSubPropertyChainOfAxiom axiom) { List<OWLObjectPropertyExpression> subPropertyChain=axiom.getPropertyChain(); if (!containsBottomObjectProperty(subPropertyChain) && !axiom.getSuperProperty().isOWLTopObjectProperty()) { OWLObjectPropertyExpression superObjectPropertyExpression=axiom.getSuperProperty(); if (subPropertyChain.size()==1) addInclusion(subPropertyChain.get(0),superObjectPropertyExpression); else if (subPropertyChain.size()==2 && subPropertyChain.get(0).equals(superObjectPropertyExpression) && subPropertyChain.get(1).equals(superObjectPropertyExpression)) makeTransitive(axiom.getSuperProperty()); else if (subPropertyChain.isEmpty()) throw new IllegalArgumentException("Error: In OWL 2 DL, an empty property chain in property chain axioms is not allowed, but the ontology contains an axiom that the empty chain is a subproperty of "+superObjectPropertyExpression+"."); else { OWLObjectPropertyExpression[] subObjectProperties=new OWLObjectPropertyExpression[subPropertyChain.size()]; subPropertyChain.toArray(subObjectProperties); addInclusion(subObjectProperties,superObjectPropertyExpression); } } for (OWLObjectPropertyExpression objectPropertyExpression : subPropertyChain) m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(objectPropertyExpression.getNamedProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSuperProperty().getNamedProperty()); } protected boolean containsBottomObjectProperty(List<OWLObjectPropertyExpression> properties) {
public Object visit(OWLSubPropertyChainOfAxiom axiom) { if (axiom.getPropertyChain().size() > 2) { OWLObjectPropertyExpression superProp = axiom.getSuperProperty(); if (!superProp.isOWLTopObjectProperty()) { if (!axiom.isEncodingOfTransitiveProperty()) { List<OWLObjectPropertyExpression> chain = axiom.getPropertyChain();
private void populateObjectInverseProperties(OWLObjectProperty op, OWLReasoner r, Model m) { for (OWLObjectPropertyExpression inverseE : r .getInverseObjectProperties(op)) { if (!inverseE.isAnonymous() && !inverseE.isOWLBottomObjectProperty() && !inverseE.isOWLTopObjectProperty()) { OWLObjectProperty inverse = inverseE.asOWLObjectProperty(); log.debug(inverse + " object inverse of " + op); m.add(toResource(inverse), OWL_INVERSE_OF, toResource(op)); } } }
public void visit(OWLSubObjectPropertyOfAxiom axiom) { if (!axiom.getSubProperty().isOWLBottomObjectProperty() && !axiom.getSuperProperty().isOWLTopObjectProperty()) addInclusion(axiom.getSubProperty(),axiom.getSuperProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSubProperty().getNamedProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSuperProperty().getNamedProperty()); } public void visit(OWLSubPropertyChainOfAxiom axiom) {
@Override public void visit(OWLSubObjectPropertyOfAxiom axiom) { if (!axiom.getSubProperty().isOWLBottomObjectProperty() && !axiom.getSuperProperty().isOWLTopObjectProperty()) addInclusion(axiom.getSubProperty(),axiom.getSuperProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSubProperty().getNamedProperty()); m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(axiom.getSuperProperty().getNamedProperty()); } @Override
/** * Gets a String representation of an OWL 2 object property. * * @param p An OWL 2 object property. * @return A String representation of p. */ public String getObjectPropertyName(OWLObjectPropertyExpression p) { if (p.isOWLTopObjectProperty()) return getTopObjectPropertyName(); else if (p.isOWLBottomObjectProperty()) return getBottomObjectPropertyName(); else return getAtomicObjectPropertyName(p.asOWLObjectProperty()); }
/** * Adds a binary predicate for a given OWL object property expression to the * given conjunction. If the expression is an inverse, source and target terms * are swapped. If the expression is top or bottom, it is handled appropriately. * * @param owlObjectPropertyExpression * the property expression * @param sourceTerm * the term that should be in the first parameter position of the * original expression * @param targetTerm * the term that should be in the second parameter position of the * original expression */ static void addConjunctForPropertyExpression(OWLObjectPropertyExpression owlObjectPropertyExpression, Term sourceTerm, Term targetTerm, SimpleConjunction conjuncts) { if (owlObjectPropertyExpression.isOWLTopObjectProperty()) { conjuncts.init(); } else if (owlObjectPropertyExpression.isOWLBottomObjectProperty()) { conjuncts.makeFalse(); } else { conjuncts.add(getObjectPropertyAtom(owlObjectPropertyExpression, sourceTerm, targetTerm)); } }
if (!owlOPE.isOWLTopObjectProperty()) { // this check is not really needed ObjectPropertyExpression ope = getPropertyExpression(owlOPE, builder.objectProperties()); builder.addSubClassOfAxiom(ce1, ope.getDomain());
if (!owlOPE.isOWLTopObjectProperty()) { // this check is not really needed ObjectPropertyExpression ope = helper.getPropertyExpression(owlOPE); dl_onto.addSubClassOfAxiom(ce1, ope.getDomain());