Closed alexskara closed 3 years ago
Thank you for asking this question. Apologies for the delay in replying to you.
What other non-obvious design choices are made?
I have attached projog_design_documentation.zip containing design documentation for this project. I'm not sure how helpful it will be for you. Unfortunately I do not have specific books or articles I can reference to explain the specific algorithms used by this project.
What is the source of the algorithms - for unification, depth-first-search for the resolution
The Term
interface has backtrack
and unify
methods which are used for unification and backtracking. The evaluate
method of InterpretedUserDefinedPredicate
contains an example of iterating through the clauses of a predicate.
During the development of this project I have attempted to optimise the performance of evaluating queries. These attempts at optimising performance have come at the cost of increasing complexity of the code. It is for performance reasons that there are variations of ClauseAction
. The code in org.projog.core.udp.compiler
is for compiling Prolog to Java bytecode at runtime. See #175 for more details about how this project supports both compiled and interpreted modes. If performance is not a high priority for you then you should be able to implement a simpler inference engine than is contained in this project.
What algorithm is used for the parsing?
The logic for parsing Prolog syntax is located in the org.projog.core.parser
package. If you want to take a look at how it is implemented then a good starting point would be the getInstance
methods of SentenceParser
.
Incidentally, since writing this parser I have noticed there is a "java-prolog-parser" project hosted on Github. I haven't used it so can't comment on its design. You can view it at: https://github.com/raydac/java-prolog-parser
If you do have any further questions then you're welcome to add them as a comment on this issue.
I wish you good luck with however you choose to proceed with your project.
Closing this issue as it was answered a while ago and there have been no follow up questions.
Thank you for raising this issue. If you have further questions or comments about Projog then please raise a new issue for them and I will take a look.
The following projects provide examples of how the latest version of Projog can be used to call Prolog from Java.
https://github.com/s-webber/prolog-wumpus-world https://github.com/s-webber/prolog-expert-system https://github.com/s-webber/projog-examples/tree/master/calling-prolog-from-java
The Projog website now includes class diagrams and design decisions:
http://projog.org/class-diagrams.html http://projog.org/design-decisions.html
The documentation on the website is more up-to-date than the design documentation that is mentioned in an earlier comment of this issue.
If anyone has further questions or comments about Projog then they are welcome to raise a new issue. Thanks.
Are some short description of the design choices available for the project? I mean - just some 3-5 sentences. E.g.
I am seeking for the Prolog implementation in the Java, that I could extend myself. I read the pico-prolog implementation http://spivey.oriel.ox.ac.uk/corner/An_introduction_to_logic_programming_through_Prolog, but it is in strange language and without object-orientation. Maybe the developers of this project followed some similar source of ideas and algorithms and then I could read those books/articles and it would be easier for me to comprehend the code. The code is readable, but I have not enough knowledge, e.g. to recognise the parsing algorithm immediately.
I plan to extend some Prolog implementation to adapt it for the relational reinforcement learning following the ideas of http://www.isle.org/~langley/papers/icarus.rrl.ilp05.pdf