This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-06
Channels
- # admin-announcements (6)
- # beginners (147)
- # boot (9)
- # braveandtrue (5)
- # cider (11)
- # cljsjs (1)
- # cljsrn (4)
- # clojure (82)
- # clojure-greece (9)
- # clojure-poland (9)
- # clojure-russia (288)
- # clojure-taiwan (2)
- # clojure-uk (73)
- # clojurescript (123)
- # consulting (3)
- # cursive (26)
- # datascript (4)
- # datomic (32)
- # dirac (56)
- # emacs (11)
- # flambo (2)
- # hoplon (425)
- # jobs-rus (1)
- # lein-figwheel (3)
- # leiningen (16)
- # luminus (42)
- # mount (7)
- # om (1)
- # om-next (2)
- # onyx (8)
- # other-languages (146)
- # quil (3)
- # re-frame (17)
- # reagent (6)
- # spacemacs (2)
- # uncomplicate (8)
- # untangled (71)
- # vim (2)
- # yada (49)
that's right, you have to specify which refs you want to follow
Hello, I've been playing around with datomic, and I've stumbled upon the following link https://gist.github.com/stuarthalloway/2645453 . My question is: Can the pull syntax be used with queries against clojure collections?
Can I search, historically, for a retracted entity which once had a value for a unique attribute, but no longer does?
@harold: yep, I believe you should be able to do it using a query against a history db. Have you attempted anything yet?
a “retracted entity” is kind of a confusing category to ask about since entities are not intrinsically reified in the underlying datom model. Facts are asserted or retracted, all facts are about an entity, all facts about an entity may be retracted, but the entity’s existence is not otherwise a fact that can be asserted or retracted. If that makes sense.
Say I knew that at some point in the past there was an entity e with value v for attribute a.
enter and shift enter, ugh
so all facts, assertiosn or retractions are in a history db, and you can limit to retractions with a fifth position of false in a :where
clause.
some queries against history (not an exact match for what you’re asking but maybe helpful) in the day of datomic provenance example: https://github.com/Datomic/day-of-datomic/blob/master/tutorial/provenance.clj#L61
(d/q '[:find ?e
:in $ ?a ?v
:where
[?e ?a ?v]]
(d/history db))
@harold that should return every entity that ever had that ?a ?v
(as query parameters) asserted or retracted for it, could put in [?e ?a ?v _ false]
as :where
clause instead to limit to retractions (untested as of yet, just building query off expectations).@fenton: http://docs.datomic.com/javadoc/datomic/Datom.html — an you use :e
, :a
, :v
, :tx
, :added
etc. from Clojure instead of usual Java interop.
@fenton (map ns-publics (all-ns))
@brian_mingus: crashed my repl! lol!
@fenton: you mean what you can call on a datom in clojure? supports nth
, juxt
(with keywords), destructuring.
((juxt :e :a :v :tx :added) datom)
[0 10 :db.part/db 13194139533312 true]
(let [[e a v tx added] datom] [e a v tx added])
[0 10 :db.part/db 13194139533312 true]
etc.then it’s just values in Clojure you can do w/e with.
anyone have issues with uniqueness...when i transact two items quickly in sequence, seems to violate the uniqueness of that attribute?
Unique value or identity? Identity will upsert rather than raise an exception.
It's upserting, if you query the resulting db only one entity will have that attr/value, more here: http://docs.datomic.com/identity.html
@bkamphaus: ok...thank you again!