Previous UML Classes Table of Contents UML Packages Next

12.3.52 Variable


   Variables are elements for passing data between actions indirectly. A local variable stores values shared by the actions within a structured activity group but not accessible outside it. The output of an action may be written to a variable and read for the input to a subsequent action, which is effectively an indirect data flow path. Because there is no predefined relationship between actions that read and write variables, these actions must be sequenced by control flows to prevent race conditions that may occur between actions that read or write the same variable.



   A variable specifies data storage shared by the actions within a group. There are actions to write and read variables. These actions are treated as side effecting actions, similar to the actions to write and read object attributes and associations. There are no sequencing constraints among actions that access the same variable. Such actions must be explicitly coordinated by control flows or other constraints.

   Any values contained by a variable must conform to the type of the variable and have cardinalities allowed by the multiplicity of the variable.


Issue 9000 - add subsets constraints


   No additional attributes


   [1] A variable is owned by a StructuredNode or Activity, but not both.

   Additional operations

   [1] The isAccessibleBy() operation is not defined in standard UML. Implementations should define it to specify which actions can access a variable.

   isAccessibleBy(a: Action) : Boolean


   A variable specifies a slot able to hold a value or a sequence of values, consistent with the multiplicity of the variable. The values held in this slot may be accessed from any action contained directly or indirectly within the group action or activity that is the scope of the variable.


   No specific notation

   Variables are introduced to simplify translation of common programming languages into activity models for those applications that do not require object flow information to be readily accessible. However, source programs that set variables only once can be easily translated to use object flows from the action that determines the values to the actions that use them. Source programs that set variables more than once can be translated to object flows by introducing a local object containing attributes for the variables, or one object per variable combined with data store nodes.

*Changes from UML 1.5

   Variable is unchanged from UML 1.5, except that it is used on StructuredActivityNode instead of GroupNode.