Calling a Java method in Etalis

38 views
Skip to first unread message

hayri

unread,
Aug 24, 2010, 6:39:36 AM8/24/10
to ETALIS
Hi,

is it possible to call a java method from the Etalis code or in an
event file? Let's say I fired some events and the generated events are
in the output list. Now, I want to call a java method which receives
the output list (a string) as a parameter and it should extract the
event names and datimes or something similar. Can I do that with
Etalis or do I have to find a solution in Java?

hayri

Paul Fodor

unread,
Aug 24, 2010, 8:51:03 AM8/24/10
to eta...@googlegroups.com
Usually, you do that in Java, but it is possible to call Java from
some of the Prolog interfaces (in particular from InterProlog).
However, I never used InterProlog in that way.
I think it's much simpler the other solution: Java is the language you
use for the highest level of your project, in which you load the
Prolog library (JPL, Inteprolog, PrologBeans), you start one or more
Prolog engines, load Prolog code (in this case Etalis), you compile
your other programs using Prolog methods (compile_event_file/1-2), and
then fire events from Java into Prolog and collect results from the
output arguments.
This is my usual workflow, but other workflow are also possible (for
instance, the one you proposed calling Java from Prolog).
Paul.

hayri

unread,
Aug 24, 2010, 9:04:49 AM8/24/10
to ETALIS
I don't use Interprolog, so I don't know how it works there. I use SWI
with JPL but I couldn't find an explanation or example how one could
call a Java method from Prolog environment. Do you have any references
or examples to this issue?

Paul Fodor

unread,
Aug 24, 2010, 9:21:33 AM8/24/10
to eta...@googlegroups.com
I don't have a simple example for JPL, but please look in the
etalis/www directory in Etalis - there is something there to help you.
I used JPL in a past project for IBM (a Prolog annotator in UIMA) and
it's fine to use with the same workflow I described before (main
project in Java and the Prolog engine as a library).
First of all, please check if you can connect to SWI from InterProlog:
http://www.swi-prolog.org/packages/jpl/java_api/getting_started.html
Paul.
Reply all
Reply to author
Forward
0 new messages