Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this messageI 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=
Post Follow-up to this messageYou 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.
Post Follow-up to this messagekks 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
Post Follow-up to this messageJPL 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 >
Post Follow-up to this messageYou 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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.