/** * Create an all values restriction. * * @param r property term * @param c class or datatype term * @return an ATermAppl in the form all(r,c) */ public static ATermAppl all(final ATermAppl r, final ATermAppl c) { return ATermUtils.makeAllValues(r, c); }
/** * Create an all values restriction. * * @param r property term * @param c class or datatype term * @return an ATermAppl in the form all(r,c) */ public static ATermAppl all(final ATermAppl r, final ATermAppl c) { return ATermUtils.makeAllValues(r, c); }
@Override public void visit(final OWLObjectAllValuesFrom restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATerm c = _term; _term = ATermUtils.makeAllValues(p, c); }
@Override public void visit(final OWLDataAllValuesFrom restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATerm c = _term; _term = ATermUtils.makeAllValues(p, c); }
public default boolean hasRange(final ATermAppl p, final ATermAppl c) { if (null == p || null == c) return false; if (!isClass(c) && !isDatatype(c)) { Base.handleUndefinedEntity(c + _isNotAValidClassExpression); return false; } final ATermAppl allValues = ATermUtils.makeAllValues(p, c); return isSubClassOf(ATermUtils.TOP, allValues); }
@Override public void visit(final OWLObjectAllValuesFrom restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATerm c = _term; _term = ATermUtils.makeAllValues(p, c); }
@Override public void visit(final OWLObjectAllValuesFrom restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATerm c = _term; _term = ATermUtils.makeAllValues(p, c); }
@Override public void visit(final OWLDataAllValuesFrom restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATerm c = _term; _term = ATermUtils.makeAllValues(p, c); }
@Override public void visit(final OWLDataAllValuesFrom restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATerm c = _term; _term = ATermUtils.makeAllValues(p, c); }
public default boolean hasRange(final ATermAppl p, final ATermAppl c) { if (null == p || null == c) return false; if (!isClass(c) && !isDatatype(c)) { Base.handleUndefinedEntity(c + _isNotAValidClassExpression); return false; } final ATermAppl allValues = ATermUtils.makeAllValues(p, c); return isSubClassOf(ATermUtils.TOP, allValues); }
private static boolean isBlockedByChain(final BlockingContext cxt, final ATermList chain, final ATermAppl c) { final Role firstRole = cxt._blocked.getABox().getRole(chain.getFirst()); return !cxt.getIncomingRoles().contains(firstRole.getInverse()) && cxt._blocked.getParent().hasType(ATermUtils.makeAllValues(chain.getNext(), c)); } }
private static boolean isBlockedByChain(final BlockingContext cxt, final ATermList chain, final ATermAppl c) { final Role firstRole = cxt._blocked.getABox().getRole(chain.getFirst()); return !cxt.getIncomingRoles().contains(firstRole.getInverse()) && cxt._blocked.getParent().hasType(ATermUtils.makeAllValues(chain.getNext(), c)); } }
default boolean isReflexiveProperty(final ATermAppl p) { if (null == p) return false; final Role role = getRole(p); if (role == null) { Base.handleUndefinedEntity(p + _isNotAnKnowProperty); return false; } if (!role.isObjectRole() || role.isIrreflexive()) return false; else if (role.isReflexive()) { if (doExplanation()) getABox().setExplanation(role.getExplainReflexive()); return true; } ensureConsistency(); final ATermAppl c = ATermUtils.makeTermAppl("_C_"); final ATermAppl notC = ATermUtils.makeNot(c); final ATermAppl test = ATermUtils.makeAnd(c, ATermUtils.makeAllValues(p, notC)); return !getABox().isSatisfiable(test); }
protected boolean applyAllValuesPropertyChain(final Individual x, final ATermList chain, final ATermAppl c, final DependencySet ds) { final Role r = _strategy.getABox().getRole(chain.getFirst()); final EdgeList edges = x.getRNeighborEdges(r); if (!edges.isEmpty()) { final ATermAppl allRC = ATermUtils.makeAllValues(chain.getNext(), c); for (int e = 0; e < edges.size(); e++) { final Edge edgeToY = edges.get(e); final Node y = edgeToY.getNeighbor(x); final DependencySet finalDS = ds.union(edgeToY.getDepends(), _strategy.getABox().doExplanation()); applyAllValues(x, r, y, allRC, finalDS); if (x.isMerged() || _strategy.getABox().isClosed()) return false; } } return true; }
protected boolean applyAllValuesPropertyChain(final Individual x, final ATermList chain, final ATermAppl c, final DependencySet ds) { final Role r = _strategy.getABox().getRole(chain.getFirst()); final EdgeList edges = x.getRNeighborEdges(r); if (!edges.isEmpty()) { final ATermAppl allRC = ATermUtils.makeAllValues(chain.getNext(), c); for (int e = 0; e < edges.size(); e++) { final Edge edgeToY = edges.get(e); final Node y = edgeToY.getNeighbor(x); final DependencySet finalDS = ds.union(edgeToY.getDepends(), _strategy.getABox().doExplanation()); applyAllValues(x, r, y, allRC, finalDS); if (x.isMerged() || _strategy.getABox().isClosed()) return false; } } return true; }
default boolean isReflexiveProperty(final ATermAppl p) { if (null == p) return false; final Role role = getRole(p); if (role == null) { Base.handleUndefinedEntity(p + _isNotAnKnowProperty); return false; } if (!role.isObjectRole() || role.isIrreflexive()) return false; else if (role.isReflexive()) { if (doExplanation()) getABox().setExplanation(role.getExplainReflexive()); return true; } ensureConsistency(); final ATermAppl c = ATermUtils.makeTermAppl("_C_"); final ATermAppl notC = ATermUtils.makeNot(c); final ATermAppl test = ATermUtils.makeAnd(c, ATermUtils.makeAllValues(p, notC)); return !getABox().isSatisfiable(test); }
default boolean isTransitiveProperty(final ATermAppl r) { if (null == r) return false; final Role role = getRole(r); if (role == null) { Base.handleUndefinedEntity(r + _isNotAnKnowProperty); return false; } if (role.isTransitive()) { if (doExplanation()) getABox().setExplanation(role.getExplainTransitive()); return true; } else if (!role.isObjectRole() || role.isFunctional() || role.isInverseFunctional()) return false; ensureConsistency(); final ATermAppl c = ATermUtils.makeTermAppl("_C_"); final ATermAppl notC = ATermUtils.makeNot(c); final ATermAppl test = ATermUtils.makeAnd(ATermUtils.makeSomeValues(r, ATermUtils.makeSomeValues(r, c)), ATermUtils.makeAllValues(r, notC)); return !getABox().isSatisfiable(test); }
default boolean isTransitiveProperty(final ATermAppl r) { if (null == r) return false; final Role role = getRole(r); if (role == null) { Base.handleUndefinedEntity(r + _isNotAnKnowProperty); return false; } if (role.isTransitive()) { if (doExplanation()) getABox().setExplanation(role.getExplainTransitive()); return true; } else if (!role.isObjectRole() || role.isFunctional() || role.isInverseFunctional()) return false; ensureConsistency(); final ATermAppl c = ATermUtils.makeTermAppl("_C_"); final ATermAppl notC = ATermUtils.makeNot(c); final ATermAppl test = ATermUtils.makeAnd(ATermUtils.makeSomeValues(r, ATermUtils.makeSomeValues(r, c)), ATermUtils.makeAllValues(r, notC)); return !getABox().isSatisfiable(test); }
@Test public void testSubProp2() { final ATermAppl nonHumanRelatives = ATermUtils.makeAllValues(relative, ATermUtils.makeNot(person)); _kb.addIndividual(mary); _kb.addIndividual(bob); _kb.addObjectProperty(relative); _kb.addObjectProperty(sibling); _kb.addSubProperty(sibling, relative); _kb.addType(bob, nonHumanRelatives); _kb.addType(mary, person); _kb.addPropertyValue(sibling, bob, mary); assertFalse(_kb.isConsistent()); final Set<ATermAppl> explanation = _kb.getExplanationSet(); assertIteratorValues(explanation.iterator(), new Object[] { ATermUtils.makeSubProp(sibling, relative), ATermUtils.makePropAtom(sibling, bob, mary), ATermUtils.makeTypeAtom(bob, nonHumanRelatives), ATermUtils.makeTypeAtom(mary, person), }); }
@Test public void testReflexive() { final ATermAppl notPerson = ATermUtils.makeNot(person); final ATermAppl bobsType = ATermUtils.makeAllValues(relative, notPerson); _kb.addClass(person); _kb.addObjectProperty(relative); _kb.addReflexiveProperty(relative); _kb.addIndividual(robert); _kb.addType(robert, person); _kb.addType(robert, bobsType); _kb.addIndividual(victor); _kb.addType(victor, notPerson); // _kb.addPropertyValue(relative, robert, victor); assertFalse(_kb.isConsistent()); final Set<ATermAppl> explanation = _kb.getExplanationSet(); assertIteratorValues(explanation.iterator(), new Object[] { ATermUtils.makeReflexive(relative), ATermUtils.makeTypeAtom(robert, person), ATermUtils.makeTypeAtom(robert, bobsType), // ATermUtils.makePropAtom(relative, robert, victor), }); }