Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UML syntax: Properties #22

Closed
ronaldtse opened this issue Aug 4, 2020 · 1 comment
Closed

UML syntax: Properties #22

ronaldtse opened this issue Aug 4, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@ronaldtse
Copy link
Contributor

ronaldtse commented Aug 4, 2020

Properties

  • Def.- A property is a special structural feature that if it belongs to a class, is an attribute.
  • (However, it can also belong to an association. But more about this later).

Notation & Semantics

  • An attribute is a (data) element that is equally contained in every object of a class and that is represented by an individual value in each object.
  • Attributes have no identity outside the object to which they belong.
  • Attributes are fully under the control of the objects of which they are part.

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:

  • 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 }: the property is a subset of .
    • {redefines }: the property is a new definition of (overwritten by inheritance).
  • Property string indicates a modifier that applies to the attribute:

    • {ordered}, {unordered}: an ordered or unordered set.
    • {unique}, {nonunique} or {bag}: a set may or may not contain several identical elements.
    • {sequence}: an ordered list (array; identical elements permitted).
    • {composite}: the property is an existence-dependent part and others.
  • If the multiplicity is greater than 1, then the attribute represents a set.

  • Additional information can be specified for the order (isOrdered) and uniqueness (isUnique). (see Multiplicity metamodel).

  • Depending on the combination of these two pieces of information, we obtain different collection classes (see next table).

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

  • name:String = ‘unknown’
  • birthDate:Date
  • radius: Integer = 25 {readonly}
  • /age:Integer {age=today-birthDate}
  • -versionNo:Integer
  • time:DateTime::Time
  • dynamArray[*] {ordered}
  • name:String[1]
  • firstName:String[0..1]
  • firstNames:String[1..5]
@ronaldtse ronaldtse added the enhancement New feature or request label Aug 4, 2020
w00lf added a commit that referenced this issue Aug 23, 2020
#22 basic properties syntax support, specs from concept-model examples. Hound fixes
@w00lf
Copy link
Contributor

w00lf commented Aug 4, 2021

The full properties syntax was implemented in gem.

@w00lf w00lf closed this as completed Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants