Fork me on GitHub
#datomic
<
2016-06-05
>
madvas09:06:46

How can I pass collection of referenced subitems inside where query. for example like this

(defn make-decision [subitems]
  ;; subitems is only 1 ID not collection of ids
  true)

(d/q '[:find ?item-name
       :where
       [?i :item/name ?item-name]
       [?i :item/subitems ?s]
       [(myns.sth/make-decistion ?s)]] db)

bhagany14:06:52

If I understand you correctly, are you looking for something like:

(d/q '[:find ?item-name
       :in $ [?i …]
       :where
       [?i :item/name ?item-name]
       [?i :item/subitems ?s]
       [(myns.sth/make-decistion ?s)]] db subitems)

bhagany14:06:16

should have tagged you: @madvas ^^

bhagany14:06:47

ah, I think I understand better now - my post isn't what you're looking for. I shouldn't try to help pre-coffee...

bhagany14:06:38

my second impression is that I wouldn't try to do this in a query. All of the data is local to the peer anyway, so I think I'd make the query without the last where clause, and pass the results of the query to make-decision

madvas14:06:11

@bhagany: Thank you. I figured out that what I want is probably undoable in one query, but that’s okay

jannis15:06:57

Quick question because I haven't found any information on it so far: is the tx-report-queue available for in-memory dbs? I use an in-memory Datomic db for testing but even though my calls to d/transact succeed, I get no transactions reported from the queue.

hans15:06:38

it is not, and it is somewhere in the documentation.

jannis15:06:00

Ok. I was aware of the log being unavailable but not the report queue. Thanks 🙂

jannis15:06:56

Actually... I think that's wrong. tx-report-queue works now, even with an in-memory db. So it's only the log then.

hans16:06:08

oops, sorry for spreading wrong info.

hans16:06:28

it was the log that was mentioned.