Previous | UML Classes | Table of Contents | UML Packages | Next |
•
Property (from Kernel , AssociationClasses ) on page 125
(merge increment)
A property represents a set of instances that are owned by a containing classifier instance.
No additional attributes
No additional associations
No additional constraints
When an instance of the containing classifier is created, a set of instances corresponding to its properties may be created
either immediately or at some later time. These instances are instances of the classifier typing the property. A property
specifies that a set of instances may exist; this set of instances is a subset of the total set of instances specified by
the classifier typing the property.
A part declares that an instance of this classifier may contain a set of instances by composition. All such instances are
destroyed when the containing classifier instance is destroyed. Figure 9.20 shows two possible views of the
Car class. In subfigure (i), Car is shown as having a composition association with role name rear to a class Wheel and an
association with role name e to a class Engine. In subfigure (ii), the same is specified. However, in addition, in subfigure
(ii) it is specified that rear and e belong to the internal structure of the class Car. This allows specification of detail
that holds only for instances of the Wheel and Engine classes within the context of the class Car, but which will not hold
for wheels and engines in general. For example, subfigure (i) specifies that any instance of class Engine can be linked to
an arbitrary number of instances of class Wheel. Subfigure (ii), however, specifies that within the context of class Car,
the instance playing the role of e may only be connected to two instances playing the role of rear. In addition, the instances
playing the e and rear roles may only be linked if they are roles of the same instance of class Car.
In other words, subfigure (ii) asserts additional constraints on the instances of the classes Wheel and Engine, when they
are playing the respective roles within an instance of class Car. These constraints are not true for instances of Wheel and
Engine in general. Other wheels and engines may be arbitrarily linked as specified in subfigure (i).
Car | |||||
rear : Wheel [2] | 2 | a: Axle | 1 | e : Engine |
(ii )
(i )
Figure 9.20 - Properties
A part is shown by graphical nesting of a box symbol with a solid outline representing the part within the symbol representing
the containing classifier in a separate compartment. A property specifying an instance that is not owned by composition by
the instance of the containing classifier is shown by graphical nesting of a box symbol with a dashed outline.
The contained box symbol has only a name compartment, which contains a string according to the syntax defined in the Notation
subsection of
Property (from Kernel , AssociationClasses ) on page 125. Detail may be shown within the box
symbol indicating specific values for properties of the type classifier when instances corresponding to the property symbol
are created.
The multiplicity for a property may also be shown as a multiplicity mark in the top right corner of the part box.
A property symbol may be shown containing just a single name (without the colon) in its name string. This implies the definition
of an anonymously named class nested within the namespace of the containing class. The part has this anonymous class as its
type. Every occurrence of an anonymous class is different from any other occurrence. The anonymously defined class has the
properties specified with the part symbol. It is allowed to show compartments defining attributes and operations of the anonymously
named class.
e: Engine [1..2]
Figure 9.21 - Property examples
Figure 9.21 shows examples of properties. On the left, the property denotes that the containing instance will own four
instances of the Wheel class by composition. The multiplicity is shown using the presentation option discussed above. The
property on the right denotes that the containing instance will reference one or two instances of the Engine class. For
additional examples, see 9.3.13, StructuredClassifier (from InternalStructures ), on page 193.
A connectable element used in a collaboration subsumes the concept of ClassifierRole.