0

I've been trying to understand if there is a substantial advantage of using Prolog over Datalog in a specific context. Prolog is Turing complete and Datalog is not. But is there other substantial advantages of using Prolog ?

the specific context could be for example relational databases...It's better to use Prolog or Datalog ?

cdiogo7
  • 57
  • 7
  • 1
    What is the question? What is the "specific context" you are talking about? – repeat Oct 25 '15 at 18:38
  • 2
    It's possible to implement a Datalog interpreter in Prolog, but not the other way around. – repeat Oct 25 '15 at 18:41
  • 4
    Datalog is a moving target. It is not clear what it means at all. Recent proponents will make claims that go far beyond the original target. OTOH, Prolog is a standardized language. – false Oct 25 '15 at 19:15
  • the specific context could be for example relational databases...It's better to use Prolog or Datalog ? – cdiogo7 Oct 26 '15 at 11:23
  • 2
    I'm using Prolog to create a deductive spreadsheet...but I saw that most of the deductive/logical spreadsheets created until now where mostly based in Datalog...I wonder if it isn't better to use Prolog...instead – cdiogo7 Oct 26 '15 at 11:25
  • Which "deductive/logical spreadsheets [...] based in Datalog" are you referring to? Please name a few. – repeat Oct 26 '15 at 21:25

1 Answers1

5

Besides Turing-completeness of Prolog and non-Turing-completeness of vanilla Datalog (there are extensions of Datalog that extends its complexity class), a couple of significant differences between Datalog and Prolog are as follows:

  1. In Datalog, the order of rules, or atoms within the rules, do not make a difference in their evaluation or the results of the evaluation. In Prolog, on the other hand, order of atoms may mean the difference between termination and non-termination, or the runtime of a terminating evaluation. Prolog also offers imperative operators such as cut (!); typical Datalog implementations do not have such operators. Thus, Datalog is more declarative in that sense.

  2. Datalog implementations typically supports bottom-up evaluation, whereas Prolog implementations typically supports top-down evaluation. There are advantages and disadvantages of each depending on how the program intends to be used, and the data size the program is meant to operate over.

Not sure the implication for your specific use case. It depends a lot on exactly what you're trying to build -- whether you need the Turing-completeness, etc.