Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How use Prolog from Java?

Tags:

java

prolog

In the context of a Java/Eclipse application I would like to use Prolog for a particular task. What are the available solutions and tools to do that, and associated pro and cons ?

I can launch an external Prolog interpreter generating the result in a file ? I can use a full Prolog Java Library (Prolog interpreter implemented in java) ? I can use a java library dedicated to the communication with an external Prolog interpreter ?

Thanks in advance for your help,

Manu

like image 411
Manuel Selva Avatar asked Nov 29 '10 12:11

Manuel Selva


3 Answers

I would give GNU Prolog for Java a try. From the website:

GNU Prolog for Java is an implementation of ISO Prolog as a Java library

like image 90
aioobe Avatar answered Nov 04 '22 03:11

aioobe


I'm using tuProlog Official Site, Code Repository on Android. They have a great embedded Prolog in the form on 1 Jar File. They are responsive too!

like image 10
ProfVersaggi Avatar answered Nov 04 '22 01:11

ProfVersaggi


A quick google returns a list of options (alas not updated in 5 years).

As for pros/cons - as I see it
Native engine with bindings would be the worse option when it comes to distribution and integration, but may be faster than the native Java engines (but I would want proof first).
Java engine with API would lead to some awkwardness at integration points, but should be easy to distribute.
Prolog to bytecode compiler should handle integration between the two languages nicely, and would mean that you are not shipping prolog scripts with the binary (may be a disadvantage). Big disadvantage with this - none still seem to be a live.
Prolog-alike language to bytecode compiler, same as above, but some still seem to be floating about, also would require knowledge of a new language.
Java rules engine - I'd see this as the neatest solution. Rather than use two languages code the rules in a Java-y way, but it depends on how complicated the rules are to express in that way.

A second thing to consider is - is the project still being updated. From my quick google, few are. Prova and Mandarax are two exceptions from the latter options.

like image 4
Michael Lloyd Lee mlk Avatar answered Nov 04 '22 02:11

Michael Lloyd Lee mlk