|
|
|
|
|
by triska
2958 days ago
|
|
Prolog and Datalog also have a lot in common: In addition to Datalog being a syntactic subset of Prolog, the semantics of Prolog and Datalog, and hence the solutions you obtain, are also identical if you enable SLG resolution in your Prolog system and run a Datalog program with it. SLG resolution (also called "tabling" in Prolog) prevents both positive and negative loops, and always terminates for programs that have the bounded term-size property, as is the case for all Datalog programs. XSB Prolog is a notable example of a Prolog system that supports this mode, which you can enable with the table/1 directive: http://xsb.sourceforge.net/shadow_site/manual1/node2.html Therefore, you can use a Prolog system such as XSB Prolog also to learn Datalog, and then seamlessly move to Prolog. Conversely, if you know Prolog, then learning Datalog is very easy. Another very nice system for learning Datalog is DES, which you can run in SICStus Prolog and other systems: http://des.sourceforge.net/ Various extensions such as aggregate functions and object-oriented programming (which are mentioned in the Wikipedia entry for Datalog) are also applicable to both Prolog and Datalog with identical or closely related semantics. |
|
I also work on an industrial strength Datalog implementation and I can tell you unequivocally there is very little relationship with how a real Datalog engine is implemented and a Prolog implementation.
And no, learning Prolog will not help you learn Datalog. Unless you're going to always us tabling or demand transformations, the difference in evaluation model requires writing in a very different style.