I am trying to write a Datomic query that invokes 2 rules using a Scala Datomisca wrapper .
How to combine two separate requests?
My code is as follows:
val rule1 = Query.rules("[[(rule1 ?a) [ ... ]]]")
val rule2 = Query.rules("[[(rule2 ?b) [ ... ]]]")
Datomic.q(Query("""[:find ?x
:in $ % %
:where (rule1 ?a) (rule2 ?b)]"""), conn.db(), rule1, rule2)
This gives me the error message "Unable to resolve key rule1"). I tried it with only one %, but it will not compile (type of mismatch).
I would prefer not to combine them into one line in the call Query.rules, because this means that I have to repeat them to use different combinations of rules (for example: one request with both, the other with a single rule 1).
Since Query.rulesthis is a macro, I have to use String literal values, otherwise it will not compile.
Ralph source
share