private static ATermAppl makeAnon(final int id) { return ATermUtils.makeTermAppl(ANON + id); } }
private boolean absorbVII(final Set<ATermAppl> set) { ATermList list = ATermUtils.makeList(set); final ATermAppl sub = ATermUtils.nnf((ATermAppl) list.getFirst()); list = list.getNext(); ATermAppl sup = list.isEmpty() ? ATermUtils.makeNot(sub) : ATermUtils.makeNot(ATermUtils.makeAnd(list)); sup = ATermUtils.nnf(sup); final ATermAppl subClassAxiom = ATermUtils.makeSub(sub, sup); _subLogger.fine(() -> "GCI: " + subClassAxiom + "\nexplanation: " + _explanation); addDef(subClassAxiom); _tbox.addAxiomExplanation(subClassAxiom, _explanation); return true; }
public static ATermAppl some(final ATermAppl r, final ATermAppl c) { return ATermUtils.makeSomeValues(r, c); }
@Override public String toString() { return ATermUtils.toString(ATermUtils.makeTermAppl(_name)) + Arrays.toString(_args); } }
@Test public void testIsClass3() { final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl l1 = ATermUtils.makeTermAppl("l1"); final ATermAppl l2 = ATermUtils.makeTermAppl("l2"); final ATermAppl v1 = ATermUtils.makeValue(ATermUtils.makeLiteral(l1)); final ATermAppl v2 = ATermUtils.makeValue(ATermUtils.makeLiteral(l2)); final ATermAppl t = ATermUtils.makeOr(v1, v2); assertFalse(kb.isClass(t)); }
@Test public void testIsClass1() { final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl p = term("p"); final ATermAppl l = ATermUtils.makeTermAppl("l"); final ATermAppl v = ATermUtils.makeValue(ATermUtils.makeLiteral(l)); final ATermAppl c = ATermUtils.makeSomeValues(p, v); kb.addProperty(p); assertTrue(kb.isClass(c)); }
@Test public void testIsClass4() { final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl l = ATermUtils.makeTermAppl("l"); final ATermAppl v = ATermUtils.makeValue(ATermUtils.makeLiteral(l)); final ATermAppl n = ATermUtils.makeNot(v); assertFalse(kb.isClass(n)); }
private static void addTo(final Map<ATermAppl, ATermAppl> map, final ATermAppl roleName, final Set<ATermAppl> asserted) { if (asserted.isEmpty()) return; ATermAppl range = null; if (asserted.size() == 1) range = asserted.iterator().next(); else range = ATermUtils.makeAnd(ATermUtils.toSet(asserted)); range = ELSyntaxUtils.simplify(ATermUtils.nnf(range)); map.put(roleName, range); }
public boolean isBnode() { return ATermUtils.isBnode(_name); }
@Override public String toString() { return ATermUtils.toString(_type) + "(" + _subject + ")"; } }
@Test public void testIsClass2() { final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl l = ATermUtils.makeTermAppl("l"); final ATermAppl v = ATermUtils.makeValue(ATermUtils.makeLiteral(l)); assertFalse(kb.isClass(v)); }
@Test public void assertedAxioms() { classes(_A, _B, _C, _D); final ATermAppl axiom = makeSub(makeAnd(_A, _B), makeNot(_B)); tbox.addAxiom(axiom); prepareTBox(); assertTrue(tbox.getAxioms().size() > 1); assertTrue(tbox.getAxioms().contains(axiom)); assertEquals(Collections.singleton(axiom), tbox.getAssertedAxioms()); }
public static ATermAppl inv(final ATermAppl r) { return ATermUtils.makeInv(r); }
private void absorbSubClass(final ATermAppl sub, final ATermAppl sup, final Set<ATermAppl> explanation) { _logger.fine(() -> "Absorb: subClassOf(" + ATermUtils.toString(sub) + ", " + ATermUtils.toString(sup) + ")"); final Set<ATermAppl> terms = SetUtils.create(); terms.add(nnf(sub)); terms.add(nnf(negate(sup))); absorbAxiom(terms, SetUtils.create(explanation)); }
/** * Create a negated term. * * @param c Term to be negated * @return an ATermAppl in the form not(c) */ public static ATermAppl not(final ATermAppl c) { return ATermUtils.makeNot(c); }