lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

UML syntax: Properties #22

Closed ronaldtse closed 3 years ago

ronaldtse commented 4 years ago

Properties

Notation & Semantics

Screen Shot 2020-08-05 at 2 01 14 AM

Proposal: (both diagrams mean the same thing -- we should only have one way of specifying this; it is only the rendering that is different)

Example Attributes
# Syntax: [visibility][/] name [:type][multiplicity][=initial value][{property string}]
#  Visibility:
#    - + public: it can be seen and used by all.
#    - -private: only the class itself can get hold of private attributes.
#    - #protected: both the class itself and its subclasses have access.
#    - ~ package: only classes from the same package can access these attributes.
#  - / symbolizes a derived attribute.
#  - Multiplicity is in square brackets (e.g. [1..*]).
#  - Default value specifies the initial value of the attribute.
#  Property string indicates a modifier that applies to the attribute:
#    - {readonly}: the property can be read but not changed.
#    - {union}: the property is a union of subsets.
#    - {subsets <property>}: the property is a subset of <property>.
#    - {redefines <property>}: the property is a new definition of <property> (overwritten by inheritance).

# Multiplicity collection classes
# ordered set {ordered}
# set {set}
# ordered list {sequence}
# {bag}

class Customer {
  -bookings: Bookings[0..*]
}

Attribute full syntax [visibility][/] name [:type][multiplicity][=initial value][{property string}]

Where:

IsUnique isOrdered Collection Class
Yes Yes Ordered set {ordered}
Yes No Set (default)
No Yes Ordered list {sequence}
No No {bag}
Screen Shot 2020-08-05 at 2 05 14 AM
class Customer {
  -booker: Booking[1]
}

class Booking {
  -bookings: Customer[0..*]
}
Screen Shot 2020-08-05 at 2 05 34 AM

Examples of multiplicity collection classes

w00lf commented 3 years ago

The full properties syntax was implemented in gem.