Declarativa
|
|
4 May 2005
How to download and install
Follow the steps below for your system, to install and verify the required
components (Java + Prolog) to use InterProlog.
Step
|
Comments
|
Windows 2000, XP
|
Linux Red Hat 9, Mac OS X
|
1
|
The Java Runtime Environment will be sufficient if you don't plan to
write any Java code AND you're using Windows. Otherwise you need the
Java
Development Kit |
Download J2SE from java.sun.com site, http://java.sun.com/j2se/1.4.2/download.html,
and install it some directory MY_JAVA_DIR in your disk
|
See if it works in a command shell window, by typing
MY_JAVA_DIR\bin\java
-version |
See if it works in a command shell window, by typing
MY_JAVA_DIR/bin/java
-version |
You should obtain something like this:
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
|
Write down (or copy into the clipboard...) the path
MY_JAVA_DIR.....bin,
the directory where the java executable is. We'll use this below to define
the JAVA_BIN environment variable |
|
2
|
You need XSB Prolog installed with its built-in InterProlog support
and/or SWI Prolog |
To get and install XSB Prolog 2.6 with
built-in InterProlog (interfacing through sockets and JNI) support follow these
instructions. XSB Prolog 2.5 is no longer supported, fall back to
InterProlog 2.0.3 if you must use it.
To get and install SWI Prolog (interfacing through sockets, no
JNI) just install the
standard version. |
Write down (or copy into the clipboard...) the paths for the
directories containing the executable images of Prolog. We'll use this below to define the XSB_BIN_DIRECTORY
and SWI_BIN_DIRECTORY environment
variables. These will typically be:
For XSB, MY_XSB_DIR...config.....bin
For SWI, SWI_DIR...bin under Windows, /usr/lib/pl-5.2.13/bin/someMachineDir
under Unix
|
|
3
|
InterProlog is installed by copying a file tree and
editing some environment variables |
Download the InterProlog 2.1.1 zip file from here,
which includes this page, and expand it into somewhere in your disk |
Look into the windowsScripts directory. Edit windowsVariables.bat, changing the variables JAVA_BIN,
XSB_BIN_DIRECTORY and/or SWI_BIN_DIRECTORY to the values you got in the install steps
above
|
Look into the unixScripts directory. Edit
unixVariables.sh, changing the variables JAVA_BIN,
XSB_BIN_DIRECTORY and/or SWI_BIN_DIRECTORY to the values you got in the install steps
above
Mac OS X note: take a look at myMacVariables.sh for inspiration
Make sure the script files are executable:
chmod a+x *.sh
|
That's it :-)
See if it works by running the run....listener.bat scripts
(./run...listener.sh in Unix). A Java window with a Prolog listener should
appear, looking perhaps like this:
If you installed ALL Prologs supported by InterProlog (currently
XSB and SWI), you can optionally run the standard test suite, using
the script testit ; when finished successfully (after about a
couple of minutes in a 400MHz Pentium) the following window will appear:
If things don't go well: first make sure the steps above were done
properly; then open a command shell window, cd to the interprolog21
directly, edit the failing script to include the -debug flag, run it and
email the console log to interprolog@declarativa.pt For
example, to make runSWISPlistener.bat report debugging information edit
the command line to
%JAVA_BIN%\java -classpath %CLASSPATH%;..\interprolog.jar com.declarativa.interprolog.gui.SWISubprocessEngineWindow
-debug
|
|
4
Using it
|
For Prolog development, use runXXXSPListener, which acts as a
simple graphical front-end to the full Prolog system through a
SubprocessEngine (using sockets), allowing you to get
multiple solutions, Prolog textual I/O etc. runNativeListener uses
the JNI interface (currently available only for XSB Prolog), which lacks
the traditional top level Try some Prolog goals, such as browseTerm(vp(np(interprolog),verb(working))),
which should display a tree. You may drag your Prolog source files into the listener
window for consulting, or use the menu "File/Consult" . Edit the files with you favorite editor.
Some documentation:
- Java: Tutorial,
Reference
(your JDK installation may include this)
- Prolog:
- InterProlog: introductory paper,
Java-side API,
Prolog-side predicates, FAQ.
See also the CHANGES.txt file, and comments in sources.
|
Please do provide any feedback to interprolog@declarativa.com. Good luck!
Miguel Calejo
Declarativa
Improvements over version 2.03
- Multiple PROLOG support: XSB Prolog and SWI Prolog
SubprocessEngine is now an abstract class, to accomodate the support of multiple Prolog implementations. The "old" SubprocessEngine is now
XSBSubprocessEngine
- The interprolog.P is gone from com/declarativa/interprolog; each Prolog implementation has its specific file in this directory, typically in a subdirectory, currently
xsb/interprolog.P and swi/interprolog.pl; most of the specific Prolog dependencies are in these files and in PrologImplementationPeer subclasses
- New method
toString(PrologEngine engine) in class TermModel, uses the standard startup (not necessarily current) operator definitions for the engine, rather than the common (engine) subset.
- Functional and other improvements
PrologEngine.consultAbsolute(File) : consults a Prolog file from an absolute path
Another variant of the deterministicGoal method: TermModel deterministicGoal(TermModel G), useful for inter-Prolog goal calling. For example, the following goal (running in any supported Prolog, say
XSB) instantiates a SWI engine and obtains a goal solution for goal G:
javaMessage('com.declarativa.interprolog.SWISubprocessEngine',SWI,'SWISubprocessEngine'),
buildTermModel(G,GM), javaMessage(SWI,SM,deterministicGoal(GM)),
recoverTermModel(SM,Solution), javaMessage(SWI,shutdown).
- More robust PrologEngine.interrupt() handling, by using Prolog throw/catch
- Improved InterProlog debugging information for SubprocessEngines created with the debug
argument true: they now print to System.err ALL Prolog output during startup
- Runtime environment configuration
- Zero-argument Prolog engine constructors, for easier use in some contexts. For a PrologEngine to be instantiated without a constructor argument, a property must be defined in either file
interprolog.defs (a Properties file in the format described in
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html
, in the directory where the jar file containing the InterProlog classes is) or in the global properties (by using the -D java switch). The properties should include XSB_BIN_DIRECTORY and/or SWI_BIN_DIRECTORY, depending on which Prolog(s) you're using
NativeEngine now requires as argument (either explicitly or implicitly through the above Properties mechanism) the path to the XSB binary directory as the constructor argument, rather than the base directory as before, to simplify configuration; notice that this has more information than the base directory, eg for XSB it embbeds the consequence of being in a certain operating system.
- Extra optional constructor argument in
PrologEngine and subclasses, loadFromJar. InterProlog startup files can now be loaded either from the jar file (as before) or from classname-relative locations in the file system: interprolog.P from ...com/declarativa/interprolog/{xsb or swi} and visualization.P from ...com/declarativa/interprolog/gui/ . Loading from the file system can be useful while fiddling with InterProlog itself and testing changes to these files. There's a simple command line argument ("-nojar") that can be used in listener invocation scripts, see
ListenerWindow.commonMain().
Known limitations:
Use at your own risk; bug reports welcome except for the following.
- Object grammar does not support conversion of Java doubles and longs to
Prolog numbers, but it recognizes and
generates them
- See comments in streamcontents/4 in com/declarativa/interprolog/interprolog.P for some limitations
on serialization of complex (e.g. AWT) objects
- Changing the XSB top level prompt (defined in x_interp...) would break communication with
Java
- The javaMessage predicate performs no coercion of basic type arguments
(e.g., if a formal parameter is
long then an actual parameter
with int is not acceptable), only of object
types (e.g. the actual parameter can be a subclass of the formal parameter).
The information and InterProlog software referred in this page are ©
Declarativa/XSB Inc. and are
provided to you under the terms of the GNU
Library License, no warranties, authorship reference mandatory etc. Other
items are © their legitimate owners. For further or
more actual information please contact interprolog@declarativa.com |