10.28.5 Java Client Interface

The Java interface is centered around the class PrologSession, which represents a connection (or session) to a Prolog server. PrologSession contains static methods for looking up named PrologSession instances using JNDI (Java Naming and Directory Interface) as well as methods for querying the Prolog server. Other important classes are: QueryAnswer, which contains the answer for a query sent to the Prolog server; PBTerm, which represents a Prolog term; and Bindings, which supports stuffing of variable values used in queries.

General information about Java, Servlets and JNDI is available at the Java Technology site: http://java.sun.com/

A brief description of the provided Java classes are presented below. More information about the Java APIs is available in the JavaDoc files on the page http://sicstus.sics.se/documentation.html.


The PrologSession object is the connection to the Prolog server. The constructor PrologSession() creates a PrologSession with the default settings (host = localhost, port = 8066.


The QueryAnswer contains the answer (new bindings) for a query (or the error that occurred during the query process).


The PBTerm object is for representing parsed Prolog terms.


Bindings is used for binding variables to values in a query sent to the Prolog. The values will be automatically stuffed before they are sent to the Prolog server.

Send feedback on this subject.