The article seems not be very explicative. Assume the call is "sg(a,W)". Let analize first possibility: sg(X,Y) :- par(X, X1), par(Y,Y1), sg(X1,Y1) first "par" will be queried as "par(X=a,X1)", next as "par(Y=W,Y1)". This last query is a totally unbound query, and probably is what the article tries to skip. Now,...

database,compiler-errors,prolog,datalog

As Sergey suggested, the answer was to remove the /assert(s).

Datalog's semantics is defined over finite sets. Prolog, however, gives you sequences of answer substitutions and in the case of Prolog with constraints answers. Answer substitutions may represent simply solutions, like in X = 1, but they may also represent infinitely many solutions, like in X = [_A,_B,_C]. The sequence...

count,fact,datalog,answer-set-programming

Based on knowledge of other solvers, I'm guessing your code is not counting the combinations of TermA and TermC, it is ignoring TermC variations. You need to tell it it count the combinations. triple1nr(X) :- #count{TermA,TermC : triple1(TermA,"go:is_a",TermC)} = X. But I do not use dlv, and I do not...