Class DefaultConjunctiveQuery
java.lang.Object
fr.lirmm.graphik.integraal.core.DefaultConjunctiveQuery
- All Implemented Interfaces:
ConjunctiveQuery, Query, CloseableIterable<Atom>, CloseableIterableWithoutException<Atom>, Iterable<Atom>
Class representing a conjunctive query. A conjunctive query is composed of a
fact and a set of answer variables.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty conjunctive query.Creates a copy of the specified conjunctive query.DefaultConjunctiveQuery(InMemoryAtomSet atomSet) Creates a conjunctive query whose answer variables are the variables of the atom set.DefaultConjunctiveQuery(InMemoryAtomSet atomSet, List<Term> ans) Creates a conjunctive query with the specified body and answer variables.DefaultConjunctiveQuery(CloseableIterator<Atom> atomSet, CloseableIterator<Term> answerVariables) Creates a conjunctive query from iterators over atoms and answer variables.DefaultConjunctiveQuery(CloseableIteratorWithoutException<Atom> atomSet, CloseableIteratorWithoutException<Term> answerVariables) Creates a conjunctive query from closeable iterators that do not throw checked exceptions.DefaultConjunctiveQuery(String label, InMemoryAtomSet atomSet, List<Term> ans) Creates a labeled conjunctive query. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanequals(ConjunctiveQuery other) Compares this query with another one by body and answer variables.booleanReturns the answer variables of the query.Returns the fact of the query.getLabel()The label (the name) for this query.booleanReturns whether the query expects a boolean answer.iterator()Return an iterator over the atoms conjunction of the query.voidReplaces the answer variables.voidsetAtomSet(InMemoryAtomSet atomSet) Replaces the query body.voidSets the query label.toString()Methods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
DefaultConjunctiveQuery
public DefaultConjunctiveQuery()Creates an empty conjunctive query. -
DefaultConjunctiveQuery
Creates a conjunctive query whose answer variables are the variables of the atom set.- Parameters:
atomSet- the atom set forming the query body
-
DefaultConjunctiveQuery
Creates a conjunctive query with the specified body and answer variables.- Parameters:
atomSet- the atom set forming the query bodyans- the answer variables
-
DefaultConjunctiveQuery
public DefaultConjunctiveQuery(CloseableIterator<Atom> atomSet, CloseableIterator<Term> answerVariables) throws IteratorException Creates a conjunctive query from iterators over atoms and answer variables.- Parameters:
atomSet- the atom iterator forming the query bodyanswerVariables- the answer-variable iterator- Throws:
IteratorException- if reading either iterator fails
-
DefaultConjunctiveQuery
public DefaultConjunctiveQuery(CloseableIteratorWithoutException<Atom> atomSet, CloseableIteratorWithoutException<Term> answerVariables) Creates a conjunctive query from closeable iterators that do not throw checked exceptions.- Parameters:
atomSet- the atom iterator forming the query bodyanswerVariables- the answer-variable iterator
-
DefaultConjunctiveQuery
Creates a labeled conjunctive query.- Parameters:
label- the name of this queryatomSet- the conjunction of atoms representing the queryans- the list of answer variables
-
DefaultConjunctiveQuery
Creates a copy of the specified conjunctive query.- Parameters:
query- the query to copy
-
-
Method Details
-
getLabel
Description copied from interface:ConjunctiveQueryThe label (the name) for this query.- Specified by:
getLabelin interfaceConjunctiveQuery- Specified by:
getLabelin interfaceQuery- Returns:
- the label of this query.
-
setLabel
-
getAtomSet
Returns the fact of the query.- Specified by:
getAtomSetin interfaceConjunctiveQuery- Returns:
- an atom set representing the atom conjunction of the query.
-
setAtomSet
Replaces the query body.- Parameters:
atomSet- the new query body
-
getAnswerVariables
Returns the answer variables of the query.- Specified by:
getAnswerVariablesin interfaceConjunctiveQuery- Returns:
- an Collection of Term representing the answer variables.
-
setAnswerVariables
Replaces the answer variables.- Specified by:
setAnswerVariablesin interfaceConjunctiveQuery- Parameters:
v- the new answer variables
-
isBoolean
-
iterator
Description copied from interface:ConjunctiveQueryReturn an iterator over the atoms conjunction of the query.- Specified by:
iteratorin interfaceCloseableIterable<Atom>- Specified by:
iteratorin interfaceCloseableIterableWithoutException<Atom>- Specified by:
iteratorin interfaceConjunctiveQuery- Specified by:
iteratorin interfaceIterable<Atom>- Returns:
- the iterator over the elements
-
toString
-
appendTo
-
equals
-
equals
Compares this query with another one by body and answer variables.- Parameters:
other- the query to compare with- Returns:
- true if both queries are equivalent
-