当存在关联 class 时,UML 关联是否唯一?

Are UML associations unique when there is an association class present?

我正在上斯坦福大学的 edx 课程(数据库:建模和理论),讲师提到了这条关于关联 classes 的信息以及它们在图表中的含义(参考示例两个 classes“student”和“college”通过一个“applies to”与包含大学申请信息的关联class“appInfo”相关联:

Now what we're saying is that association is going to have affiliated with it a date and a decision. What we cannot describe in UML is the possibility of having more than one relationship or association between the same student and the same college.

So when we have an association, that assumes at most one relationship between two objects. So, for example, if we wanted to add the possibility that students could apply to the same college multiple times so maybe, you know, they wanted to apply for different majors, that would actually have to be captured quite differently. We'd have to add a separate class for the application information with separate relationships to the students and colleges.

但我并没有真正理解她在这里的意思,关联 class 会在两个 class 之间创建一个自动的 1-1 耦合吗?还是禁止两个class有一个以上的关系?或者这里说的到底是什么,因为它有点含糊,而且我在 UML 数据建模方面没有经验。

该陈述要么是错误的,要么是脱离了此处未提及的特定上下文。原因是:

  • 关联中没有隐含的一对一;关联两端的多重性指定它是一对一、一对多、多对多关联还是介于两者之间的任何关联。
  • 这同样适用于关联class,它同时是:关联和class。
  • 在多对多关联中,相同对象之间很可能有多次 link。事实上,在一对多或多对多关联中,如果要避免这种情况,需要添加显式约束。

更多信息:

  • this other answer中,对关联的语义有更多的解释classes
  • 与唯一性有关的。如您所见,避免多次出现并不明显