public static ATermAppl hasValue(final ATermAppl r, final ATermAppl ind) { return ATermUtils.makeHasValue(r, ind); }
public static ATermAppl hasValue(final ATermAppl r, final ATermAppl ind) { return ATermUtils.makeHasValue(r, ind); }
@Override public void visit(final OWLObjectHasValue restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATermAppl ind = _term; _term = ATermUtils.makeHasValue(p, ind); }
@Override public void visit(final OWLDataHasValue restriction) { restriction.getProperty().accept(this); final ATermAppl p = _term; restriction.getFiller().accept(this); final ATermAppl dv = _term; _term = ATermUtils.makeHasValue(p, dv); }
@Override public void visit(final OWLObjectHasValue restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATermAppl ind = _term; _term = ATermUtils.makeHasValue(p, ind); }
@Override public void visit(final OWLDataHasValue restriction) { restriction.getProperty().accept(this); final ATermAppl p = _term; restriction.getFiller().accept(this); final ATermAppl dv = _term; _term = ATermUtils.makeHasValue(p, dv); }
@Override public void visit(final OWLObjectHasValue restriction) { restriction.getProperty().accept(this); final ATerm p = _term; restriction.getFiller().accept(this); final ATermAppl ind = _term; _term = ATermUtils.makeHasValue(p, ind); }
@Override public void visit(final OWLDataHasValue restriction) { restriction.getProperty().accept(this); final ATermAppl p = _term; restriction.getFiller().accept(this); final ATermAppl dv = _term; _term = ATermUtils.makeHasValue(p, dv); }
final ATermAppl c = ATermUtils.normalize(ATermUtils.makeHasValue(r, litValue));
_abox.addLiteral(o, ds); final ATermAppl C = ATermUtils.makeNot(ATermUtils.makeHasValue(p, o));
final ATermAppl valueX = ATermUtils.makeHasValue(role.getInverse().getName(), x); final ATermAppl c = ATermUtils.normalize(valueX);
final ATermAppl valueX = ATermUtils.makeHasValue(role.getInverse().getName(), x); final ATermAppl c = ATermUtils.normalize(valueX);
if (!onlyObvious) final ATermAppl hasValue = ATermUtils.makeHasValue(role.getName(), literalValue); if (isType(s, hasValue)) values.add(literalValue);
if (!onlyObvious) final ATermAppl hasValue = ATermUtils.makeHasValue(role.getName(), literalValue); if (isType(s, hasValue)) values.add(literalValue);
@Override public boolean hasPropertyValue(final ATermAppl s, final ATermAppl p, final ATermAppl o) { final Bool hasObviousValue = hasObviousPropertyValue(s, p, o); if (hasObviousValue.isKnown()) if (hasObviousValue.isFalse() || !doExplanation()) return hasObviousValue.isTrue(); ATermAppl c = null; if (o == null) { if (_kb.isDatatypeProperty(p)) c = ATermUtils.makeMin(p, 1, ATermUtils.TOP_LIT); else c = ATermUtils.makeMin(p, 1, ATermUtils.TOP); } else c = ATermUtils.makeHasValue(p, o); final boolean isType = isType(s, c); return isType; }
@Override public boolean hasPropertyValue(final ATermAppl s, final ATermAppl p, final ATermAppl o) { final Bool hasObviousValue = hasObviousPropertyValue(s, p, o); if (hasObviousValue.isKnown()) if (hasObviousValue.isFalse() || !doExplanation()) return hasObviousValue.isTrue(); ATermAppl c = null; if (o == null) { if (_kb.isDatatypeProperty(p)) c = ATermUtils.makeMin(p, 1, ATermUtils.TOP_LIT); else c = ATermUtils.makeMin(p, 1, ATermUtils.TOP); } else c = ATermUtils.makeHasValue(p, o); final boolean isType = isType(s, c); return isType; }
test = ATermUtils.makeOr(ATermUtils.makeAnd(ATermUtils.makeHasValue(p1, anon), ATermUtils.makeAllValues(p2, ATermUtils.makeNot(ATermUtils.makeValue(anon)))), ATermUtils.makeAnd(ATermUtils.makeHasValue(p2, anon), ATermUtils.makeAllValues(p1, ATermUtils.makeNot(ATermUtils.makeValue(anon)))));
@Test public void testNominalValueInteraction() { final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl t1 = term("T1"); final ATermAppl p = term("p"); final ATermAppl i1 = term("i1"); final ATermAppl i21 = term("i21"); final ATermAppl i22 = term("i22"); final ATermAppl t1eq = ATermUtils.makeAnd(ATermUtils.makeHasValue(p, i21), ATermUtils.makeHasValue(p, i22)); final ATermAppl test = term("test"); kb.addClass(t1); kb.addObjectProperty(p); kb.addIndividual(i1); kb.addIndividual(i21); kb.addIndividual(i22); kb.addIndividual(test); kb.addEquivalentClass(t1, t1eq); kb.addSame(i1, i21); kb.addSame(i21, i1); kb.addPropertyValue(p, test, i21); kb.addPropertyValue(p, test, i22); final Set<ATermAppl> t1inds = kb.retrieve(t1eq, kb.getIndividuals()); assertEquals("Individual test should be of type T1. ", Collections.singleton(test), t1inds); }
@Test public void testTransitive() { _kb.addObjectProperty(sibling); _kb.addTransitiveProperty(sibling); // ATermList different = ATermUtils.makeList(new ATermAppl[] { mary, // robert, victor} ); _kb.addIndividual(robert); _kb.addIndividual(mary); _kb.addIndividual(victor); // _kb.addAllDifferent(different); // ATermAppl oneSibling = ATermUtils.makeMax(sibling, 1, // ATermUtils.TOP); final ATermAppl notVictorsSibling = ATermUtils.makeNot(ATermUtils.makeHasValue(sibling, victor)); _kb.addType(robert, notVictorsSibling); _kb.addPropertyValue(sibling, robert, mary); _kb.addPropertyValue(sibling, mary, victor); assertFalse(_kb.isConsistent()); final Set<ATermAppl> explanation = _kb.getExplanationSet(); assertIteratorValues(explanation.iterator(), new Object[] { // ATermUtils.makeAllDifferent(different), ATermUtils.makeTypeAtom(robert, notVictorsSibling), ATermUtils.makeTransitive(sibling), ATermUtils.makePropAtom(sibling, robert, mary), ATermUtils.makePropAtom(sibling, mary, victor), }); }
@Test public void testDisjointPropertiesCache() { // test case for issue #336 to verify AbstractConceptCache.isMergable does // not return incorrect results. final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl p1 = term("p1"); final ATermAppl p2 = term("p2"); final ATermAppl a = term("a"); final ATermAppl b = term("b"); final ATermAppl c = term("c"); kb.addObjectProperty(p1); kb.addObjectProperty(p2); kb.addDisjointProperty(p1, p2); kb.addIndividual(a); kb.addIndividual(b); kb.addIndividual(c); kb.addPropertyValue(p1, a, c); kb.addPropertyValue(p2, b, a); final ATermAppl notp1a = ATermUtils.makeNot(ATermUtils.makeHasValue(p1, a)); // no caching so consistency checking will be used here assertFalse(kb.isType(a, notp1a)); assertTrue(kb.isType(b, notp1a)); // call getInstances so some caching will happen assertEquals(singleton(b), kb.getInstances(notp1a, false)); // now cached _nodes will be used for mergable check assertFalse(kb.isType(a, notp1a)); assertTrue(kb.isType(b, notp1a)); }