|Previous||UML Classes||Table of Contents||UML Packages||Next|
AddStructuralFeatureValueAction is a write structural feature action for adding values to a structural feature.
WriteStructuralFeatureAction (from IntermediateActions ) on page 304.
Structural Features are potentially multi-valued and ordered, so the action supports specification of insertion points for
new values. It also supports the removal of existing values of the structural feature before the new value is added.
The object to access is specified dynamically, by referring to an input pin on which the object will be placed at runtime.
The type of the value of this pin is the classifier that owns the specified structural feature, and the value’s multiplicity
• isReplaceAll : Boolean [1..1] = false Specifies whether existing values of the structural feature of the object should be
removed before adding the new value.
• insertAt : InputPin [0..1] Gives the position at which to insert a new value or move an existing value in ordered structural
features. The type of the pin is UnlimitedNatural, but the value cannot be zero. This pin is omitted for unordered structural
features. (Subsets Action::input)
 Actions adding a value to ordered structural features must have a single input pin for the insertion point with type
UnlimitedNatural and multiplicity of 1..1, otherwise the action has no input pin for the insertion point.
let insertAtPins : Collection = self.insertAt in
if self.structuralFeature.isOrdered = #false
then insertAtPins->size() = 0
else let insertAtPin : InputPin= insertAt->asSequence()->first() in
insertAtPins->size() = 1
and insertAtPin.type = UnlimitedNatural
Issue 8356 - replace ‘non-unique’ with ‘unique’
If isReplaceAll is true, then the existing values of the structural feature are removed before the new one added, except if
the new value already exists, then it is not removed under this option. If isReplaceAll is false and the structural feature
is unordered and unique, then adding an existing value has no effect. If the feature is an association end, the semantics
are the same as creating a link, the participants of which are the object owning the structural feature and the new value.
Values of a structural feature may be ordered or unordered, even if the multiplicity maximum is 1. Adding values to ordered
structural features requires an insertion point for a new value using the insertAt input pin. The insertion point is a positive
integer giving the position to insert the value, or unlimited, to insert at the end. A positive integer less than or equal
to the current number of values means to insert the new value at that position in the sequence of existing values, with the
integer one meaning the new value will be first in the sequence. A value of unlimited for insertAt means to insert the new
value at the end of the sequence. The semantics is undefined for a value of zero or an integer greater than the number of
existing values. The insertion point is required for ordered structural features and omitted for unordered structural features.
Reinserting an existing value at a new position in an ordered unique structural feature moves the value to that position (this
works because structural feature values are sets). The insertion point is ignored when replacing all values.
The semantics is undefined for adding a value that violates the upper multiplicity of the structural feature. Removing a value
succeeds even when that violates the minimum multiplicity—the same as if the minimum were zero. The modeler must determine
when minimum multiplicity of structural features should be enforced.
The semantics is undefined for adding a new value for a structural feature with isReadonly=true after initialization of the
No specific notation
AddStructuralFeatureValueAction is introduced to add structural feature values. isReplaceAll is introduced to replace and
add in a single action, with no intermediate states of the object where only some of the existing values are present.
AddStructuralFeatureValueAction is new in UML 2.0. It generalizes AddAttributeAction in UML 1.5.