i am looking for a way to use logtalk in tuprolog. tuprolog is a 100% java based prolog compiler which allows the easy access of java objects from prolog and the other way around.

Currently I am developing a chat application based on artificial intelligence which contains prolog as well as java code. Much as i find it powerful using those languages together there are some limits which could be overcome by implementing oop in prolog.

My Question is, how difficult is it to implement logtalk in tuprolog. How should i approach on that?

TuProlog lacks a number of built-in predicates (specified in the ISO Prolog standard) that are necessary for Logtalk compatibility. Most of these missing predicates provide functionality that cannot be implemented by a user in plain Prolog. Examples are error handling predicates (catch/3 and throw/1) and input/output predicates (e.g. write_canonical/2, write_term/3, or read_term/3). Thus, a port of Logtalk to TuProlog is not currently feasible.

An alternative for a Java-based Prolog would be JIProlog. There are, however, a number of bugs in the current JIProlog release that preclude using this combination for serious work.

well, unfortunately that's not what i wanted to hear. Thing is that i'm developing a language processing software for 2 years. Using tuprolog form the beginning it makes it almost impossible to switch to some other implementation.

tuprolog is made after the edinburgh standard instead of the iso standard. therefore some of the predicates are available but have different names. (e.g. write_canonical -- display). Nevertheless there are some predicates missing.

If i'm be able to find somebody willing to implement those missing predicates into tuprolog, would you be able to write an logtalk configuration for it?

amoun wrote:well, unfortunately that's not what i wanted to hear. Thing is that i'm developing a language processing software for 2 years. Using tuprolog form the beginning it makes it almost impossible to switch to some other implementation.

tuprolog is made after the edinburgh standard instead of the iso standard. therefore some of the predicates are available but have different names. (e.g. write_canonical -- display). Nevertheless there are some predicates missing.

I've serious doubts that the display predicate can replace the write_canonical/2 predicate. But this is only one of several missing predicates.

amoun wrote:If i'm be able to find somebody willing to implement those missing predicates into tuprolog, would you be able to write an logtalk configuration for it?

A configuration file for a new back-end Prolog compiler is easy to write, provided that the compiler provides all the necessary bits. Check the "configs/template.config" and the "configs/NOTES.txt" files for details.

Just took a quick look to the latest stable release of tuProlog (2.9.0). All required standard predicates seem to be there. Logtalk 3.x also requires a few de facto (but not official) predicate such as format/2-3 but these can be hacked (for the sole requirements of the Logtalk compiler and runtime). But I didn't find in the tuProlog documentation any predicate library for accessing the operating-system and perform necessary tasks like querying and setting the current directory, creating directories, checking if a file or a directory exists, or accessing environment variables. It's likely possible to define predicates that use the Java API to perform some of maybe even all of these tasks. If you want to try to define these predicates, check the adapters/template.pl file for the details of what's required. But it may be better for you to first contact the tuProlog developers and ask about the feasibility of defining these predicates.

After playing a bit with the Prolog calling Java API, the only thing that seems to not be straight-forward is to deal with getting and setting the current directory. The comment to the answer marked as the correct answer in the following StackOverflow question seems to be a doable solution:

Unfortunately, found other required features missing such as the de facto standard predicates between/3, numbervars/3, and predicate_property/2. Nevertheless, committed a first non-functional and incomplete draft of a tuProlog adapter file: