我是Datomic超级新手。我正在尝试将分类法添加到我的数据库中,但是我收到的错误是我无法遵循的。错误是:
{:datomic.client-spi/request-id "c587b3e8-8f19-45f5-a563-bdba13e3a0d8",
:cognitect.anomalies/category :cognitect.anomalies/not-found,
:cognitect.anomalies/message
":db.error/not-an-entity Unable to resolve entity: {:idx -1000000, :part :db.part/db} in datom [{:idx -1000000, :part :db.part/db} :db/ident :arb/title]",
:dbs
[{:database-id "datomic:dev://localhost:4334/datemo",
:t 1004,
:next-t 1009,
:history false}]}
以下是我正在使用的分类法:
[{:db/id #db/id [:db.part/db]
:db/ident :arb/title
:db/unique :db.unique/identity
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/fulltext true
:db/index true
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :arb/description
:db/unique :db.unique/identity
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :arb/content
:db/unique :db.unique/identity
:db/valueType :db.type/ref
:db/isComponent true
:db/cardinality :db.cardinality/many
:db.install/_attribute :db.part/db}]
以下是我的电话:
(def arb-tx (-> (io/resource "schemas/arb.edn") ;; the schema above
(read-all)
(first)))
(pprint (<!! (client/transact conn {:tx-data arb-tx})))
我很难从错误信息中理解这里究竟无法解决的问题。我认为我对引擎盖下发生的事情的理解太模糊,无法理解这里有什么问题。谁能开导我?
答案 0 :(得分:3)
Datomic Client库不支持显式分区或架构定义中的:db.install / _attribute。在Datomic 0.9.5430之前使用Peers时需要这些元素。
尝试用以下代码替换架构定义:
[{:db/ident :arb/title
:db/unique :db.unique/identity
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/fulltext true
:db/index true}
{:db/ident :arb/description
:db/unique :db.unique/identity
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :arb/content
:db/unique :db.unique/identity
:db/valueType :db.type/ref
:db/isComponent true
:db/cardinality :db.cardinality/many}]
-Marshall