public final class QueryResult extends Object
Modifier and Type | Method and Description |
---|---|
String |
getAtomName(String variableId)
Returns the name of the atom instantiated to the variable with the specified id.
|
double |
getDouble(String variableId)
Returns the
double value instantiated to the variable with the specified id. |
long |
getLong(String variableId)
Returns the
long value instantiated to the variable with the specified id. |
Term |
getTerm(String variableId)
Returns the term instantiated to the variable with the specified id.
|
Set<String> |
getVariableIds()
Returns id's of all variables defined in the query this object represents.
|
boolean |
isExhausted()
Returns
true if it is known that all possible solutions have been found, else false . |
boolean |
next()
Attempts to evaluate the query this object represents.
|
public boolean next()
Subsequent calls of the next()
method attempt to reevaluate the query, and because it returns
false
when the are no more results, it can be used in a while
loop to iterate through all the
results.
true
if the query was (re)evaluated successfully or false
if there are no more results.
Once false
has been returned by next()
the next()
method should no longer be called on
that object.ProjogException
- if an error occurs while evaluating the querypublic boolean isExhausted()
true
if it is known that all possible solutions have been found, else false
.true
if it is known that all possible solutions have been found, else false
.Predicate.couldReevaluationSucceed()
public String getAtomName(String variableId)
variableId
- the id of the variable from which to return the instantiated termProjogException
- if no variable with the specified id exists in the query this object represents, or if the
term instantiated to the variable is not an atomgetTerm(String)
public double getDouble(String variableId)
double
value instantiated to the variable with the specified id.variableId
- the id of the variable from which to return the instantiated termProjogException
- if no variable with the specified id exists in the query this object represents, or if the
term instantiated to the variable is not a numbergetTerm(String)
public long getLong(String variableId)
long
value instantiated to the variable with the specified id.variableId
- the id of the variable from which to return the instantiated termProjogException
- if no variable with the specified id exists in the query this object represents, or if the
term instantiated to the variable is not a numbergetTerm(String)
public Term getTerm(String variableId)
next()
must be called before this method.
variableId
- the id of the variable from which to return the instantiated termVariable
of representing the variable if it is uninstantiated)ProjogException
- if no variable with the specified id exists in the query this object representsgetAtomName(String)
,
getDouble(String)
,
getLong(String)
Copyright © 2024. All rights reserved.