I think the most misunderstood thing about Prolog (and Datalog, the functor-free subset of pure Prolog) is that the syntax is really, really important.
It's like, the whole gimmick of the language. It is designed to efficiently and elegantly query and transform itself. If you lose the syntax you lose all of intermediate and advanced Prolog (and Datalog).
However, syntax does matter, and this is not acceptable
(dl-find
(fresh-vars 1
(lambda (?id)
(dl-findo dl
((,?id reachable ,?id)))))))
as a way to ask reachable(Id, Id).
I think you could, however, write a bit more Scheme and be able to ask (?id reachable ?id)
which would be acceptable.However, the ordering betrays a deeper semantic difference with orthodox Datalog, which is about distinct N-ary relations, like a relational database, not binary relations. This implementation seems to be specific to binary relations, so it's not really Datalog for reasons that go beyond mere syntax.
On the other hand, this (from the initial goal) would be perfectly fine:
(dl-rule! dl (reachable ,?x ,?y) :-
(edge ,?x ,?z) (reachable ,?z ,?y))
The orthodox Datalog syntax is: reachable(X, Y) :- edge(X, Z), reachable(Z, Y).
There is a dl-rule here: https://github.com/deosjr/deosjr.github.io/blob/15b5f7e02153...
Yes, I think the semantic divergence is more fundamental. Triple stores and graph databases and binary relations are awesome, but they aren't what Datalog is.
Yes it started out as a Prolog subset, but the definition as the fragments it supports has become much more prevalent, mainly to contrast it to non-recursive fragments with arbitrary negation (e.g. SQL).
This usage dates back to database literature of the 80s by Ullman et. al.
deosjr•10h ago
Runs in the browser using Hoot (https://spritely.institute/hoot/) which compiles Guile Scheme to WebAssembly.