datalog

mauricio.szabo 2020-10-05T14:32:05.010900Z

Is there a "datalog parser" that works with ClojureScript?

grounded_sage 2020-10-06T13:09:24.031900Z

@mauricio.szabo I have asked for others to chime in which could answer your questions better.

grounded_sage 2020-10-06T13:10:48.032100Z

@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.

mauricio.szabo 2020-10-07T01:20:24.032800Z

Thanks for all the answers! I'll study a little more and try to make a proof of concept of what I am thinking :)

sparkofreason 2020-10-08T14:05:14.033300Z

@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.

quoll 2020-10-08T15:39:33.033700Z

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]]

quoll 2020-10-08T15:43:22.033900Z

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 _]

quoll 2020-10-08T15:45:04.034100Z

“Triple patterns” are a good generalization, because it’s an abstraction that also works on other graph databases, such as OrientDB or SPARQL databases.

sparkofreason 2020-10-09T13:23:43.034600Z

Great explanation, thank you!

👍 1
refset 2020-10-05T15:11:31.011600Z

Have you seen https://github.com/lambdaforge/datalog-parser ? It's all cljc

👍 3
mauricio.szabo 2020-10-05T17:03:39.012300Z

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...

grounded_sage 2020-10-05T18:07:51.016300Z

@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.

mauricio.szabo 2020-10-05T18:54:46.016500Z

Hey, great! Can you point me in the right direction, be it a namespace, a test code, or some usage?

quoll 2020-10-05T19:37:24.016700Z

So when asking about Datalog here, I take it that you’re referring to the Datomic-style query syntax, as opposed to standard Datalog?