Introduction to Datalog
x775.net
Introduction to Datalog
1–10 of 40 posts
Re: Introduction to Datalog
#2Re: Introduction to Datalog
#3The interactive tutorials on http://www.learndatalogtoday.org (Datomic's dialect) quickly sold me on the idea.
Though coming from Datomic, I'm curious how much of my knowledge is Datomic-specific rather than how you'd generally approach a database queryable with Datalog. For example, do you need four indexes like Datomic (https://docs.datomic.com/on-prem/indexes.html) to make Datalog queries fast?
Re: Introduction to Datalog
#4Can you specify symmetric and transitive closure in Datalog?
Edge("a", "b").
Edge("b", "c").
Path(x, y) :-
Edge(x, y).
Path(x, z) :-
Path(x, y),
Edge(y, z).
Symmetric closure, assuming I'm understanding correctly, is also trivial: SymmetricEdge(Left, Right) :-
Edge(Left, Right).
SymmetricEdge(Left, Right) :-
Edge(Right, Left).Re: Introduction to Datalog
#5Re: Introduction to Datalog
#6Can you specify symmetric and transitive closure in Datalog?
Transitive closure is the first thing nearly every introduction to datalog (or Prolog, for that matter) will show you. All you had to do was click the link and scroll down: Edge("a", "b"). Edge("b", "c"). Path(x, y) :- Edge(x, y). Path(x, z) :- Path(x, y), Edge(y, z). Symmetric closure, assuming I'm understanding correctly, is also trivial: SymmetricEdge(Left, Right) :- Edge(Left, Right). SymmetricEdge(Left, Right) :…
Re: Introduction to Datalog
#7Earlier quoted context omitted.
Transitive closure is the first thing nearly every introduction to datalog (or Prolog, for that matter) will show you. All you had to do was click the link and scroll down: Edge("a", "b"). Edge("b", "c"). Path(x, y) :- Edge(x, y). Path(x, z) :- Path(x, y), Edge(y, z). Symmetric closure, assuming I'm understanding correctly, is also trivial: SymmetricEdge(Left, Right) :- Edge(Left, Right). SymmetricEdge(Left, Right) :…
I was wondering about termination. With finite ground facts that appears not to be an issue. Complexity is another matter.
Re: Introduction to Datalog
#8Pretty cool deep-dive on Datalog. The interactive tutorials on http://www.learndatalogtoday.org (Datomic's dialect) quickly sold me on the idea. Though coming from Datomic, I'm curious how much of my knowledge is Datomic-specific rather than how you'd generally approach a database queryable with Datalog. For example, do you need four indexes like Datomic ( https://docs.datomic.com/on-prem/indexes.html ) to make Datal…
Re: Introduction to Datalog
#9Is it really the case?
Human("Socrates").
Animal("Turtle").
Mortal(x) :- Human(x).
Mortal(x) :- Animal(x).
Suppose :- means iff. Turtle is Mortal (lines 2+4, implication to the left). Because Turtle is Mortal, it must be a Human (line 3, implication to the right).Is it really valid according to Datalog semantics?