Is there a "datalog parser" that works with ClojureScript?
@mauricio.szabo I have asked for others to chime in which could answer your questions better.
@quoll can you provide some resources to such a query language? I am very new to this field and have little context as to what you mean here.
Thanks for all the answers! I'll study a little more and try to make a proof of concept of what I am thinking :)
@quoll Do you have an example of "Triple-pattern style where clauses with projection are much better"? I'm looking at applying the Datomic Datalog dialect to clara, but definitely hitting some limitations, trying to get my head around the space of querying/logic programming in general.
Well, consider the above queries (I will change the datalog version to pure query with no rule): Pure datalog:
?- name(E, "Alice"), age(E, A).
This will return: something like:
E,A = internal-42, 21.
Whereas languages like Datomic will do the same query (via EAV triple patterns), but can project the result to just the variables of interest:
[:find ?a
:where
[?e :name "Alice"]
[?e :age ?a]
[[21]]
Note, when I say “triple pattern” I mean that pattern that looks like [entity attribute value]
where each part of that pattern can either be an atom or a variable. This is a generalization. For datomic, it’s really a quad pattern:
[entity attribute value tx]
Or if you REALLY want to get into it, a 5 tuple:
[entity attribute value tx assert]
And then the pattern can be truncated:
[entity attribute]
which can be interpreted as: [entity attribute _]
“Triple patterns” are a good generalization, because it’s an abstraction that also works on other graph databases, such as OrientDB or SPARQL databases.
Great explanation, thank you!
Have you seen https://github.com/lambdaforge/datalog-parser ? It's all cljc
Seems like Pathom is better at writing resolvers, but I really think that using datalog would be ideal so it would be less friction on the user...
@mauricio.szabo we are very interested in making datalog something used to build tooling and it’s one of the areas we have an active interest in with Datahike. There is already some experimental work happening in dev tooling behind the scenes. Would be happy to chat with you to see where we can make things easier for you to do this.
Hey, great! Can you point me in the right direction, be it a namespace, a test code, or some usage?
So when asking about Datalog here, I take it that you’re referring to the Datomic-style query syntax, as opposed to standard Datalog?