Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
298 views
in Technique[技术] by (71.8m points)

association owned by classifier and association owned by relationship in UML

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

an association either owned by classifier or by relationship.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Chriss

I hope this simple example helps.

Guess you have a Java class

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

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

A -> B

with the following modeling elements:

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)

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;
   ...
}

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

A <-> B

Whose model elements would be:

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...