Welcome! Please see the About page for a little more info on how this works.

0 votes
in Cloud by

I'd like to in a single datomic/datalog query get output relating to multiple entities

E.g.

In my db (querying Roam graph via RoamAlphaApi) for one value ("YjpbFUsTx") I can do this:

[:find ?e ?stri :where [?e :block/uid "YjpbFUsTx"][?e :block/string ?stri]]

gives me

But I want to pass on two values "YjpbFUsTx" and "TgpgOssBM"

to give me

How do I do that?

I've tried several variations but none give any output.

Useful reference: https://www.zsolt.blog/2021/01/Roam-Data-Structure-Query.html .

1 Answer

0 votes
by

I believe you want something similar to the following:

(d/q '[:find ?e ?stri
       :in $ [?block-id ...]
       :where [?e :block/uid ?block-id]
              [?e :block/string ?stri]] 
     db ["YjpbFUsTx" "TgpgOssBM"])

https://docs.datomic.com/cloud/query/query-data-reference.html#collection-binding

...