16.7. Keywords
A UML keyword is a textual adornment to categorize a model element. For example, the keyword to categorize that a classifier box is an interface is (shocking surprise!) «interface». Figure 16.1 illustrates the «interface» keyword. The «actor» keyword was used on p. 91 to replace the human stick-figure actor icon with a class box to model computer-system or robotic actors.Guideline :
When sketching UMLwhen we want speed, ease, and creative flowmodelers often simplify keywords to something like '<interface>' or '<I>'.Most keywords are shown in guillemet (« »)[2] but some are shown in curly braces, such as {abstract} , which is a constraint containing the abstract keyword. In general, when a UML element says it can have a "property string"such as a UML operation and UML association end havesome of the property string terms will be keywords (and some may be user defined terms) used in the curly brace format.
[2] Note that in UML 1, guillemet (« ») were only used for stereotypes . In UML 2, guillemets are used for both keywords and stereotypes.
constraints p. 265 Figure 16.1 illustrates both the «interface» and {abstract} keywords.A few sample predefined UML keywords include:[3]
[3] There are many keywords. Refer to the UML specification for details.
Keyword | Meaning | Example Usage |
---|---|---|
«actor» | classifier is an actor | in class diagram, above classifier name |
«interface» | classifier is an interface | in class diagram, above classifier name |
{abstract} | abstract element; can't be instantiated | in class diagrams, after classifier name or operation name |
{ordered} | a set of objects have some imposed order | in class diagrams, at an association end |