lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

UML syntax: Multiplicities #15

Open ronaldtse opened 4 years ago

ronaldtse commented 4 years ago

Multiplicities

Examples of multiplicities

Screen Shot 2020-08-05 at 12 43 22 AM

Proposal:

First:

class Customer {
  association +bookings: Bookings[*]
}

class Bookings

// Or:
association Customer+bookings: Bookings[0..*]

Second:

instance :Kunde

instance r2:Bookings {}
instance r3:Bookings {}
instance r4:Bookings {}

association r2:Bookings -> :Kunde
association r3:Bookings -> :Kunde
association r4:Bookings -> :Kunde
DmitryDrobotov commented 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.

ronaldtse commented 4 years ago

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

w00lf commented 4 years ago

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

ronaldtse commented 4 years ago

@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"
}