JIP - Java Internet Prolog - By Ugosoft

Presentation

BLUE_THIN_LINE.gif (1434 bytes)

| Home | JIP Console | Built-in | Intelligent Applets | API | Download | License | Contacts |

BLUE_THIN_LINE.gif (1434 bytes)

- Introduction

I think prolog is a very powerful and simple language not enough appreciated by programmers community. So, because Java™ is a beautiful and powerful cross-platform language, I tried to develop a prolog interpreter in Java™ allowing to write prolog programs invoking  Java™ methods and vice versa Java™ applications calling prolog predicates, following a cross-platform phylosophy (without native code).

To know more about prolog see "Prolog Resources"

- JIP Java Internet Prolog

JIP - Java Internet Prolog is a cross-platform PureJava 100% prolog interpreter developed in JDK1.1 (also working in Java 2 Platform) and supporting the prolog Edimburgh syntax. It is compatible with other famous prolog engine (such as LPA, Quintus, SWI, etc.) and can be run by any browser supporting JDK1.1.
JIProlog has an easy-to-use API by which, you can invoke the prolog interpreter in any Java™ applet/application without dealing hard with native code (JNI or RNI/JDirect) and without requiring signed applet (as required by other prolog interpreters written in C/C++). By the API you can invoke the prolog interpreter in your Java™ classes in a very simple way calling your prolog predicates in the same way you call a Java™ method and, vice versa, you can invoke Java™ classes in your prolog code as you call predicates.
JIP allow to extend the set of built-in predicates implementing them in the same way you write Java™ classes. So you can add custom features, such as custom dialogs or custom algorithms, and you can speed up the computation transforming your prolog predicates (defined in your prolog code) in built-in predicates implementing them in a Java™ classes derived from a special BuiltIn class exported by the API (see the sections "How to write a custom Dialog" and "How to write a custom extension class"). Besides, JIP support external database of clauses (i.e. a set of facts not stored in memory but in
in an external device such as JDBC database, text database, and so on). Sometimes when you have a lot of facts related to a single predicate (maybe modified outside the prolog by, for example, a data-entry process or similar) you wish to have them in an external database so you don't have to import them everytime in the prolog database. JIProlog allow you to use such an external database of facts as it is a predicate stored in the prolog memory (see the section "How to write an external database of clauses").

If you want to download and use JIProlog see "License"

- JIP Console applet

JIP Console applet is a complete prolog console for editing, testing and running your prolog code. It is also an example of applet interfacing JIProlog. It has the necessary for editing your prolog code (the JIP edit windows) and for tracing its execution (see the section "How to trace a prolog program")

Before writing your prolog code see the list of built-in predicates currently supported by JIP. 

Try JIP console as an applet in the JIPConsole page, or download a copy to run it off-line as an application (see the section "How to run JIPConsole as an application"). If you run JIP console from internet (as an applet in the web page) you cannot open in the Edit window your local prolog file or save your code on your local machine. This is due to the security limitation imposed by the browser to the applet (browser's sandbox). If you run JIP console as an application you must have the Java™ Development Kit (JDK) 1.1.x/1.2.x or the Java™ Runtime Environment (JRE) 1.1.x/1.2.x installed on your machine (you can download them respectively from http://www.javasoft.com/products/jdk/1.1/ and http://www.javasoft.com/products/jdk/1.1/jre/index.html)

- JIProlog application

JIProlog is a prolog interpreter to run your prolog code as a "stand-alone" application without an external Java™ applet/application. In other words you can write your program entirely in prolog (eventually using your dialogs or classes extensions) and run it as a "stand-alone" application. Only you must define in your prolog program the predicate main/0 that is the entry point predicate that will be called by the interpreter when it will start.
JIProlog application is in the JIP package and can be downloaded at download page. To run it (see the section "
How to run your prolog code as a "stand alone" application using JIProlog interpreter") you must have the Java™ Development Kit (JDK) 1.1.x/1.2.x or the Java™ Runtime Environment (JRE) 1.1.x/1.2.x installed on your machine (you can download them respectively from http://www.javasoft.com/products/jdk/1.1/ and http://www.javasoft.com/products/jdk/1.1/jre/index.html)

- Prolog Engine

The prolog engine is based on an ASM (Abstract Syntax Machine) implemented using a LISP-like depth-first search. It is composed by a very complex hierarchy of Java™ classes implementing the ASM with typical prolog heuristic (such as backtracking, cutting mechanisms, etc. ) a manager for built-in predicates, the parser for prolog language and so on. It also implements a mechanism to call prolog predicates form any Java™ classes and vice versa to invoke Java™ classes from your prolog code.

- API

The main class of the API is JIPEngine. It exports the methods to initialize the prolog interpreter, its database of clauses and other needed structures, to submit a prolog query written as a string, to set input and output stream and so on.
JIPTerm is a wrapper to a prolog term and exports the methods to manipulate any prolog term, such as type checking (isVariable, isList, etc.),  to create a prolog term from a string (parseTerm) and so on. It also is the base class for the other wrappers: JIPFunctor, JIPList, JIPAtom, JIPClause, JIPVariable and JIPNumber. There are other classes and interfaces to deal with event raised by JIP, such as event classes and listeners (JIPEvent, JIPTraceEvent, JIPErrorEvent, JIPEventListener, JIPTraceListener, JIPErrorListener). Besides the API supply two interfaces JIPDialog and JIPXCall to make custom Java™ dialogs and classes callable from prolog by the predicates wdialog/3 and xcall/3
(see the sections "How to write a custom Dialog" and "How to write a custom extension class") and two abstract classes JIPClausesDatabase and JIPClausesEnumeration to implement custom external databases of clauses (see the section "How to write an external database of clauses").

JIPConsole.java and HanoiApplet.java are two examples to see how to write applets using the JIProlog API.

- Versions

The last beta release is the version 4.0.2. It is the Release Candidate 1. The version number is composed by three number: Major, Minor, Bug Fixed. The first one is related to enhancement of the Prolog Engine and API, the second concern to built-in predicates, and the third is a bug fixed version.

- Compatibility

JIProlog has been successfully tested on the following platforms: JDK1.1.3, JDK1.1.8, JRE1.1.8, Java 2 Platform 1.2.2, Internet Explorer 5.0, Netscape Navigator 4.5. If you are using another platform and you discoverd any bug, please don't hesitate to send me an e-mail to jiprolog@yahoo.com or fill and submit the feedback form.

- Future plans

In the future plans I'll extend JIP supporting XML syntax. At the same time I'm writing other prolog built-in predicates that still are missed in order to conform JIP to other prolog environment. 

- Notes:

The last released version is 4.0.2. See the updated list of the built-in predicates currently implemented.

- Contacts

If you discover any bug or you have some questions or want some explanations about JIP, please don't hesitate to send me an e-mail to jiprolog@yahoo.com or fill and submit the feedback form.

Thanks for your interest in JIP.

The Author:

Ugo Chirico
email: ugos@geocities.com
home page: http://www.geocities.com/ugosoft

Updated: 21/01/01

BLUE_THIN_LINE.gif (1434 bytes)

| Home | JIP Console | Built-in | Intelligent Applets | API | Download | License | Contacts |
| Sign Guestbook | View Guestbook |

BLUE_THIN_LINE.gif (1434 bytes)

Copyright © Ugo Chirico

This page hosted by Get your own Free Home Page