This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-21
Channels
- # aws (1)
- # aws-lambda (1)
- # beginners (27)
- # boot (16)
- # cider (1)
- # clara (54)
- # cljs-dev (4)
- # cljsjs (8)
- # cljsrn (25)
- # clojure (148)
- # clojure-dev (2)
- # clojure-finland (1)
- # clojure-france (18)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-russia (27)
- # clojure-sg (2)
- # clojure-uk (17)
- # clojurebridge (6)
- # clojurescript (70)
- # core-async (1)
- # css (6)
- # cursive (35)
- # data-science (3)
- # datomic (22)
- # events (4)
- # jobs (18)
- # jobs-discuss (14)
- # leiningen (4)
- # lumo (22)
- # off-topic (20)
- # om (5)
- # om-next (1)
- # onyx (47)
- # pedestal (107)
- # re-frame (43)
- # reagent (1)
- # ring (2)
- # ring-swagger (2)
- # rum (18)
- # sql (15)
- # unrepl (4)
- # vim (61)
- # yada (3)
@stuartsierra Does coginect has a plan to support reverse index? eg. (rseq (d/datoms ....))
isaac: (d/datoms :vaet)
?
ohh.. nevermind, I see, reading it in reverse
I believe that may be a current feature request in our customer feedback portal - I’d suggest adding your vote!
i am trying to find a nice way of determining the last transaction time for a given query. I can get the whole DB value like so: (:db/txInstant (d/entity db (d/t->tx (d/basis-t db)))) what i really want/need though is a txInstant that relates to arbitrary query. Lets say my Q is: (d/q ’[:find [(pull ?eid [*]) ...] :where [?eid :part/type :solution]] db) How can i merge the two in a manner that is composable and efficient?? :thinking_face:
@karol.adamiec You know about the ?tx segment?
(d/q ’[:find (pull ?eid [*]) ?txinst
:where [?eid :part/type :solution ?tx]
[?tx :db/txInstant ?txinst]]
db)
but you can do more elaborate things, like e.g. find the max tx of all datoms on an entity, or all datoms on an entity and any entity reachable via isComponent attrs (what (pull ?eid '[*])
would get)
yes so i can get a list of entities with their txinstant
like in first example of yours
but… my query might be arbitrarily complex . pull a lot of things…
metaphorically i want to pour my arbitrary d/q into a ‘new db’ object, and then ask that ‘new’ db what is its latest transaction….
preferably in a general way so i do not need to amend any queries in the system…
pull loses the tx of its datoms, so you either have to keep that info in parallel or write your own pull which takes datom-like input
the latter might not be so bad. You could return [?e ?a ?v ?tx] from query, and then build maps from that directly. (no pull expression, you just mapify what you get)
the first approach looks more like this:
(d/q
'[:find (pull ?eid [*]) (max ?tx)
:in $ %
:where
[?eid :part/type :solution]
(component-reachable ?eid _ _ _ ?tx)
]
db
'[[(component-reachable [?se] ?e ?a ?v ?tx)
[(identity ?se) ?e]
[?e ?a ?v ?tx]]
[(component-reachable [?se] ?e ?a ?v ?tx)
[?se ?sa ?sv ?tx]
[?sa :db/isComponent true]
[?sa :db/valueType ?type]
[?type :db/ident :db.type/ref]
(component-reachable ?sv ?e ?a ?v ?tx)]])
oh, that is a wall of datalog that is way beyond me 🙂
thx @favila , i have to mull that over and experiment in order to grasp that 🙂