Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use prolog in java? [duplicate]

Tags:

java

prolog

Please, someone help me with an example. I would like to create a simple Prolog program, that adds two numbers together, and the Java program writes it to the console! So the Prolog is adding, and the a Java program is writing the result. I can write the adding in prolog, but I don't know how to invoke the prolog program in java. =( Please, someone, who can create this little example, write it here! Thanks!!

like image 200
victorio Avatar asked Jun 18 '11 09:06

victorio


2 Answers

You can try to use the the GNU Prolog for Java. Running an existing prolog file appears straight-forward described here. I haven't tried myself, but would be interested to see if it works.

like image 71
Garrett Hall Avatar answered Sep 25 '22 10:09

Garrett Hall


The easiest way I have found to use Prolog from Java is to use tuProlog which is a Prolog implementation in Java. http://www.alice.unibo.it/xwiki/bin/view/Tuprolog/ It is actively developed.

Unfortunately, tuProlog's performance is not as good as some much faster native Prologs (e.g. Yap,etc), so if speed is a concern, this might not work out for you.

like image 38
Mark Bolusmjak Avatar answered Sep 22 '22 10:09

Mark Bolusmjak