Open ronaldtse opened 4 years ago
Vote for the first proposal. But I am not sure about square brackets for now. Possibly, we will need sth else, but OK for now.
Actually the "first" "second" refer to different parts of the diagram, so both are proposals. (The first is a Class Diagram (for classes), the second is an Object Diagram (for instances)).
The square brackets for multiplicity is the convention for UML, so we should definitely use it.
In any case, multiplicity value of *
is just a shorthand for 0..*
.
@ronaldtse is this notation equal to the notation you gave as an example in #8?
class Relationship {
+/relatedElement: Element[1..*] {union}
}
class Element {}
class Customer {
association +bookings: Bookings[*]
}
class Bookings
If it is we can just use the shorthand notation.
@w00lf yes, the notation I used in #8 was just an early example, which we should now define properly.
For the second example, I think this is sufficient?
class Customer {
+bookings: Bookings[*]
}
class Bookings
As mentioned in the other ticket, the "association" is already created by the "typed element" (+bookings: Bookings[*]
). If we want to show the "association" in a diagram, we should say it in the diagram definition.
e.g.
view MyView {
import Relationship, Element
render_option typed_as_associations
file "my_view.png"
}
Multiplicities
A multiplicity element is the definition of an interval of positive integers to specify allowable cardinalities.
A cardinality is a concrete number of elements in a set.
A multiplicity element is often simply called multiplicity; the two terms are synonymous.
The notation for multiplicity is either a single number or a value range.
A value range is written by stating the minimum and maximum values, separated by two dots (e.g. 1..5).
In addition, you can use the wildcard character * to specify an arbitrary number of elements.
Examples of multiplicities
0..1
1
(shortcut for1..1
)*
(shortcut for0..*
)1..*
5..3
(Invalid!)-1..0
(Invalid! All values must be positive)3+5..7+1
(Generally meaningless, but valid; the lower or upper value, respectively is defined by a value specification).Proposal:
First:
Second: