QueryAnswer
is the .NET
representation of an answer from the Prolog server. The
QueryAnswer
is returned by
null
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(PBTerm answer, Bindings bindings)
Creates a new QueryAnswer instance with the specified
information. |
Method Summary | |
---|---|
public PBTerm |
getValue(string variable)
Returns the value of the specified variable or null if the
variable is not bound. |
public bool |
queryFailed()
Returns true if the query failed (i.e. the Prolog responded
with 'no') and false otherwise. |
public bool |
isError()
Returns true if an error occurred while processing the query
and false otherwise. |
public string |
getError()
Returns the error reason or null if an error has not
occurred or if no error reason is known. |
public string |
toString()
Returns a string description of this answer. |
Constructor Detail |
---|
QueryAnswer(PBTerm answer, Bindings bindings)
QueryAnswer
instance with the specified
information.
answer
- a {@link se.sics.prologbeans.PBTerm} value representing the
Prolog responsebindings
- the variable bindings for the query to which this is an answerMethod Detail |
---|
public PBTerm getValue(string variable)
null
if the
variable is not bound.
variable
- the name of the variablenull
if the variable is not boundpublic bool queryFailed()
true
if the query failed (i.e. the Prolog responded
with 'no') and false
otherwise.
public bool isError()
true
if an error occurred while processing the query
and false
otherwise.
public string getError()
null
if an error has not
occurred or if no error reason is known.
public string toString()