JPL architecture & components

The first thing to understand is that JPL has three parts:

  1. C code (in src/c) implementing the bridge between Java and SWI Prolog (as installed in the specific architecture where execution will happen). This code uses the Java Native Interface (JNI) programming framework, and is basically file src/c/jpl.c
  2. Java code (in src/java) implementing the Java-side API interface of JPL to access Prolog. Basically this is a set of objects and methods to use SWI Prolog from Java. For example, objects that represent Prolog atom and terms, and methods to prove a goal and access the solution bindings.
  3. Prolog code (basically implementing the Prolog API for access Java, for example to create an object or call a method of a given object. The reference documentation for the Prolog API can be found here too.

Both the Java and Prolog sources will make use of the C JNI code.

an API between SWI-Prolog and the Java Virtual Machine - hosted on GitHub