Search code examples
associationsumldiagram

Aggregation and navigability at the same end


In UML, is it possible to draw an aggregation where the component object can access the composite object? Like in this image, but with only one association line, so the association end touching A would have a diamond and an arrow. If that isn't possible, the diagram I drawn is valid? If not, why?


Solution

  • Another point of view, navigability is important to show how is it possible to navigate in the model and how to access to instances.

    Another point is about OCL, if navigability is not defined some OCL queries will be hard to write.

    Specification describes (p 198): Navigability means that instances participating in links at runtime (instances of an Association) can be accessed efficiently from instances at the other ends of the Association. The precise mechanism by which such efficient access is achieved is implementation specific. If an end is not navigable, access from the other ends may or may not be possible, and if it is, it might not be efficient.

    And about Property class (p 149): The query isNavigable() indicates whether it is possible to navigate across the property. body: not classifier->isEmpty() or association.navigableOwnedEnd->includes(self).

    So to model or not navigability is important.

    If you want to have navigability in both side, the following image shows that:

    enter image description here

    But in section 6 of the specifiation, it is written:

    • An association with neither end marked by navigability arrows means that the association is navigable in both directions.

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

    So the following schema is the same than the above one. This is tricky but it seems true.

    enter image description here