Skip to main content

Sequence Diagram

Overview

Sequence diagrams can be used to visualize the flow of mutual processing between objects.
This page explains the operations for using sequence diagrams in the following order.

  • Place sequence diagram
  • Define your lifeline
  • Define the message
  • Define a compound fragment
  • Define interaction usage

We also provide the following features to assist users in their modeling:
These will also be explained in turn.

  • Validate the model
  • Set display content

Sequence Diagram

Place the sequence diagram

To place a sequence diagram, follow these steps:

Place a sequence diagram

Operating instructions
  1. Select the package in the model navigator and click [Add Model] > [Sequence Diagram] in the context menu.
  2. The sequence diagram is placed as a child element of the selected package.

Define lifeline

To define a lifeline, follow these steps:

Create a lifeline by D&Ding existing classes

Operating 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 is created in the displayed sequence diagram.
Elements that can be added from the toolbox

You can add the following elements displayed in the toolbox to the sequence diagram.

IconName
LifelineLifeline
FragmentComposite fragment
Use of InteractionUse of Interaction
Interaction NoteInteraction Note
DestructionDestruction

Define an untyped lifeline

You can create a lifeline without a type by dragging and dropping [Lifeline] from the toolbox onto the sequence diagram.

Create a lifeline from the toolbox

tip

To change the lifeline type, select the lifeline on the sequence diagram and click [Change lifeline type] on the context menu.

Lifeline types that can be set
A lifeline type can have the following elements:

IconName
ClassClass
InterfaceInterface
ComponentComponent
ActorActor
BlockBlock

Define the message

To define a message, follow these steps:

Create message from lifeline A to lifeline B

Operating instructions
  1. In the sequence diagram, when you hover your mouse over a lifeline, a black triangle icon will appear.
  2. Drag and drop the displayed icon towards the target lifeline.
  3. When the finder appears, select the operation corresponding to the message and press the [OK] button.
  4. A synchronization message is created for the target lifeline.
Elements that can be added from the toolbox

You can add the following elements displayed in the sub toolbox to the sequence diagram.

IconName
Synchronized messageSynchronized message
Asynchronous MessageAsynchronous Message
Reply MessageReply Message
CreateMessageCreateMessage
Discard messageDiscard message

When adding these messages, select the type of message you want to add in the sub toolbox and then add the message.

About message text notation

If you enter a message operation as text on a sequence diagram, the text will be analyzed according to the notation format of the message operation.
Of course, if you change each field value, it will be reflected in the text on the diagram.

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

Correspondence between message text representation format and each field value
Messages are displayed and parsed as text 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 action for a message, select the message and click Change Message Type on the context menu.

Define composite fragment

To define a composite fragment, follow these steps:

Definition combined fragment

Operating instructions
  1. Select the composite fragment in the toolbox and drag and drop it onto the sequence diagram.
  2. Double-click the top left of the added composite fragment to display a drop-down list of types and select the type of composite fragment to add.
List of compound fragment types

Composite fragments can be of the following types:

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

Define interaction usage

To define interaction usage, follow these steps:

Add from the toolbox and refer to [Interaction Association] in the context menu

Operating instructions
  1. Select Use Interaction in the toolbox and drag and drop it onto the sequence diagram.
  2. Select the use of the added interaction and associate the sequence diagram to be referenced with [Associate Interaction] from the context menu.
tip

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

Validate the model

The contents verified by the sequence diagram are as follows.

  • Is the operation associated with the message available for the destination lifeline type?
info

For example, you can detect inconsistencies between the operation associated with a message and the type of the destination lifeline as a result of the following changes:

  1. Specify the operation defined in the inheritance source class of the class that is the type of the destination lifeline as the operation associated with the message.
  2. Delete the inheritance relationship of the class that is the type of the destination lifeline using a class diagram, etc.

To validate your model, follow these steps:

Perform validation and display error

Operating instructions
  1. Run UML > Validation > Check Consistency from the ribbon.
  2. If an inconsistency is detected in the messages placed in the sequence diagram, an error will be displayed.
tip

Click the [Home] > [Model] > [Check Error] button on the ribbon to perform validation on all models in addition to the standard validation.

Set display content

You can display only the information of interest in sequence diagrams without changing the model.
To set the display contents of the arguments corresponding to the request message, follow the steps below.

Argument display On,Off

Operating instructions
  1. Display the sequence diagram whose display you want to switch.
  2. Select the argument checkbox in the Request Message group on the UML Diagram tab in the Inspector.
Elements whose display can be switched

You can switch the display of the following elements in sequence diagrams.

CategoryElement
Request messageArguments
Argument name
Return type
Response messageArgument
Argument value
Argument assignment variables
Return value
Return value variable

Restrictions

  • State invariant expressions and duration constraints cannot be defined.
  • It is not possible to connect messages from frames.
  • Cannot connect messages to interaction usage.
  • Copying and pasting of elements is not possible.
  • The order of messages in a sequence (commonly called GeneralOrdering) is represented only by the Y coordinate on the diagram. If you use the difference comparison function, you cannot check the differences as a model.
  • Stereotypes are not represented on sequence diagrams.