我正在学习教程http://www.datomic.com/company/resources/tutorial但我认为我错过了如何访问 Datomic 时间模型的简单难题。
如果我做一系列的添加和撤回
;; DO a series of transactions
;; (transact conn [:db/add entity-id attribute value0])
(use 'datomic.api)
(dir datomic.api)
(def conn (connect "datomic:dev://localhost:4334/demo"))
(transact conn '[:db/add 2000 :db/doc "Hello There"])
(q '[:find ?e ?n :where [?e :db/doc ?n] [(= 2000 ?e)]] (db conn))
; => <HashSet [[2000 "Hello There"]]>
(transact conn '[:db/add 2000 :db/doc "Hello There 1"])
(q '[:find ?e ?n :where [?e :db/doc ?n] [(= 2000 ?e)]] (db conn))
; => <HashSet [[2000 "Hello There 1"]]>
(transact conn '[:db/add 2000 :db/doc "Hello There 2"])
(q '[:find ?e ?n :where [?e :db/doc ?n] [(= 2000 ?e)]] (db conn))
; => <HashSet [[2000 "Hello There 2"]]>
(transact conn '[:db/add 2000 :db/doc "Hello There 3"])
(q '[:find ?e ?n :where [?e :db/doc ?n] [(= 2000 ?e)]] (db conn))
; => <HashSet [[2000 "Hello There 3"]]>
如何获得(实体 2000 属性:db/doc)上的值的一系列更改?
我想得到一些格式的东西
[ [Transaction Number, Time, Value] .... [Transaction Number, Time, Value]]
例如:
[ [T1, "2012-March-16-9:30:12", "Hello There"]
....
....
....
[T27, "2012-June-14-9:54:38", "Hello There 3"] ]
不会那么难,但是有很多 :db 内部参数我不熟悉。