@Override public InMemoryAtomSet create(InMemoryAtomSet src) { try { return create((AtomSet) src); } catch (IteratorException e) { throw new Error("Should never happen"); } }
@Override public InMemoryAtomSet create(Atom... atoms) { InMemoryAtomSet atomset = this.create(); for (Atom a : atoms) { atomset.add(a); } return atomset; }
public DefaultConjunctiveQuery() { this.label = ""; this.atomSet = DefaultAtomSetFactory.instance().create(); this.responseVariables = new LinkedList<Term>(); }
private static List<InMemoryAtomSet> deepCopy(List<InMemoryAtomSet> sets) { List<InMemoryAtomSet> negParts = new LinkedList<InMemoryAtomSet>(); for(InMemoryAtomSet set : sets) { negParts.add(DefaultAtomSetFactory.instance().create(set)); } return negParts; }
@Override public InMemoryAtomSet createImageOf(InMemoryAtomSet src) { InMemoryAtomSet dest = DefaultAtomSetFactory.instance().create(); this.apply(src, dest); return dest; }
public DefaultConjunctiveQuery(CloseableIterator<Atom> atomSet, CloseableIterator<Term> answerVariables) throws IteratorException { this.label = ""; this.atomSet = DefaultAtomSetFactory.instance().create(atomSet); this.responseVariables = new LinkedList<Term>(); while (answerVariables.hasNext()) { this.responseVariables.add(answerVariables.next()); } }
public DefaultConjunctiveQuery(CloseableIteratorWithoutException<Atom> atomSet, CloseableIteratorWithoutException<Term> answerVariables) { this.label = ""; this.atomSet = DefaultAtomSetFactory.instance().create(atomSet); this.responseVariables = new LinkedList<Term>(); while (answerVariables.hasNext()) { this.responseVariables.add(answerVariables.next()); } }
@Override public InMemoryAtomSet createImageOf(AtomSet src) throws AtomSetException { InMemoryAtomSet dest = DefaultAtomSetFactory.instance().create(); this.apply(src, dest); return dest; }
@Override public InMemoryAtomSet create(CloseableIteratorWithoutException<Atom> atoms) { InMemoryAtomSet atomset = this.create(); while(atoms.hasNext()) { atomset.add(atoms.next()); } return atomset; }
@Override public InMemoryAtomSet create(CloseableIterator<Atom> atoms) throws IteratorException { InMemoryAtomSet atomset = this.create(); while(atoms.hasNext()) { atomset.add(atoms.next()); } return atomset; }
public DefaultConjunctiveQuery(ConjunctiveQuery query) { this.label = query.getLabel(); this.atomSet = DefaultAtomSetFactory.instance().create(query.getAtomSet()); this.responseVariables = new LinkedList<Term>(query.getAnswerVariables()); }
@Override public InMemoryAtomSet create(AtomSet src) throws IteratorException { InMemoryAtomSet atomset = this.create(); CloseableIterator<Atom> it = src.iterator(); while(it.hasNext()) { Atom a = it.next(); atomset.add(a); } return atomset; }
public DefaultConjunctiveQueryWithNegatedParts(ConjunctiveQueryWithNegatedParts query) { this(query.getLabel(), DefaultAtomSetFactory.instance().create(query.getPositivePart()), deepCopy(query.getNegatedParts()), new LinkedList<Term>(query.getAnswerVariables())); }
public static InMemoryAtomSet minus(InMemoryAtomSet a1, InMemoryAtomSet a2) { InMemoryAtomSet atomset = DefaultAtomSetFactory.instance().create(); CloseableIteratorWithoutException<Atom> it = a1.iterator(); while (it.hasNext()) { Atom a = it.next(); if (!a2.contains(a)) { atomset.add(a); } } return atomset; }
public static InMemoryAtomSet union(InMemoryAtomSet a1, InMemoryAtomSet a2) { InMemoryAtomSet atomset = DefaultAtomSetFactory.instance().create(); CloseableIteratorWithoutException<Atom> it = a1.iterator(); while (it.hasNext()) { Atom a = it.next(); atomset.add(new DefaultAtom(a)); } it = a2.iterator(); while (it.hasNext()) { Atom a = it.next(); if (!atomset.contains(a)) { atomset.add(new DefaultAtom(a)); } } return atomset; }