All clauses in 'or' must use same set of vars?

Hi,

when calling the below query in Java:
[:find ?e :in $ ?v1 ?v2 :where (or [?e :name ?v1][?e :name ?v2])]

I get an exception:
All clauses in ‘or’ must use same set of vars, had [#{?v1 ?e} #{?v2 ?e}]

Not sure I understand the error.
Any clue?

Found the answer here:

Basically, you need to use an or-join and specify the list of joined inputs.

Not sure why Datomic is not able to automatically join using the global list of inputs…

Glad you found the answer.

In your particular case though I would use collection binding.

[:find ?e :in $ [?v ...] :where [?e :name ?v]

Seems much better indeed

Thanks!

Envoyé de mon iPhone

Thanks for the tip, works, much simpler than or-join!