Skip to content
Sebastian Sardina edited this page Oct 4, 2018 · 30 revisions

JPL 7.4+ - Java - SWI Prolog Interface

WHAT IS JPL?

JPL is a "library using the SWI-Prolog foreign interface and the Java jni interface providing a bidirectional interface between Java and Prolog that can be used to embed Prolog in Java as well as for embedding Java in Prolog. In both setups it provides a reentrant bidirectional interface."

As far as I can tell, JPL has been developed originally by Paul Singleton and maintained by him and Jan Wielemaker (and possibly others?).

JPL has been integrated into the full SWI-Prolog distribution starting with version 5.4.x, including binaries for MS-Windows and a Linux RPM.

There was an initial JPL 3.x, now discontinued, which then evolved into the current JPL 7.4.

The objectives of JPL are to:

  • enable Prolog applications to exploit any Java classes, instances, methods etc. (without requiring any wrappers, metadata etc. to be set up first);
  • enable Java applications to manipulate any Standard Prolog libraries, predicates, etc. (without requiring any wrappers, metadata etc. to be set up first);
  • enable hybrid Prolog+Java applications to be designed and implemented so as to take best advantage of both language systems, and to be testable, debuggable, maintainable.

Important Links

WHY THIS FORK THEN?

I have forked the main JPL Github repo mainly for two reasons:

  1. To fix issue #9 that preclude Java to perform queries on specific SWI modules.
  • This issue has been resoled and merged into the master branch of JPL in pull request #10 and hopefully will be available in SWI 7.7.X release.
  1. To expose JPL repo as a Maven repo, so it can be obtained automatically as a dependency via JitPack.

More generally, I am using SWI+JPL to provide Prolog knowledgebase management to SARL agent systems. To do so, I have developed a SARL Capacity and Skill SARL-PROLOG-CAP that SARL agents can use to access SWI Prolog knowledgbases.

One example of such use is the SARL Agent System to play the 2017 Multi-Agent Agents in City game. A base sytem, showcasing how to use SWI Prolog via JPL, can be obtained in this repo.