mike-neckのブログ

Java or Groovy or Swift or Golang

datomicチュートリアルをやる場合の注意点 / Please note when you try datomic turotial #datomic

Datomic チュートリアルをいじるときに一つ注意して欲しい点があります。

それは、ドキュメントチュートリアルで読み込むスキーマ定義用のednファイル(seattle-schema.edn)ファイルに一部異なるところがあるからです(datomic-free-0.9.5153.zipで確認)。

異なる点があるのは:community/typeのカーディナリティです。

ドキュメントでは次のように定義されています。

attribute type cardinality
:community/type Reference One

しかし、seattle-schema.ednファイルでは:community/typeのカーディナリティがmanyで定義されています。

 {:db/id #db/id[:db.part/db]
  :db/ident :community/type
  :db/valueType :db.type/ref
  :db/cardinality :db.cardinality/many
  :db/doc "Community type enum values"
  :db.install/_attribute :db.part/db}

もし、ドキュメントと同じ条件でチュートリアルをやりたい人は、seattle-schema.ednのカーディナリティを:db.cardinality/oneに修正して実行するとよいでしょう。


If you want to try datomic tutorial, please note that there is miss definition in seattle-schema.edn (at the version of datomic-free-0.9.5153.zip).

In the tutorial document, :community/type is defined as :db.cardinality/one

attribute type cardinality
:community/type Reference One

But in seattle-schema.edn, the cardinality of :community/type is defined as :db.cardinality/many.

 {:db/id #db/id[:db.part/db]
  :db/ident :community/type
  :db/valueType :db.type/ref
  :db/cardinality :db.cardinality/many
  :db/doc "Community type enum values"
  :db.install/_attribute :db.part/db}

If you wanna try tutorial in the same condition as document, you should edit seattle-schema.edn.