Is it idiomatic to make a join entity?

When I say join entity I mean whatever the datomic equivalent to a SQL join table is. Say I have a parent entity with attribute name and I have a child entity with attribute name . parent is a in a many to many relationship with child as each parent can have multiple children and each child can have two parents.

If I were using SQL I'd create a join table family that includes the foreign keys to parent and child ; however with datomic, I have the option to pick either parent or child to give a reference attribute to the other with a many cardinality. Is this the favored approach over creating a new entity? What if family has attributes that are more associated with the family as a whole than individual parents/children; for example, a family priority number?


Datomic's flexible schema would allow you to model this either way. If you need to model attributes for the family itself, though, it makes more sense for family to be a reified entity.

链接地址: http://www.djcxy.com/p/65266.html

上一篇: 将Datomic实体标识公开给服务或REST API

下一篇: 建立一个连接实体是否是惯用的?