UML中由分类器拥有的关联和由关系拥有的关联 [英] association owned by classifier and association owned by relationship in UML

查看:38
本文介绍了UML中由分类器拥有的关联和由关系拥有的关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

7.3.3 关联(来自内核),第 36 页,UML 上层结构,v2.4.1:

7.3.3 Association(from kernel) ,page 36,UML superstructure ,v2.4.1:

在 UML 中是否有关于分类器拥有的关联和关系拥有的关联的真实示例?

Is there a real-life example in UML about association owned by classifier and association owned by relationship?

推荐答案

Chriss

我希望这个简单的例子有帮助.

I hope this simple example helps.

猜猜你有一个 Java 类

Guess you have a Java class

public class A {
   private B b;
   ...
}

在 UML 中,您可以将此关系建模为从 A 到 B 的关联:

In UML you would model this relationship as an association from A to B:

A -> B

具有以下建模元素:

Class B
Class A
  + Property b : B [0..1]    (owned by the class)
Association A_to_B
  + Property from_a : A [1]  (owned by the association)

其中关联 A_to_B 将有 2 个关联(成员)结束引用上面显示的两个属性(A::b 和 A_to_B::from_a):

Where the association A_to_B would have 2 association (member) ends referring two the properties showed above (A::b and A_to_B::from_a):

现在,让我们考虑以下情况

Now, let's think the following situation

public class A {
   private B b;
   ...
}
public class B {
   private A a;
   ...
}

在 UML 中,您可以对 A 和 B 之间的关联(可双向导航)进行建模:

In UML, you could the model the association (navigable in both ways) between A and B:

A <-> B

谁的模型元素是:

Class B
  + Property a : A [0..1]  (owned by the class)
Class A
  + Property b : B [0..1]  (owned by the class)
Association A_B

其中关联 A_B 将有 2 个关联(成员)结束引用上面显示的两个属性(A::b 和 B::a).

Where the association A_B would have 2 association (member) ends referring the two the properties showed above (A::b and B::a).

这篇关于UML中由分类器拥有的关联和由关系拥有的关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆