Skip to main content

Keyword (UML)

A Keyword in UML is a predefined and reserved word available with the meta-model of UML.

Notation

Some keywords are wrapped in an opening and a closing guillemet (U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, “«”, U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, “»”). A guillemet is often confused with a duplicate U+003C LESS-THAN SIGN, “<” (<<) and U+003E GREATER-THAN SIGN, “>” (>>)

wrong: <<create>>

correct: «create»

Keyword vs. Stereotype

While the notation for some Keywords is the same as for Stereotypes, they do not necessarily refer to the same:

"[...] many use the term stereotype to mean the same as keyword, although that is no longer correct." [📖UML, p. 66]

Martin Fowler refers in this quote to the differences between UML 1 and UML 2, whereas in UML 1 the "guillemets where used mainly for stereotypes." [📖UML, p. 66]: While a Keyword is pre-defined in the meta-model of UML, a Stereotype can be a custom defined model extending an element from the UML meta-model. Stereotypes can be used for providing additional or specifying functional and semantic context in an otherwise ambiguous situation.

Example

Keywords such as «create», «use» or «call» are used to further specify a Dependency between two elements and provide the context of the Relationship Type of this Dependency.

In the following example, a Dependency between Client and Supplier exists. Specifying the Relationship can dramatically change the understanding of the diagram.

Figure 1 The context of the dependency is not further specified.
Figure 2 The context of the dependency is specified with the keyword «create», the relationship is of type "Usage"
Figure 3 Client is now substitutable for Supplier. The relationship is now of type "Substitution"

see also