For Programmers: Free Programming Magazines  


Home > Archive > Prolog > April 2005 > how to join java and prolog.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to join java and prolog.
kks

2005-04-08, 3:58 am

hi,

i have to write a program which need to call prolog from java and then
return query result from prolog to java.
i am a beginner of prolog and know only basic of prolog.
for my case, now , i am trying to use JPL , SWI prolog and for java
site, i use JBuilder6.

i cannot find the latest version of JPL ( get only JPL 1.0.0.1)and i
cannot find any examples and can't join java and prolog via JPL.


is there some example showing step by step for both java and prolog
sites.
is there any tools ( interface) simpler than JPL.

SWI prolog can run as background?

pls, help me out!

sincerely,

kks

JohnCreighton_@hotmail.com

2005-04-08, 3:58 am

I don't know prolog but I recall in java there was a way to call
functions form external languages. Perhaps it would have been good to
cross post to the Java goup. I also saw a papper on javalog.

Where is what a google search brings up.
http://www.google.ca/search?hl=en&q=javalog&meta=

gorans@students.cs.mu.oz.au

2005-04-08, 8:58 am

You could possibly use the Runtime library and call the prologue file
externally, then capture the output through a stream.

I don't know if it will work, but it is an option: eg

Process proc = Runtime.getRuntime().exec("pl args file.pl");
DataInputStream result = new DataInputStream(prog.getInputStream())

So look at prolog "saved state" which allows you to run prologue file
as app rather than through the interpreter.

You can then capture the output and use it as you like.

hope it helps, i'm no expert, but it is a way you could look into that
shouldn't be too hard.

Djamé Seddah

2005-04-08, 8:58 am

kks a écrit :
> hi,
>
> i have to write a program which need to call prolog from java and then
> return query result from prolog to java.
> i am a beginner of prolog and know only basic of prolog.
> for my case, now , i am trying to use JPL , SWI prolog and for java
> site, i use JBuilder6.
>
> i cannot find the latest version of JPL ( get only JPL 1.0.0.1)and i
> cannot find any examples and can't join java and prolog via JPL.
>
>
> is there some example showing step by step for both java and prolog
> sites.
> is there any tools ( interface) simpler than JPL.
>
> SWI prolog can run as background?
>
> pls, help me out!
>
> sincerely,
>
> kks
>


you have to get the source of swi, inside the source of jpl lib, there's
a lot of examples for both side (java in prolog, and prolog in java)
have a look to this link
it may be usefull
http://groups.google.fr/groups?hl=f...btnG=Rechercher
Neng-Fa Zhou

2005-04-08, 4:00 pm

JPL is quite simple. You can find many examples in the directory
examples/java_interface in the B-Prolog package (for Windows). I guess these
examples also run with SWI and K-Prolog (you need to change the package
name).

Neng-Fa Zhou


"kks" <khinsu@karate.com> wrote in message
news:1112934664.828092.89190@f14g2000cwb.googlegroups.com...
> hi,
>
> i have to write a program which need to call prolog from java and then
> return query result from prolog to java.
> i am a beginner of prolog and know only basic of prolog.
> for my case, now , i am trying to use JPL , SWI prolog and for java
> site, i use JBuilder6.
>
> i cannot find the latest version of JPL ( get only JPL 1.0.0.1)and i
> cannot find any examples and can't join java and prolog via JPL.
>
>
> is there some example showing step by step for both java and prolog
> sites.
> is there any tools ( interface) simpler than JPL.
>
> SWI prolog can run as background?
>
> pls, help me out!
>
> sincerely,
>
> kks
>


ptarau@yahoo.com

2005-04-08, 8:58 pm

You might want to try out Jinni 2005 - a pure Java-based Prolog
compiler that allows to easily intermix Java Prolog code using Java's
reflection, see

http://www.binnetcorp.com

By avoiding interfaces that involve C/C++ native code as the Prolog
engine, you can easily run your programs as applets or Web services
and you benefit from the simplicity, portability and low maintenance
costs of a single platform solution.

Paul Tarau

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com