Skip to main content

Sequence Diagram

Overview

You can use a sequence diagram to visualize the flow of mutual processing between objects.
This page explains the operations for using sequence diagrams in the following order:

  • Placing a sequence diagram
  • Defining lifelines
  • Defining messages
  • Defining composite fragments
  • Defining interaction usage

The following functions are also provided to assist users in modeling.
These will also be explained in order:

  • Validating the model
  • Setting the display content

Sequence Diagram

Placing a sequence diagram

To place a sequence diagram, follow the steps below.

Placing a Sequence Diagram

Instructions
  1. Select a package in the Model Navigator and click [Add Model] > [Sequence Diagram] from the context menu.
  2. The sequence diagram will be placed as a child element of the selected package.

Defining a Lifeline

To define a lifeline, follow these steps:

Drag and Drop an Existing Class to Create a Lifeline

Instructions
  1. Select an existing class in the Model Navigator and drag and drop it onto the sequence diagram.
  2. A new lifeline with the selected class as its type will be created in the displayed sequence diagram.

:::note: Elements that can be added from the Toolbox

The following elements displayed in the Toolbox can be added to sequence diagrams.

IconName
LifelineLifeline
FragmentCompound Fragment
Use of InteractionInteraction Use
Interaction NoteInteraction Note
DestructionDestruction

:::

Define an Untyped Lifeline

You can create an untyped lifeline by dragging and dropping [Lifeline] from the Toolbox onto a sequence diagram.

Create a Lifeline from the Toolbox

tip

To change a lifeline's type, select it on the sequence diagram and click Change Lifeline Type in the context menu.

Available Lifeline Types
The following elements can be specified for a lifeline's type:

IconName
ClassClass
InterfaceInterface
ComponentComponent
ActorActor
BlockBlock

Define a Message

To define a message, follow these steps:

Create a message from lifeline A to lifeline B

Instructions
  1. In a sequence diagram, hover the mouse over a lifeline to display a filled triangle icon.
  2. Drag and drop the icon onto the target lifeline.
  3. When the finder appears, select the operation corresponding to the message and click the [OK] button.
  4. A synchronous message is created for the target lifeline.
Elements that can be added from the Toolbox

The following elements, displayed in the Sub Toolbox, can be added to a sequence diagram.

IconName
Synchronous MessageSynchronous Message
Asynchronous MessageAsynchronous Message
Reply MessageReply Message
Create MessageCreate Message
Destroy MessageDestroy Message

To add these messages, select the desired message type in the sub-toolbox and then add the message.

:::note: About Message Text Notation

When you enter message operation text on a sequence diagram, the text is parsed according to the message operation notation format.
Of course, changing the values of each field will reflect the changes in the text on the diagram.

Edit a message on a sequence diagram and reflect it in the model

Message Text Format and Correspondence Between Field Values
Messages are displayed and parsed according to the following format.

  • For request messages (other than response messages)
    <Request message> ::= <Message name> ['('[<List of arguments>] ')'] [':'<Return value type>]
    • supplement
      • <List of arguments> is displayed in the following format.
        • <List of arguments> ::= <Arguments> [','<Arguments>]*
        • <Argument> ::= [<Argument name> '='] <Argument value> | '-'
    • Example
      Message name: Drive
      Argument 1 name: m, value: 100
      Argument 2 name: s, value: 200
      Return type: boolean
      In this case, the following text will be displayed.
      Drive(m=100, s=200) : boolean
    • Note
      • <return type> is ignored when setting.
  • For response messages
    <Response message> ::= [<Return value variable name> '='] <Message name>['(' [<List of arguments>] ')'] [':' <Return value>]
    • supplement
      • <List of arguments> is displayed in the following format.
        • <List of arguments> ::= <Arguments> [','<Arguments>]*
        • <Argument> ::= [<Argument variable name> '='] <Argument name> [':' <Argument value>]
    • Example
      Return value variable name: return_value, return value: true
      Message name: Drive
      Argument 1 variable name: miles, argument name: m, value: 200
      Argument 2 variable name: speed, argument name: s, value: 100
      In this case, the following text will be displayed.
      return_value=Drive(miles=m:200, speed:s=100) : true

:::

tip

To change the operation associated with a message, select the message and click Change Message Type in the context menu.

Define composite fragment

To define a composite fragment, follow these steps:

Definition combined fragment

Instructions
  1. Select a combined fragment in the Toolbox and drag and drop it onto the sequence diagram.
  2. Double-click the upper left corner of the added combined fragment to display a drop-down list of types, allowing you to select the type of combined fragment you want to add.
List of Combined Fragment Types

The following types can be set for combined fragments:

Change Shape TypeMeaning
altAlternative
optOption
loopLoop
parParallel
breakBreak
negnegation
strictstrict
seqseq
ignoreignore
considerConsider
assertAssert

Defining an Interaction Use

To define an interaction use, follow these steps:

Add from the Toolbox and reference it using the Interaction Association context menu

Instructions
  1. Select the interaction use in the Toolbox and drag and drop it onto the sequence diagram.
  2. Select the added interaction use and associate it with the referenced sequence diagram using the Interaction Association context menu.
tip

To jump to the sequence diagram associated with an interaction use, select the interaction use and click [Show Associated Interactions] in the context menu.

Validating a Model

The following items are validated in a sequence diagram:

  • Whether the operation associated with a message is available in the destination lifeline type.
info

For example, this tool can detect inconsistencies between the operation associated with a message and the destination lifeline type resulting from the following changes:

  1. For the operation associated with a message, specify an operation defined in the class that inherits from the class that will become the destination lifeline type.
  2. In a class diagram, etc., remove the inheritance relationship of the class that will become the destination lifeline type.

To validate a model, follow these steps:

Perform consistency check and display errors

Instructions
  1. From the ribbon, select [UML] > [Validation] > [Check Consistency].
  2. If an inconsistency is detected in the messages placed on the sequence diagram, an error will be displayed.
tip

Clicking the [Home] > [Model] > [Check Error] button on the ribbon will perform validation on the entire model in addition to the standard validation.

Setting Display Content

You can display only the information you are interested in in a sequence diagram without modifying the model.
To set the display content for arguments corresponding to a request message, follow the steps below.

Argument Display On,Off

Operation Procedure
  1. Display the sequence diagram you want to switch display.
  2. Check or uncheck the Argument checkbox in the Request Message group on the UML Diagram tab in the Inspector.
Elements that can be Displayed

You can switch the display of the following elements in a sequence diagram.

CategoryElement
Request MessageArgument
Argument Name
Return Type
Response MessageArgument
Argument Value
Argument Assignment Variable
Return Value
Return Value Variable

Restrictions

  • State invariants and duration constraints cannot be defined.
  • Messages cannot be connected from frames.
  • Messages cannot be connected to interaction uses.
  • Elements cannot be copied and pasted.
  • The message order in a sequence (commonly known as GeneralOrdering) is represented only by the Y coordinate on the diagram. When using the difference comparison function, you cannot check the differences as a model.
  • Stereotypes are not represented on sequence diagrams.
  • Changes to message mapping settings for a sequence diagram will not be reflected in model validation (message mapping error checks), and errors may be detected incorrectly or, conversely, errors may not be detected.
  • Model validation is performed according to the default metamodel structure provided by the UmlSysml package before any changes were made.