The extends and replaces variability relationship combines the effects
of extends and replaces variability
into one variability type. Whereas replaces variability completely replaces
all attributes and outgoing associations of the base element with new values
and instances, or removes all values or associations if the replacing element
does not define any, extends and replaces variability only replaces values
that have been redefined. All other values of the base element are unaffected.
In other words, extends and replaces allows users to selectively replace specific
attributes and associations of the base elements. This type of variability
can be used to generate method plug-ins that rename elements, or replace some
descriptions of method elements with new ones, without completely remodeling
all other relationships and attributes needed by the base plug-in.
Extends and replaces association rules
- Extends and replace variability combines the effects of the extends and
the replaces variability. The evaluation will first perform the effects of
the extends and then the effects of the replaces variability. This implies
the following:
- First, the new element will inherit all attributes and associations from
the based element.
- Second, the new elements might override inherited attributes or associations.
- Third, the base element will be replaced with new element using the overridden
values and if no override was specified keeping the inherited values.
- If the extends and replaces element defines outgoing associations, they
will replace all outgoing associations of the base elements. If the extends
and replaces element does not define any new associations, the resulting element
will retain the associations of the base element.
- Incoming associations from the base element are added to the replacing
element.
- If the extends and replaces element defines attributes, these attributes
are replaced in the resulting element including the base element's identifier.
Undefined attributes retain values used in the base element.
- The base element of a replaces relationship or an extends and replaces
relationship can have only one replaces or extends and replaces element per
configuration. If more than one element is present, no replacement takes place.
- The extends and replaces relationship is transitive and evaluated top-down
relative to the direction of the replacement. If a replacing element is also
replaced, the final replacing element prevails.
- Contributes variability relationships are resolved before replaces and
extends and replaces relationships. Extends relationships are resolved last.
Variability is always resolved top-down from the base to the variability elements.
Within the same level, contributes relationships are resolved first. Replaces
or extends and replaces are resolved afterwards.
How to add an extends and replaces association
- Use the Content Variability section on the Description tab
to make an element extend and replace another element.
- Select Extends and Replaces as the variability type and select
the base element that this element will replace. Note that the base element
must be the same type of element as the replacing element.