1

我有一个 Clojure ns,它定义了一个内存数据库:1 个分区、一些属性和 2 个实体。我从 Eclipse 的(逆时针)运行它,结果(异常)如下:

;; Clojure 1.4.0
;; Switching to ww.billing namespace
#'ww.billing/cardinality
#<Namespace ww.billing>
=> (setup-db)
#<HashSet [[:billing]]>
#<HashSet [[:db/code], [:customer/taxid], [:fressian/tag], [:db/unique], [:db/fn],
[:customer/role], [:db/noHistory], [:db/fulltext], [:db/lang], [:db/valueType], 
[:db/doc], [:db/isComponent], [:db.install/function], [:db/cardinality], 
[:db/txInstant], [:db/index], [:customer/taxname]]>
#<HashSet [["BBB010101BB1"], ["AAA010101AAA"]]>
#<HashSet [[272678883689455], [272678883689454]]>
nil
=> (cardinality mdb :customer/taxid)
IllegalArgumentException Cannot resolve key: :customer/taxid  
datomic.datalog/resolve-id (    datalog.clj:144)

然而,从 LightTable,同样的代码,当然,结果是不同的(正确的):

(ns ww.billing) => nil
(setup-db) => nil
(cardinality mdb :customer/taxid) => :db.cardinality/one

Output: 
#<HashSet [[:billing]]>
#<HashSet [[:db/code], [:customer/taxid], [:fressian/tag], [:db/unique], [:db/fn],
[:customer/role], [:db/noHistory], [:db/fulltext], [:db/lang], [:db/valueType],
[:db/doc], [:db/isComponent], [:db.install/function], [:db/cardinality],
[:db/txInstant], [:db/index], [:customer/taxname]]>
#<HashSet [["BBB010101BB1"], ["AAA010101AAA"]]>
#<HashSet [[272678883689455], [272678883689454]]>

取决于环境的不同结果可能是什么原因?注意:IntelliJ 的行为类似于 Eclipse。基数函数取自西雅图演示。

4

1 回答 1

1

这在谷歌组中得到了充分的回答:https ://groups.google.com/d/msg/datomic/CwCJXLeUsPQ/Y-mNvFF5lksJ

于 2013-02-26T18:47:25.910 回答