UML: Bi-directional and Multiplicity - uml

What is the notation for multiplicity when there isa bidirectional relationship? Are we supposed to list the multiplicity twice for at each arrow?

Multiplicity does not depend on navigation (I assume that by bidirectional you are referring to the navigability of the associations). They are two independent properties. So, yes, multiplicities must be indicated for each end of the relationship

Graphical notation of an association does not have arrows at the end of the association links. Some tools such as eUML or others are adding arrows at the end but this is not a valid UML notation.
If the association is navigable in just one side then you need an arrow at one of the end.

Related

What is Navigability in UML diagrams?

What is an example of Navigability in UML diagrams? My professor has provided the follow figure, but I can't seem to figure it out:
This shows navigability. A can see (means it has an attribute referencing) B. In contrast B has no idea about/reference to A. As #JimL commented, your arrow is wrong and only used for stereotype definition. I'm referring to the unfilled arrow which indicates navigability of associations from which I assume you actually meant that.
UML 2.5 spec p. 18:
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.
An association with neither end marked by navigability arrows means that the association is navigable in both directions.
And even more relevant p. 200:
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.
So you should use the dot notation instead:
The UML specs is an intricate pile of alternative notations that can drive you crazy. Explore with caution!
In real life, KEEP IT SIMPLE! Don't use "dot notation" and don't use x to denote non-navigability, unless your peers are familiar with it.
Use arrows for navigable associations. People are familiar with it, or if not they're intuitive enough.

Can association lines be merged in one line in UML?

Is it in accordance with the UML standard to merge a few association lines into one line, like on the attached diagram?
Yes, I think this is allowed as a notational variant, which implies that all association ends that participate in the merger, have the same properties (e.g. the same multiplicity, navigability, visibility, etc.).
Figure 11.34 in the UML 2.5 spec shows an example of such a merged association end sharing the same source segment of the association line.
(Edited answer.) In the UML specification a "shared target style" is defined in Figure 9.23 - Examples of generalizations between classes, see http://www.omg.org/spec/UML/2.4.1/ on page 52.
Edit: In the spec, however, this refers only to generalizations, which are not a subtype of associations but of relationships (thanks to #xmojmr for the pointer to the UML superstructure).
In addition to the notation mentioned by #gwag, here is the original caption for that figure:
Figure 11.34 shows a (...) model using the notational option of sharing the same source segment between multiple compositions. The multiplicity and name adornments on the shared end apply to all of the compositions. The model values for absent adornments on the merged segment, such as property modifiers or visibility, may differ.
Found on page 214.
So called "tree style" is allowed in generalization and composition (aggregation) at the aggregation end.
But you probably see, that it is unclear to understand which classes are associated from your diagram. Is there association between Client -> Address, and Address <-> Contact details, Or Client -> Contact details and Client -> Address ???
Or all of it ?
Shared lines can add ambiguity to your model.

How to model dependencies over multiple levels in UML?

I want to make an UML diagram and show the dependencies between three classes: TransparentOverlayCamera, ViewCameraView and SubpartCameraPreview.
TransparentOverlayCamera has access to ViewCameraView and the other way around. So I used a bidirectional association.
ViewCameraView has access to SubpartCameraPreview but not the other way around. So I used a unidirectional association.
But ViewCameraView also passes an instance of TransparentOverlayCamera to SubpartCameraView, so that it has access to TransparentOverlayCamera.
How do I model this last association in UML correctly?
You can draw the usage dependency link from SubpartCameraView to TransparentOverlayCamera
If you want to avoid circles and keep your architecture layered then cross-layer dependencies are often modeled through <<interface>> as in this example: http://www.uml-diagrams.org/design-pattern-abstract-factory-uml-class-diagram-example.html
See also: http://www.uml-diagrams.org/component-diagrams.html#provided-interface
There is not necessary to use dependency relationship in your model.
If you need to define structural relationship between classes , association is enough.
Be careful, association has no direction. Arrows at the association end represents navigability. Navigability defines that, instance at the association end is unambiguously identifiable. Association does not define communication as well.
If something is passed to instance, it is not a structural model but behavioral. You probably mean passing argument to operation. You need to define operation with arguments of specific type.
From you example: TransparentOverlayCamera will be set as argument type of operation defined on SubpartCameraView class.

UML Aggregation with and without arrow head

I always thought that the UML aggregate is defined as a black (filled) diamond at the beginning of a path and no arrow head that the end:
|--------| |--------|
| :MyA |<>------| :MyB |
|--------| |--------|
Today I came across a notation like <>-----> (with an explicit arrow head on the right end). So I looked it up in the UML 2.4 specification and actually found references for both versions.
My favourite reference: "UML and Patterns" by Craig Larman only mentions the first version without the arrow. In the UML specification I found a notice about navigable ends, but I am not sure if this is related and if whats the difference?
Could someone explain this more thoroughly and give an example for the use of each version?
Any association end can be designated to be "navigable" with the help of a navigability arrow. However, UML's notion of "navigability" does not have a precise meaning and people confused it with the concept of an association end being owned by the class at the other end. This concept of association end ownership by a class means that the association end corresponds to a reference property of that class. This issue has only been clarified in last year's new UML version 2.5, which has introduced a new visual notation for association end ownership, a "dot" as in . This is most likely the intended meaning of what you came across, namely , and what it really means is the following reference property:
For more explanation see this tutorial.
Additional answer to the comment: If your class model specifies the ownership of all association ends, and your class diagram displays them, and there is no ownership dot (nor a navigability arrow), as in , then, according to UML 2.5, the association end is "owned" by the association itself. Since we do neither have an ownership dot at the MyA end, both ends are "owned" by the composite association. In terms of the code to write/generate, this would mean that the composite association is not implemented by means of reference properties in either MyA or MyB, but has to be implemented with the help of a separate class, say "MyA-has-MyB", which has two reference properties for referencing both the aggregate and the component of any composition link, as in the following class rectangle:
One arrow means the association is navigable this way. No arrows means the association is navigable BOTH ways. Two arrows are omitted.
It could be a problem, because two ends with undefined navigability look out the same way, but it is the standard.
You can read more thoroughly about associations/navigability/aggregations in this my answer https://stackoverflow.com/a/21478862/715269
Direction implies a client/server or master/slave relationship. In the case of aggregation, the usual situation is the programmer uses the aggregate to find the sub-components for that object (e.g., use the car to find the car parts). Directionality towards the part class makes this relationship explicit, though in most cases it is redundant.
An association has two ends. An association’s end is modeled by means of a UML Property which can be owned by the classifier involved at the related end of the association, in that case the association is said to be navigable as the source classifier can directly refer to the target instance (the instance at the other end of the association) by means of that property. Otherwise the property representing the association end may be owned by the association instance itself
see http://lowcoupling.com/post/47802411601/uml-diagrams-and-models-with-papyrus

What are these UML symbols?

What are are the meanings of symbols marked 1,2 & 3 ?
The first one is aggregation.
The second one is a connector for the comment
The thirs is a dependency.
1) aggregation (special form of association)
2) this is simply the connector for the comment
3) generic dependency
1) the open diamond means weak form of aggregation. This relationship denotes that
the aggregate class (the class with the white diamond touching it) is in some way the “whole”, and the other class in the relationship is somehow “part” of that whole.
2) Similar notation is used to represent an interface, but I don't think this is the case here, ergo - I don't know what it is.
3) The dashed arrow is a dependency relationship or ‘using’ relationship. This relationship simply means that ConcreteBuilder somehow depends upon Product. This is very weak relationship and is not implemented with member variables at all.

Resources