Prev Next

Interaction Occurrence

An Interaction Occurrence used in Sequence diagrams as modeled in Sparx Systems Enterprise Architect.

An Interaction Occurrence (or InteractionUse) is a reference to an existing Interaction (Sequence) diagram. Interaction Occurrences are visually represented by a frame, with 'ref' in the frame's title space. The diagram name is indicated in the frame contents.

To create an Interaction Occurrence, simply open a Sequence diagram (preferably contained within an Interaction element) and drag another Sequence diagram (also preferably contained within an Interaction element) into its workspace. A dialog displays, providing configuration options. The resulting Interaction Occurrence acts as an invocation of the original Interaction. You use the 'Call' tab of the Properties window for the element to set up the actual arguments of the Interaction and also to change to a different associated Interaction element.

This figure illustrates the use of an Interaction Occurrence in another Interaction (Sequence) diagram. You can display the sequence represented by the Interaction Occurrence by double-clicking on the element.

Part of a UML Sequence diagram showing the use of an Interaction Occurrence (ref Fragment).

Fill Opacity

Whilst an Interaction Occurrence usually encloses a number of other elements, there might be reasons for hiding those elements as well as times to fully show them, or perhaps just indicate that they are there, depending on the immediate purpose of the diagram. You can apply these nuances in the display of elements behind and covered or overlapped by an Interaction Occurrence, by changing the opacity of the element.

Before setting the opacity, check that the element has a fill color.

You set the opacity using an icon from either of these two pop-up element toolbars:

  • Click on the Interaction Occurrence element and on the icon:
  • Right-click on the Interaction Occurrence element and look above the context menu:

Click on the icon and select:

  • 100% for total opacity, where the elements behind and overlapping or covered by the Interaction Occurrence are hidden (you could right-click on individual elements and select the 'Z-Order | Bring to Top' option to expose those elements only)
  • 0% for no opacity, where the fill color is not applied and anything behind the Interaction Occurrence is fully visible
  • 75%, 50% or 25% to set the appropriate degree of opacity and make the covered elements visible but over-shaded

Notes

  • The behavioral code generation engine expects the Sequence diagram and all its associated messages and interaction fragments to be encapsulated within an Interaction element (such as doReadUSB in this example)

    Showing a UML Sequence diagram nested in an Interaction Occurrence element in the Project Browser.

Learn more

OMG UML Specification:

The OMG UML specification (UML Superstructure Specification, v2.1.1, p.423) refers to an Interaction Occurrence as an InteractionUse, and states:

An InteractionUse refers to an Interaction. The InteractionUse is a shorthand for copying the contents of the referred Interaction where the InteractionUse is. To be accurate the copying must take into account substituting parameters with arguments and connect the formal gates with the actual ones.

It is common to want to share portions of an interaction between several other interactions. An InteractionUse allows multiple interactions to reference an interaction that represents a common portion of their specification.