se.sics.prologbeans
Class QueryAnswer
java.lang.Object
|
+--se.sics.prologbeans.Bindings
|
+--se.sics.prologbeans.QueryAnswer
- public class QueryAnswer
- extends Bindings
QueryAnswer
is the Java representation of an answer
from the Prolog server. The QueryAnswer
is returned by
PrologSession
in response to a query
and contains variable bindings, errors, and success/failure
information. It also contains the variable bindings specified in
the query.
Constructor Summary |
QueryAnswer(Term answer,
Bindings bindings)
Creates a new QueryAnswer instance with the
specified information. |
Method Summary |
java.lang.String |
getError()
Returns the error reason or null if an error has not
occurred or if no error reason is known. |
Term |
getValue(java.lang.String variable)
Returns the value of the specified variable or null
if the variable is not bound. |
boolean |
isError()
Returns true if an error occurred while processing
the query and false otherwise. |
boolean |
queryFailed()
Returns true if the query failed (i.e. |
java.lang.String |
toString()
Returns a string description of this answer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
QueryAnswer
public QueryAnswer(Term answer,
Bindings bindings)
- Creates a new
QueryAnswer
instance with the
specified information.
- Parameters:
answer
- a Term
value representing the Prolog responsebindings
- the variable bindings for the query to which this
is an answer
getValue
public Term getValue(java.lang.String variable)
- Returns the value of the specified variable or
null
if the variable is not bound.
- Overrides:
getValue
in class Bindings
- Parameters:
variable
- the name of the variable- Returns:
- the value of the variable as a
Term
or
null
if the variable is not bound
queryFailed
public boolean queryFailed()
- Returns
true
if the query failed (i.e. the Prolog
responded with 'no') and false
otherwise.
isError
public boolean isError()
- Returns
true
if an error occurred while processing
the query and false
otherwise.
getError
public java.lang.String getError()
- Returns the error reason or
null
if an error has not
occurred or if no error reason is known.
toString
public java.lang.String toString()
- Returns a string description of this answer.
- Overrides:
toString
in class Bindings