se.sics.prologbeans
Class QueryAnswer


QueryAnswer is the .NET representation of an answer from the Prolog server. The QueryAnswer is returned by 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

QueryAnswer(PBTerm answer, Bindings bindings)
Creates a new QueryAnswer instance with the specified information.

Parameters:
answer - a Term value representing the Prolog response
bindings - the variable bindings for the query to which this is an answer

 
Method Detail

getValue

public PBTerm getValue(string variable)
Returns the value of the specified variable or null if the variable is not bound.

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 bool queryFailed()
Returns true if the query failed (i.e. the Prolog responded with 'no') and false otherwise.


isError

public bool isError()
Returns true if an error occurred while processing the query and false otherwise.


getError

public string getError()
Returns the error reason or null if an error has not occurred or if no error reason is known.


toString

public string toString()
Returns a string description of this answer.