JPL - Release notes - 3.0.0

This release is a work-in-progress, and is being made available only to a few enthusiasts who don’t mind the likelihood that the API will change before 3.x becomes stable.

Java API: new Variable semantics

Java API: easier Term and Query construction

Now that Variables are named, and bindings are keyed by the names of variables, it is easier to construct Term (and hence Query) instances.

This utility (NB liable to be renamed or moved into a different class) converts a valid Prolog source text representation of a term into a corresponding Term hierarchy:

Term jpl.Util.textToTerm( String sourcetext)

A new (in JPL 3.0.0) Query constructor

Query( String sourcetext)

allows queries to be created from source text, e.g.

new Query("findall(_A,current_atom(_A),_As),length(_As,N)")

and oneSolution(), allSolutions() and nextSolution() will return bindings of N (but not of the dont-tell-me variables _A and _As), e.g.


returns a jpl.Integer representing the Prolog integer value to which N was bound by the successful call of the query.

Java API: deprecated methods


use Query.hasSolution() instead


use Query.close() instead

Java API: fixes

array methods inherited from java.lang.Object are now callable, e.g.

jpl_new(array(int), [4,5,6], A),
jpl_call(A, hashCode, [], H).

Java API: planned or under consideration

drop Term.display(), which cutely displays any Term in a Swing tree view in a new window.

support non-virtual method calls, e.g. by

jpl_call(+Obj, +Class:Method, +Args, -Result)

finish the current tidy-up

passing (or returning) Prolog terms to Java by reference; we might stash them in Prolog’s recorded database (see PL_record in the SWI-Prolog Reference Manual), and return an instance of some yet-to-be-designed JPL class which erases the recorded term when the referring object is garbage-collected

convenience constructs in Prolog akin to import in Java, allowing us to write e.g.

jpl_new('Timestamp', X, R)

when we mean

jpl_new('javax.sql.Timestamp', X, R)

renaming the package jpl more globally: unfortunately, org.jpl has already been taken :-)

ditching jpl.Util and moving its (static, utility) methods into jpl.JPL

deprecate all .args(), .arg0(), .arg1() methods and replace with

public final Term[] args;

require any Variable’s name to conform to Prolog source syntax, so that valid source texts can be reconstructed from Term instances by the toString() methods

Paul Singleton

Wednesday 4th February 2004

JPL - Release notes - 3.0.0