What is the difference of partiality and optionality when drawing ER diagrams

Deadly 提交于 2019-12-11 04:54:24

问题


Partial relationships are shown by single lines total relationships are shown by double lines. And in some ER diagrams optional and mandatory relationship is shown by a dotted line and a single line respectively.

What is the exact difference of definitions between these concepts? Please use an example if possible.


回答1:


Consider the following example:

A Patient or a Laboratory may exist independently of any relationship. Some Patients may Purchase Medicine, and some Laboratories may Produce Medicine, hence those entity sets participate partially in their relationships.

Medicine cannot exist without being Produced by a Laboratory, thus Medicine participate totally in the Produced relationship. Medicine can exist without being Purchased hence Medicine participate partially in the Purchase relationship.

A Patient may Purchase some Medicine without a Prescription, thus a Prescription is optional to the Buys relationship. In contrast, a Purchase cannot exist without a Patient and Medicine, hence those roles are mandatory to the relationship. In the Produced relationship, both roles are mandatory.

The basic difference here is that cardinality constrains the existence of relationships, while participation constrains the existence of entities. When a role in a relationship set is mandatory, it means a relationship instance can't exist without an entity filling that role. When an entity set participates totally in a relationship, it means an entity can't exist without being related.



来源:https://stackoverflow.com/questions/38178564/what-is-the-difference-of-partiality-and-optionality-when-drawing-er-diagrams

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!