Re: A few JPL (Java <-> Prolog interface) questions



On 2005-04-16, Eddie Jobson <mirrormaze@xxxxxxxxx> wrote:
> 1) Is it possible to shut down and restart the JPL engine (in order to
> clear the database) without closing the application which is currently
> using it? I've tried without success JPL.halt()...

The C-interface defines PL_cleanup(). It is generally slow and
cooperation with many (foreign) library is incomplete. For JPL it would
also destroy the JPL interface :-) Why not simply use retractall/1 to
delete data you no longer want?

> 2) Is it possible to catch the Prolog output produced by JPL and pass
> it to the application (in order to create, for instance, a log window)

Not through JPL as far as I know. SWI-Prolog streams can be associated
to arbitrary objects, which is used by XPCE to bind them to various
objects that handle text. To get this in JPL, I guess JPL has to be
extended to deal with SWI-Prolog streams.

Alternatively, use the print_message/2 for printing messages (all Prolog
messages are printed this way) and define message_hook/3 to redirect them
to a window.

Cheers --- Jan
.