5

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?

Community
  • 1
  • 1
Chriss
  • 1,011
  • 1
  • 13
  • 22
  • 3
    Do you mean a *property* owned by an association vs. one owned by a class? – Jim L. Sep 15 '13 at 22:42
  • thanks to you @JimL. your question raised another question I have some confusion because in UML specification the generalization of association relationship is either classifier or relationship but in tool that I use which is Papyrus the owner of property(member end) is either classifier or association as you can see in the following screen shot http://ge.tt/1hXG8Js/v/0?c and I do know that there is difference between association and association end – Chriss Sep 16 '13 at 08:08
  • Class Association is a specialization of both Classifier and Relationship (i.e. multiple inheritance). There is no '**or**' here, nor does either class Classifier or class Relationship own class Association. An **instance** of class Association has an owner (because it is an Element). It also has associations to two or more Properties which themselves have owners. Interestingly, Element::owner is a derived union. Looking at the UML spec, I can't actually find any properties of Association that subset owner. So how then can an Association have an owner? Different problem though... – Huliax Oct 26 '15 at 13:33

2 Answers2

4

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).

ASBH
  • 541
  • 2
  • 6
  • Hi @ASBH ! thank you for helpful answer. What is the relation between the `owner of association end` and `navigable` ?because I have also noticed that if the owner is set to association, then the navigable will automatically set to False . if the owner is set to classifier, then the navigable will set to True . (but I don't know Why Owner and Navigable work together?) Please,see my diagrams of your above example in both cases (using Papyrus). is this what you are trying to say? http://postimg.org/image/z4frjeysf/ – Andrew Nov 30 '13 at 18:56
  • 1
    @Andrew, Have a look to UML 2.5 section 6.4.2: "Arrow notation is used to denote association end navigability. By definition, all class-owned association ends are navigable. By convention, all association-owned ends in the metamodel are not navigable" – ASBH Dec 15 '13 at 12:12
  • Since I also struggled with what association end ownership really means, I came across this question - and during my search also found an OMG document which I think explains the matter quite nicely: [Getting it Right on the Dot](https://www.omg.org/ocup-2/documents/getting_it_right_on_the_dot.pdf). – jechterhoff Jun 25 '19 at 13:27
3
  • Before other things you should understand what the association A to B is.
    • Basically it is a solid line between A and B. It can represent one structure that connects class/instanc(es) of A with the class/instances of B. The structure can be of any sort and belong anywhere. All information, written about the line, describes this structure.
    • If there are two structures, one structure, that connects one instance of A with instance(s) of B and another structure that connects instance of B with instance(s) of A, you can show them both in ONE association. Then, information written about its B end describes the first structure (b->a) and info about the other end describes the other structure.
    • If you'll have more than one structure guiding from A to B, you have to draw two different associations.
    • If a joining structure is complex, you could represent it as an Association Class. There you can define more details.
    • A joining structure can connect more than two classes, then it will be shown as a large diamond with solid branches to these classes. It is still association! Attention: these two more complex associations are very badly supported by existing tools. You can easily create something absolutely senseless with them. And they are difficult. Use carefully.

example Class diagram


In C++ instance A can have the B instance not by pointer, but directly. There is NO special UML sign for it, it should be shown in the same way as normal, pointer attribute.

Gangnus
  • 24,044
  • 16
  • 90
  • 149