UML Profile Extension

An extension is association relationship used to indicate that the properties of a metaclass are extended through a stereotype, and gives the ability to flexibly add stereotypes to classes and remove later, if necessary.

One end of the extension association is an ordinary property and the other end is an extension end. The property ties the extension to a metaclass, while the extension end ties the extension to the stereotype extending the metaclass.

Extension end is a navigable end, owned by extension. This allows a stereotype instance to be attached to an instance of the extended classifier without adding a property to the classifier. Note, that until UML 2.3 extension end was "never navigable".

The notation for an extension is an arrow with the filled triangle arrowhead pointing from a stereotype to the extended metaclass.

Extension is an association indicating that the properties of a metaclass are extended through a stereotype

Metaclass Class is extended by stereotype Customer.

Because extension is subclass of association, it may have usual association adornments, but navigability arrows should not be shown. Adornments of an extension are typically suppressed.

A non-required extension means that an instance of a stereotype can be linked to an instance of an extended metaclass at will, and also later deleted at will. However, there is no requirement that each instance of a metaclass be extended. An instance of a stereotype is deleted when either the instance of the extended metaclass is deleted, or when the profile defining the stereotype is removed from the applied profiles of the package.

By default, extension is non-required. When extension has no adornments, it could either mean the default value or that the {required} adornment was suppressed. Multiplicity 0..1 on the extension end could be used as an alternative to non-required extension.

A required extension means that an instance of a stereotype must always be linked to an instance of the extended metaclass. The instance of the stereotype is typically deleted only when either the instance of the extended metaclass is deleted, or when the profile defining the stereotype is removed from the applied profiles of the package.

Required extension is shown using the {required} property near the extension end.

If extension is required, the property {required} is shown near the extension end.

Required extension of metaclass Component by stereotype WebService.

It is also allowed to use multiplicity 1 on the extension end as an alternative to the {required}.

A metaclass may be extended by one or more stereotypes. This is obvious and expected.

Each stereotype may extend one or more metaclasses. This might cause some confusion. For example, UML 2.3 specification explains its Figure 18.16 as "the same stereotype Clock can extend either the metaclass Component or the metaclass Class." Either is confusing as it suggests that extension is kind of or relationship but not and as we'd assume.

The same "either" approach is applied in [SoaML 1.0 Beta 2] - stereotype Provider extends either (or both?) Interface or Class metaclasses. The SoaML explains that Interface is used in the case of a non composite service contract while Class - in the case of a composite service contract.

Stereotype Provider extends either (or both?) Interface or Class metaclasses.

Stereotype Provider extends either (or both?) Interface or Class metaclasses.