public static ATermAppl and(final ATermAppl c1, final ATermAppl c2) { return ATermUtils.makeAnd(c1, c2); }
public static ATermAppl and(final ATermAppl c1, final ATermAppl c2) { return ATermUtils.makeAnd(c1, c2); }
public static ATermAppl and(final ATermAppl... c) { if (c.length == 1) return c[0]; return ATermUtils.makeAnd(ATermUtils.makeList(c)); }
public static ATermAppl and(final ATermAppl... c) { if (c.length == 1) return c[0]; return ATermUtils.makeAnd(ATermUtils.makeList(c)); }
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); }
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); }
final static public ATermAppl makeAnd(final ATerm c1, final ATerm c2) { return makeAnd(makeList(c2).insert(c1)); }
final static public ATermAppl makeAnd(final ATerm c1, final ATerm c2) { return makeAnd(makeList(c2).insert(c1)); }
final static public ATermAppl makeExactCard(final ATerm r, final ATermInt n, final ATerm c) { final ATermAppl max = makeMax(r, n, c); if (n.getInt() == 0) return max; final ATermAppl min = makeMin(r, n, c); return makeAnd(min, max); }
final static public ATermAppl makeExactCard(final ATerm r, final ATermInt n, final ATerm c) { final ATermAppl max = makeMax(r, n, c); if (n.getInt() == 0) return max; final ATermAppl min = makeMin(r, n, c); return makeAnd(min, max); }
@Override public void visit(final OWLObjectIntersectionOf and) { final Set<OWLClassExpression> operands = asSet(and.operands()); final ATerm[] terms = new ATerm[operands.size()]; int size = 0; for (final OWLClassExpression desc : operands) { desc.accept(this); terms[size++] = _term; } // create a sorted set of terms so we will have a stable // concept creation and removal using this concept will work final ATermList setOfTerms = size > 0 ? ATermUtils.toSet(terms, size) : ATermUtils.EMPTY_LIST; _term = ATermUtils.makeAnd(setOfTerms); }
@Override public void visit(final OWLDataIntersectionOf and) { final Set<OWLDataRange> operands = asSet(and.operands()); final ATerm[] terms = new ATerm[operands.size()]; int size = 0; for (final OWLDataRange desc : operands) { desc.accept(this); terms[size++] = _term; } // create a sorted set of terms so we will have a stable // concept creation and removal using this concept will work final ATermList setOfTerms = size > 0 ? ATermUtils.toSet(terms, size) : ATermUtils.EMPTY_LIST; _term = ATermUtils.makeAnd(setOfTerms); }
@Override public void visit(final OWLObjectIntersectionOf and) { final Set<OWLClassExpression> operands = asSet(and.operands()); final ATerm[] terms = new ATerm[operands.size()]; int size = 0; for (final OWLClassExpression desc : operands) { desc.accept(this); terms[size++] = _term; } // create a sorted set of terms so we will have a stable // concept creation and removal using this concept will work final ATermList setOfTerms = size > 0 ? ATermUtils.toSet(terms, size) : ATermUtils.EMPTY_LIST; _term = ATermUtils.makeAnd(setOfTerms); }
@Override public Iterator<?> valueIterator(final Collection<ATermAppl> dataranges) throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl and = ATermUtils.makeAnd(ATermUtils.makeList(dataranges)); final ATermAppl dnf = DNF.dnf(expander.expand(and, namedDataRanges)); if (ATermUtils.isOr(dnf)) { final List<DataRange<?>> disjuncts = new ArrayList<>(); for (ATermList l = (ATermList) dnf.getArgument(0); !l.isEmpty(); l = l.getNext()) disjuncts.add(normalizeVarRanges((ATermAppl) l.getFirst())); return getDisjunction(disjuncts).valueIterator(); } else return normalizeVarRanges(dnf).valueIterator(); }
@Override public Iterator<?> valueIterator(final Collection<ATermAppl> dataranges) throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl and = ATermUtils.makeAnd(ATermUtils.makeList(dataranges)); final ATermAppl dnf = DNF.dnf(expander.expand(and, namedDataRanges)); if (ATermUtils.isOr(dnf)) { final List<DataRange<?>> disjuncts = new ArrayList<>(); for (ATermList l = (ATermList) dnf.getArgument(0); !l.isEmpty(); l = l.getNext()) disjuncts.add(normalizeVarRanges((ATermAppl) l.getFirst())); return getDisjunction(disjuncts).valueIterator(); } else return normalizeVarRanges(dnf).valueIterator(); }
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; }
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; }
@Test public void testBottomSatisfiable() { _kb.addClass(human); explainEntailment(!_kb.isSatisfiable(ATermUtils.makeAnd(ATermUtils.makeNot(human), ATermUtils.BOTTOM))); }
@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()); }
private ATermAppl canonicalize(final ATermAppl term) { if (ATermUtils.isAnd(term) || ATermUtils.isOr(term)) { final List<ATermAppl> list = new ArrayList<>(); for (ATermList l = (ATermList) term.getArgument(0); !l.isEmpty(); l = l.getNext()) list.add(canonicalize((ATermAppl) l.getFirst())); final ATermList args = ATermUtils.toSet(list); if (ATermUtils.isAnd(term)) return ATermUtils.makeAnd(args); else return ATermUtils.makeOr(args); } else return term; }