0

Considerer this:

enter image description here

As far as I know in case 1 a is related to b, and a is aware of b so a is able to send messages to b, but b is not aware of a so b is not able to send messages to a.

In the other hand, in case 2 a is related to b, and both of them are aware of each other, both of them are able to send messages to the other.

But my question is what about that when the relationship is not association but aggregation? Could an aggregation relationship have bidirectional navegability in UML so both instances are aware of each other?

In case a owns b, consequently a is aware of b. (in other words a is able to send messages to b). but what about the other way around, does b is aware of a? or does this could never be the case? or this is just not specified in the diagram and this could be both ways? and, in case b has to be aware of a how would that be expressed(I've never seen an aggregation line with an arrowhead in the other end)?

does all of this applies in the same way for composition?

Another thing slightly related to this I Was wondering, could a non bi-directional association have two roles?

As far as I know this could not be possible because a non bi-directional relationship is a relation when just one of the related instances is aware of the other, and a role means how an instance perceive another one, so we need that both instances are aware of each other to be able to have two roles, is this correct?

sir psycho sexy
  • 780
  • 7
  • 19

1 Answers1

0

Directed associations as per UML 2.5:

A DirectedRelationship represents a relationship between a collection of source model Elements and a collection of target model Elements.

So this does not say much. And in fact you can simply leave it away. There is a concept of non-navigability which explicitly rules out navigation.

Ownership is not shown by an arrow but by a dot near the owning class. enter image description here

Another cite from Superstructures (p. 200 in chap. 11.5 Associations):

Navigability notation was often used in the past according to an informal convention, whereby non-navigable ends were assumed to be owned by the Association whereas navigable ends were assumed to be owned by the Classifier at the opposite end. This convention is now deprecated. Aggregation type, navigability, and end ownership are separate concepts, each with their own explicit notation. Association ends owned by classes are always navigable, while those owned by associations may be navigable or not.

If you specify a role name that explicitly means you have navigability towards the named class.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86