qualified relationships in datomic

In a relational DB, I could have a table Person and a table Hobby . Every person can have zero, one or more hobbies , and I also want to record, say, the priority of those hobbies for every person .

I could create a relationship table with the 2 foreign keys PersonFK and HobbyFK , and one plain column Priority .

In datomic, to model a simple n:m relationship (without the priority), I'd probably create an attribute of type Reference with cardinality Many , that I'd use for Person entities.

But how would I go about qualifying that relation to be able to store the priority? Would it have to be done analogously to the relational case, ie by creating a new entity type just for that relation? Or is there any better way? Using some meta data facility or something?


A similar question was asked on the Datomic mailing list a few days ago:

https://groups.google.com/d/topic/datomic/7uOl-TISdxA/discussion

In summary, the answer given there is that you are right: you need to create a relation entity on which to store the extra information.

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

上一篇: 向DOM添加大量元素

下一篇: 数据组中的合格关系