Just to explain the basis of my question: it was based on the fact that “Datalog syntax” looks like Prolog. So for a Datomic query that asks, “How old is Alice?” I might have:
[:find ?a
:where
[?e :name "Alice"]
[?e :age ?a]
To get the same thing with traditional Datalog, we would create a rule connecting names to ages and then query for the age:
nameage(N,A) :- name(E,N), age(E,A).
?- nameage("Alice", A).
Since the syntax of Datomic queries is just edn, then it doesn’t need lexing, and the parsing is not difficult. So I thought that perhaps you were looking to parse traditional Datalog.
Thanks for clarifying
the problem with datalog is that you can embed arbitrary exprs into it - so it’s really bad for the “resolver” style of implementing
you can’t always statically know what the full query is
this is where pathom helps a lot, because it’s much stricter in its evaluation
I’m not really a fan of Datalog as a query language. Triple-pattern style where clauses with projection are much better. That said… I don’t understand what you’re saying here. I think I can guess what a “resolver” style of implementation is, but I don’t know what you mean by “statically know that the full query is”
I’m basing my take on @mauricio.szabo ‘s message: > is there something that I can register "resolvers" and then query it with datalog? this seems to be borrowing from the way in which pathom and graphql services are built, where for each attribute you have some resolver which will handle looking up the information for that attribute. Thus, in order to construct a result a GraphQL or Pathom implementation simply needs to parse the query, look up and run the resolvers in the correct order
it is more difficult to do this because you could get a datalog query like: [:find ?x :where [_ :attr attr] [_ attr ?x]]