UML 中类似 ERM 的关联(声明每个 X 都分配有一个 Y)
ERM-like associations in UML (stating that each X has a Y assigned to it)
在 ERM 中,可以对实体之间的关系建模,强调一个对象 总是 分配给 完全是另一个对象,例如:
人 --*-- -1- 地点
这意味着每个 Person 实例都分配了一个出生位置。
我正在寻找它的 UML 翻译。这可能吗?
我首先想到的是
的 UML 中的双向关联
人 -*--1- 地点
对应于 https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model#/media/File:ERD_Representation.svg . However, I am unsure about this: The UML specification states that an Association specifies a semantic relationship that can occur between typed instances. Based on this, cases in which there is no association between objects of the class Person and Location would also be allowed. On the other hand, https://developer.ibm.com/articles/the-class-diagram/ 将多重性解释为 Plane class 旁边的多重性值 0..1 表示当存在 Flight 实例时,它可以有一个与之关联的平面实例,也可以没有与之关联的平面,这意味着 UML 关联实际上强制执行创建的对象可以具有的关联。
同样的问题基本上适用于单向关联:是否
OverDrawnAccountsReport ----1,*-> 银行账户
这是否意味着每个 OverDrawnAccountsReport 至少与一个 BankAccount 相关,或者这是否也允许存在 OverDrawnAccountsReport 而没有此类关联的情况。
我也一直在研究聚合和组合,但是,这些对我来说似乎是可选的,并且强调如果所有者对象被销毁等,所有者部分对象会发生什么
是的,如您的维基百科图表所示,此翻译是正确的 link。 "a relationship can occur between instances"的表征只是指一般情况。在关联端有 1 的多重表达式的特殊情况下,这意味着 "exactly one" 的基数约束,因此,
在这种情况下,实例之间必须存在关系。
但是,我不确定您所说的 "bidirectional" 关联是什么意思?请注意,该术语未在 UML 中定义。
在 ERM 中,可以对实体之间的关系建模,强调一个对象 总是 分配给 完全是另一个对象,例如:
人 --*-- -1- 地点
这意味着每个 Person 实例都分配了一个出生位置。
我正在寻找它的 UML 翻译。这可能吗?
我首先想到的是
的 UML 中的双向关联人 -*--1- 地点
对应于 https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model#/media/File:ERD_Representation.svg . However, I am unsure about this: The UML specification states that an Association specifies a semantic relationship that can occur between typed instances. Based on this, cases in which there is no association between objects of the class Person and Location would also be allowed. On the other hand, https://developer.ibm.com/articles/the-class-diagram/ 将多重性解释为 Plane class 旁边的多重性值 0..1 表示当存在 Flight 实例时,它可以有一个与之关联的平面实例,也可以没有与之关联的平面,这意味着 UML 关联实际上强制执行创建的对象可以具有的关联。
同样的问题基本上适用于单向关联:是否
OverDrawnAccountsReport ----1,*-> 银行账户
这是否意味着每个 OverDrawnAccountsReport 至少与一个 BankAccount 相关,或者这是否也允许存在 OverDrawnAccountsReport 而没有此类关联的情况。
我也一直在研究聚合和组合,但是,这些对我来说似乎是可选的,并且强调如果所有者对象被销毁等,所有者部分对象会发生什么
是的,如您的维基百科图表所示,此翻译是正确的 link。 "a relationship can occur between instances"的表征只是指一般情况。在关联端有 1 的多重表达式的特殊情况下,这意味着 "exactly one" 的基数约束,因此, 在这种情况下,实例之间必须存在关系。
但是,我不确定您所说的 "bidirectional" 关联是什么意思?请注意,该术语未在 UML 中定义。