8/29/2021
74
Notation DescriptionVisual Representation

Actor

  • a type of role played by an entity that interacts with the subject (e.g., by exchanging signals and data)
  • external to the subject (i.e., in the sense that an instance of an actor is not a part of the instance of its corresponding subject).
  • represent roles played by human users, external hardware, or other subjects.

Note that:

  • An actor does not necessarily represent a specific physical entity but merely a particular role of some entity
  • A person may play the role of several different actors and, conversely, a given actor may be played by multiple different person.

Lifeline

  • A lifeline represents an individual participant in the Interaction.

Activations

  • A thin rectangle on a lifeline) represents the period during which an element is performing an operation.
  • The top and the bottom of the of the rectangle are aligned with the initiation and the completion time respectively

Call Message

  • A message defines a particular communication between Lifelines of an Interaction.
  • Call message is a kind of message that represents an invocation of operation of target lifeline.

Return Message

  • A message defines a particular communication between Lifelines of an Interaction.
  • Return message is a kind of message that represents the pass of information back to the caller of a corresponded former message.

Self Message

  • A message defines a particular communication between Lifelines of an Interaction.
  • Self message is a kind of message that represents the invocation of message of the same lifeline.

Recursive Message

  • A message defines a particular communication between Lifelines of an Interaction.
  • Recursive message is a kind of message that represents the invocation of message of the same lifeline. It's target points to an activation on top of the activation where the message was invoked from.

Create Message

  • A message defines a particular communication between Lifelines of an Interaction.
  • Create message is a kind of message that represents the instantiation of (target) lifeline.

Destroy Message

  • A message defines a particular communication between Lifelines of an Interaction.
  • Destroy message is a kind of message that represents the request of destroying the lifecycle of target lifeline.

Duration Message

  • A message defines a particular communication between Lifelines of an Interaction.
  • Duration message shows the distance between two time instants for a message invocation.

Note

A note (comment) gives the ability to attach various remarks to elements. A comment carries no semantic force, but may contain information that is useful to a modeler.

  1. Sequence Diagram Loop Example Excel
  2. What Is Sequence Diagram
  3. System Sequence Diagram

The Sequence diagram is a type of Interaction diagram that focuses on the Message interchange between various Lifelines. A Sequence diagram shows the interaction information with an emphasis on the time sequence. The diagram has two dimensions: the vertical axis representing time and the horizontal axis representing the participating objects. Thanks also to the js-sequence-diagram project for usage of the grammar for the sequence diagrams. Thanks to Jessica Peter for inspiration and starting point for gantt rendering. Mermaid was created by Knut Sveidqvist for easier documentation. . A good sequence diagram is still above the level of the real code (not all code is drawn on diagram). Sequence diagrams are language-agnostic (can be implemented in many different languages). Non-coders can read and write sequence diagrams. For the second part of your question, there is a notation to draw multiple instances in the same lifeline using stacked boxes, for example: from A Quick Introduction to UML Sequence Diagrams. The stacked boxes used for the figures variable indicate it refers to multiple instances, which can be interpreted as being a different instance around. This is a sequence diagram example that uses iteration with loop and break. Loop allows you to model iteration. When the break guard condition evaluates to true, the break operand executes, and the loop terminates, Import into your Project.

A UML Sequence diagram shows how messages go back and forth between objects over time. It is an interaction diagram.

The basic syntax for a line in a sequence diagram shows that one participant is sending a message to another participant:

More formally: <participant1><directionalarrow><participant2>:<message>

Sequence diagram showing interaction between Alice and Bob:

Here is the source for the diagram:

Keywords¶

Be sure to also read about the keywords and options that can be applied to all diagrams:Global keywords and options

Participants¶

Todo

words about what participants are in general. types…

Usage:

participant'<displaylabel>'

[as<somealias>]

[#<colornamehexcode>]

[<<[(<letter>,<color>)][stereotypename]>>]

[order<number>]

Participants are the message senders. Use the participant keyword to give a name to a message sender and optionally give it an alias and format it.

If the displayed label for a participant has spaces or special characters, put quotes around it. (Ex: 'RequestHandler')

You don’t have to use the participant keyword because PlantUML will automatically display a sender whenever it encounters one in the source.But using the keyword gives you the ability to set the following options:

You can use a participant line anywhere in your source (at any time).This is one way you can control the order of the participant boxes across the top.

Options:
as <some alias>:

provide an alias for the participant. This is useful if the displayed name is long; you can just use the shorter alias in the rest of the source.

color #<colorName hexCode>:

set the color of the image displayed. Use a color name or hex code.

Ex: participantAlice#lightGreen

<< [(<letter>, <color name>)] [<stereotype text>] >>:

(stereotype box) …

Ex: participant'RequestHandler'<<(S,#lightBlue)server>>

order <number>:

set the specific order for the participant. Otherwise PlantUML just orders the participants as it encounters them.

order must come last else you’ll get a syntax error!

Ex: participant'RequestHandler'order3

Example:

You can show a message coming from or going to a participant not in the scope of the current diagram by using ] or [

  • ] shows a message going to outside the scope of the diagram (to a participant not in the diagram)
  • [ shows a message coming from outside the scope of the diagram (from a participant not in the diagram)
Skinparams:

Participant

ParticipantBorderThickness

actor

actor is a stereotype (synonym) for participant that displays a person stick figure instead of the standard box. All of the same options as participant can be used.

Skinparams:

ActorBorderThickness

Actor { } – note that the last Actor skinparams read will be the ones that are applied!

boundary

boundary is a stereotype (synonym) for participant that displays a boundary image instead of the standard box. All of the same options as participant can be used.

entity

entity is a stereotype (synonym) for participant that displays an entity image instead of the standard box. All of the same options as participant can be used.

control

control is a stereotype (synonym) for participant that displays a control image instead of the standard box. All of the same options as participant can be used.

database

database is asynonym for participant that displays a database image instead of the standard box. All of the same options as participant can be used.

create

create puts the first occurrence of the diagram for the participant within the diagram where this word appears instead of at the top of the page.Helps to show that an object is actually created at that point in time.

Usage:create <name> order <order number>
  • cannot use “as”

    In the example above, create'AuthSystem' is used to show exactly when the wrappedRequest is created

Arrows (Graphic Paths)¶

Arrows are used to show messages sent to and from participant along a graphic path.

Skinparams:

Special note about arrows and skin params: the last one is the one used. ( an include and reference to .?)

ArrowThickness

Ex: skinparamSequenceArrowThickness4

Ex: skinparamSequence{ArrowThickness4}

MessageAlignment

MessageTextAlignment

Arrow Heads¶

Solid arrow heads represent synchronous messages. Open (not filled in) arrow heads represent asynchronous messages. (See the UML 2.5 Specification, section 17.4.4.1 Message Notation)

>> creates an unfilled arrow pointing to the right (This is an asynchronous message.)

<< creates an unfilled arrow pointing to the left (This is an asynchronous message.)

> creates a filled (solid) arrow head pointing to the right (This is a synchronous message.)

< creates a filled (solid) arrow head pointing to the left (This is a synchronous message.)

creates the top half (only) of an unfilled arrow pointing to the right

// creates the bottom half (only) of an unfilled arrow pointing to the right

creates the top half (only) of a filled arrow pointing to the right

/ creates the bottom half (only) of a filled arrow pointing to the right

? means the arrow line is short; it is only as long as the label for it.

If the ? is at the end, the arrow line is connected to the start (origin) and stops when the label for it stops.

If the ? is at the end, then the arrow is connected to the end (target), and the arrow line is only as long as the arrow label.

o puts a final “o” at arrow head, denoting a lost message

x puts an *X* at the end, denoting a destruction message.

You can create a bidirectional arrow by putting arrow heads at both ends of a line. Ex: <->

Arrow Lines¶

Solid lines show messages sent. Dashed lines represent reply messages.

An object creation Message has a dashed line with an open arrow head.

- creates a solid line

-- (two dashes instead of just one) creates dotted line

Note

If you use dots .. for an arrow line, PlantUML will think you are working with a Use Case diagram instead of a Sequence diagramand will change how it draws (renders) it.

You can make dashedarrow lines as long as you want, but they will be drawn only as long as needed andcalculated by Graphviz.

Ex: You can do this:

And it will be rendered/drawn like this:

Diagram

Arrow Color¶

You can change the color of an arrow by putting the color within square brackets just before the ending arrow-head characters:

Ex: -[#magenta]>> will create a magenta colored unfilled arrow with a solid line

Ex: --[#939393]> will create a gray colored filled arrow with a dashed line

Autonumber Graphic Paths¶

Usage:

autonumber[startresume][increment][format]

  • automatically number each arrow in the sequence
  • can format the numbering: “<b>(<u>##</u>)”
    • must be in double quotes
    • accepts simple printf type formatting (## 0 etc)

Todo

autonumber

resume
autonumber stop

Lifelines (ExecutionSpecification)¶

The activate and deactivate keywords are used to denote participant activation and deactivation on its lifeline.The UML 2.5 specification refers to this as an ExecutionSpecification: exactly what messages are called, and in what order, are specified in this particular section of the diagram.

You can also explictly destroy the lifeline of a participant, showing exactly when something is destroyed.

Skinparams:

LifeLineBackgroundColor

LifeLineBorderColor

LifeLineBorderThickness

Usage:activate<participant>[color]
deactivate
Usage:deactivate<participant>
Usage:destroy<participant>

Frames Around Fragments¶

Frames are rectangular boxes around a fragment (or sub-clause) of a sequence. It is a box around certain participants and messages.There is a name in the upper-left corner of the frame and, in the case of a group box, optionally a label across the top of the frame.

  • All frame keywords must have a correspondingend to signal where the frame ends
  • You can nest frames
  • You cannot use a note within a frame
  • See section 17.6 in the UML 2.5 Specification
  • PlantUML does not implement all InteractionOperator kinds, but you can use the group box to put in the name of any InteractionOperator you want.
Skinparam:

Even though these skinparams start with Group they apply to all frames.

  • The GroupHeaderFont formats the text that appears in the pentagon in the upper-left-hand corner of the frame. Here are the specific skinparam options:

    GroupHeaderFontColor

    GroupHeaderFontName

    GroupHeaderFontSize

    GroupHeaderFontStyle

  • GroupBodyBackgroundColor formats that background color of the frame. Here are the specific skinparam options:

    GroupBorder formats the border of the frame.

    GroupBorderColor

    GroupBorderThickness

  • GroupFont formats the text at the top of the frame. Here are the specific skinparam options:

    GroupFontColor

    GroupFontName

    GroupFontSize

    GroupFontStyle

Usage:

alt'<text>'

<..whatevergoeswithinthebox..>

end

InteractionOperator alt is used to show one or more alternative sequences that can happen. A dashed lineis used between the possible alternative sequences.

alt is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

else

Sequence Diagram Loop Example Excel

Usage:

else'<text>'

<..whatevergoeswithinthebox..>

end

In the UML specification, else is the default sequence in a list of alternative sequences.The else InteractionOperator is used to show the sequence that will be used if the none of conditions forthe alt alternatives can be met. else is the frame name in the pentagon in the upper left hand corner.

But in PlantUML_ this is how you label different alternatives. You can use the groupkeyword to specifically display the word “else” and use it per the UML Specification.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels this alternative.

Example:
opt
Usage:

opt'<text>'

<..whatevergoeswithinthebox..>

Resolve studio 17

end

An optional sequence. It either happens or not.

opt is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

loop'<text>'

<..whatevergoeswithinthebox..>

end

Shows a sequence that loops.

loop is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

par
Usage:

par'<text>'

<..whatevergoeswithinthebox..>

end

Shows a parallel sequence.

par is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

break<text>

<..whatevergoeswithinthebox..>

end

shows that a sequence breaks. It stops (does not perform) any of the remaining sequence does this instead.

break is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

critical
Usage:

critical'<text>'

<..whatevergoeswithinthebox..>

end

A fragment of a sequence that cannot be “interleaved” by other fragments (e.g. parallel fragments, etc.).

critical is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

group'<framename>'

<..whatevergoeswithinthebox..>

end

allows you to fully specify the frame name.

frame name is the frame name in the pentagon in the upper left hand corner.

Note that you cannot add text after the frame name.

Reference Frame (InteractionUse)¶

Usage:

ref'<framename>'

A reference to some other interaction or diagram.ref is the frame name in the pentagon in the upper left hand corner.

Skinparam:ReferenceAlignmentReferenceBackgroundColorReferenceBorderColorReferenceBorderThicknessReferenceFontColorReferenceFontNameReferenceFontSizeReferenceFontStyleReferenceHeaderBackgroundColor

Todo

example for reference frame

Usage:

..[<text>..]

Indicates a delay in the diagram. You can optionally add text to describe the delay.

Skinparam:DelayFontColorDelayFontNameDelayFontSizeDelayFontStyle

Todo

Example for delay

Spacing¶

  • or <number of pixels>

What Is Sequence Diagram

Dividers¶

Skinparam:DividerBackgroundColorDividerBorderColorDividerBorderThicknessDividerFontColorDividerFontNameDividerFontSizeDividerFontStyle

Notes¶

Notes for Participants¶

  • for participants:
    • put this under section about participants?

Notes for Arrows¶

  • for arrows (graphic paths) (messages)
    • put this info under the section about graphic paths?

Todo

newpage - is this common? or only on sequence diagrams?

System Sequence Diagram

A longer sequence of events with some skinparam styles used:

Skinparams specific to Sequence Diagrams¶