public abstract class Query extends Cursor<Solution>
For example, if a Query has an occurrence of a Variable, say, named "X", one can obtain the Term bound to "X" in the solution by looking up "X" in the Map.
Variable x = new Variable("X"); Query q = // obtain Query reference (with x in the Term array) while (q.hasNext()) { Solution solution = q.next(); // make t the Term bound to "X" in the solution Term t = solution.get("X"); // ... }
Constructor and Description |
---|
Query() |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ListMultimap<String,Term> |
allSolutionsMultimap() |
protected Term |
asTerm(String termString) |
protected List<Solution> |
basicAllSolutions()
The default implementation for obtaining all the solutions consists on just making use of the existing next() method
However, children could override this in case many calls to next() are more expensive that obtaining all the results of the query at once (e.g., a findall/3 query in Prolog)
|
Solution |
cachedNext() |
protected void |
errorCheck(Solution solution) |
protected Term |
getAllSolutionsBindingsTerm()
Answers a list term with the form [f(Name,Term), ...]
Where f is an arbitrary functor id, Name is the id of a variable present in the original goal and Term the value bound to such variable.
|
protected abstract Term |
getDefaultSelectedTerm()
The default selected term when select* methods are called without specifying a select term
By default, a PrologEngineQuery uses its goal.
|
abstract Term |
getGoal() |
abstract Jpc |
getJpcContext() |
abstract PrologEngine |
getPrologEngine() |
abstract boolean |
isErrorHandledQuery() |
Cursor<Term> |
select() |
Cursor<Term> |
select(String selector) |
Cursor<Term> |
select(Term selector)
Selects a cursor of terms.
|
<O> Cursor<O> |
selectObject() |
<O> Cursor<O> |
selectObject(String selector) |
<O> Cursor<O> |
selectObject(String selector,
Type targetType) |
<O> Cursor<O> |
selectObject(Term selector) |
<O> Cursor<O> |
selectObject(Term selector,
Type targetType) |
<O> Cursor<O> |
selectObject(Type targetType) |
protected boolean |
shouldVerifySolution() |
abort, adapt, allSolutions, basicAbort, basicClose, basicNext, basicOneSolutionOrThrow, basicSolutionsRange, close, filter, finalize, getState, hasNext, hasSolution, isAbortable, isExhausted, isOpen, isReady, iterativeAllSolutions, next, nonSynchronizedClose, nSolutions, numberOfSolutions, oneSolution, oneSolutionOrThrow, remove, setState, solutionsRange
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public abstract PrologEngine getPrologEngine()
public abstract Term getGoal()
public abstract Jpc getJpcContext()
public abstract boolean isErrorHandledQuery()
protected boolean shouldVerifySolution()
protected void errorCheck(Solution solution)
public Solution cachedNext()
cachedNext
in class Cursor<Solution>
protected List<Solution> basicAllSolutions()
Cursor
basicAllSolutions
in class Cursor<Solution>
protected Term getAllSolutionsBindingsTerm()
public com.google.common.collect.ListMultimap<String,Term> allSolutionsMultimap()
protected abstract Term getDefaultSelectedTerm()
public Cursor<Term> select(Term selector)
selector
- a term with free variablespublic <O> Cursor<O> selectObject()
Copyright © 2014. All rights reserved.