绘制ER图时局部性和可选性有什么区别 [英] What is the difference of partiality and optionality when drawing ER diagrams
问题描述
部分关系用单行显示,总关系用双行显示。在某些ER图中,可选关系和强制关系分别用虚线和单线表示。
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.
推荐答案
请考虑以下示例:
A 患者
或实验室
可以独立于任何关系而存在。某些患者
可能购买
医学
,而某些实验室
可能生产
医学
,因此这些实体集部分参与了它们的关系
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.
医学
不存在,除非由生产
实验室
,因此医学
完全参与了 Produced
的关系。 医学
可以存在而无需购买
,因此医学
部分参与购买
关系。
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 患者
可能购买
一些药物
而没有处方
,因此处方
对于购买
关系是可选的。相反,没有患者
和医学
购买是不存在的>,因此这些角色对于关系是必不可少的。在生产的
关系中,这两个角色都是强制性的。
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.
这篇关于绘制ER图时局部性和可选性有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!