This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-23
Channels
- # beginners (20)
- # boot (7)
- # cider (115)
- # cljsrn (13)
- # clojars (1)
- # clojure (122)
- # clojure-italy (23)
- # clojure-spec (60)
- # clojurescript (74)
- # data-science (7)
- # datomic (26)
- # emacs (8)
- # graphql (1)
- # lumo (26)
- # music (1)
- # off-topic (1)
- # re-frame (9)
- # ring (3)
- # rum (1)
- # spacemacs (4)
- # uncomplicate (6)
- # vim (7)
Hello I am currently evaluating datomic and using the java API 😮 . One use case I am trying to solve is to retrieve a specific set of transactions for an entity. After getting the transactions ids which are non continuous I clumsily retrieve the actual tx data via the log api by applying a short range of one based on the transaction id (txRange(x, x+1)). Is there a more elegant way of achieving the same result?
@ckaratza in Clojure, it’s not clumsy 🙂 (first (d/tx-range (d/log (d/connect "URI")) t (inc t)))
@robert-stuttaford isn’t it possible to retrieve the tx data directly in the datalog query anyway?
@hmaurer yes you can
@hmaurer how could you change this to include the datums `[:find ?tx ?e :in $ ?id ?owner ?revision :where [?e :appRegistry/id ?id] [?e :appRegistry/owner ?owner] [?e :appRegistry/revisionNumber ?revision] [?e ?tx]]`
in that case I’m not sure you can do it efficiently in Datalog. @robert-stuttaford can you please confirm?
let me try thic: `[:find ?tx ?a ?v ?e :in $ ?id ?owner ?revision :where [?e :appRegistry/id ?id] [?e :appRegistry/owner ?owner] [?e :appRegistry/revisionNumber ?revision] [?e ?a ?v ?tx]]`
but if you tried [?e ?a ?v ?tx]
alone I think it would warn you that the query would lead to a full DB scan
As in, what is the problem you are trying to solve / question you are trying to answer?