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!!
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.
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.
Consider X-Prolog which is pretty evolved and quite fast.
also there is open source JProl library which can be use for Prolog learning
精彩评论