|
|
|
|
シーケンス図
|
Sequence Diagram
|
|
PlantUML によるシーケンス図の作成は、驚くほど簡単です。この使いやすさは、直感的で覚えやすいように設計された、ユーザーフレンドリーな構文に大きく起因しています。
何よりもまず、PlantUML が採用している、わかりやすく直感的な構文を、 ユーザは高く評価しています。このよく考え抜かれたデザインは、ダイアグラム作成が初めての人でも、 基本を素早く簡単に理解できることを意味します。
もう一つの際立った特徴は、テキスト表現とグラフィカルな出力の間の緊密 な類似性です。この調和のとれた相関性により、テキスト原稿がグラフィカルなダイアグラムに正確に変換され、最終的なアウトプットに不快な驚きを与えることなく、まとまりのある予測可能なデザイン体験を提供します。
テキストとグラフィカルな結果との間に強い相関関係があるため、作成プロセスが単純化されるだけでなく、大幅にスピードアップします。ユーザーは、時間のかかる修正や調整の必要性が少なくなり、より合理的なプロセスの恩恵を受けることができます。
テキストを下書きしながら、最終的なグラフィカルな仕上がりをイメージできる機能は、多くの人にとって貴重なものです。最初の草稿から最終的なプレゼンテーションへのスムーズな移行を自然に促進し、生産性を高め、ミスの可能性を減らします。
重要なのは、既存のダイアグラムの編集が手間のかからないプロセスであるということです。ダイアグラムはテキストから生成されるため、グラフィカルなツールを使って画像を変更するよりも、調整がかなり簡単で正確であることがわかります。
PlantUML は、シーケンス・ダイアグラムの作成と編集に、わかりやすくユー ザフレンドリーなアプローチを提供し、初心者と熟練したデザイナーの両方のニ ーズを満たします。PlantUML は、視覚的に説明的で正確なダイアグラムを作成するために、テキス ト入力のシンプルさを巧みに活用し、ダイアグラム作成ツールキットの必携 ツールとしての地位を確立しています。
PlantUML の一般的なコマンドについては、ダイアグラム作成の経験 を向上させるために学ぶことができます。
|
Creating sequence diagrams with PlantUML is remarkably straightforward. This ease of use is largely attributed to the user-friendly nature of its syntax, designed to be both intuitive and easy to remember.
First and foremost, users appreciate the straightforward and intuitive syntax that PlantUML employs. This well-thought-out design means that even those new to diagram creation find it easy to grasp the basics quickly and without hassle.
- Text-to-Graphic Correlation:
Another distinguishing feature is the close resemblance between the textual representation and the graphical output. This harmonious correlation ensures that the textual drafts translate quite accurately into graphical diagrams, providing a cohesive and predictable design experience without unpleasant surprises in the final output.
- Efficient Crafting Process:
The strong correlation between the text and the graphical result not only simplifies the crafting process but also significantly speeds it up. Users benefit from a more streamlined process with fewer requirements for time-consuming revisions and adjustments.
- Visualization While Drafting:
The ability to envisage the final graphical outcome while drafting the text is a feature that many find invaluable. It naturally fosters a smooth transition from initial draft to final presentation, enhancing productivity and reducing the likelihood of errors.
- Easy Edits and Revisions:
Importantly, editing existing diagrams is a hassle-free process. Since the diagrams are generated from text, users find that making adjustments is considerably easier and more precise than altering an image using graphical tools. It boils down to simply modifying the text, a process far more straightforward and less prone to errors than making changes through a graphical interface with a mouse.
PlantUML facilitates a straightforward and user-friendly approach to creating and editing sequence diagrams, meeting the needs of both novices and seasoned designers alike. It skillfully leverages the simplicity of textual inputs to craft visually descriptive and accurate diagrams, thereby establishing itself as a must-have tool in the diagram creation toolkit.
You can learn more about some of the common commands in PlantUML to enhance your diagram creation experience.
|
基本的な例
|
Basic Examples
|
|
シーケンス -> は、2人の
参加者の間のメッセージを描くために使用されます。
参加者は明示的に宣言する必要はありません。
点線の矢印を持つためには、 --> を使用します。
<- と <-- を使用することも可能です。
描画は変わりませんが、読みやすさが向上する可能性があります。
これはシーケンス図にのみ当てはまることで、他の図ではルールが異なることに注意してください。
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml
WARNING This translation need to be updated. WARNING
|
In PlantUML sequence diagrams, the -> sequence denotes a message sent between two participants, which are automatically recognized and do not need to be declared beforehand.
Utilize dotted arrows by employing the --> sequence, offering a distinct visualization in your diagrams.
To improve readability without affecting the visual representation, use reverse arrows like <- or <-- . However, be aware that this is specifically for sequence diagrams and the rules differ for other diagram types.
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml
|
分類子の宣言
|
Declaring participant
|
|
キーワード participant を使って分類子を宣言すると、分類子の表示を調整することができます。
宣言した順序が、デフォルトの 表示順になります。
分類子の宣言に別のキーワードを使用すると、分類子の 形を変えることができます:
actor
boundary
control
entity
database
collections
queue
@startuml
participant Participant as Foo
actor Actor as Foo1
boundary Boundary as Foo2
control Control as Foo3
entity Entity as Foo4
database Database as Foo5
collections Collections as Foo6
queue Queue as Foo7
Foo -> Foo1 : To actor
Foo -> Foo2 : To boundary
Foo -> Foo3 : To control
Foo -> Foo4 : To entity
Foo -> Foo5 : To database
Foo -> Foo6 : To collections
Foo -> Foo7: To queue
@enduml
キーワード as を使って分類子の名前を変更することができます。
アクターや分類子の 背景色を、HTML コードや色名を使って変更することもできます。
@startuml
actor Bob #red
' The only difference between actor
'and participant is the drawing
participant Alice
participant "I have a really\nlong name" as L #99FF99
/' You can also declare:
participant L as "I have a really\nlong name" #99FF99
'/
Alice->Bob: Authentication Request
Bob->Alice: Authentication Response
Bob->L: Log transaction
@enduml
order キーワードを使って、分類子が表示される順序を変更することもできます。
@startuml
participant Last order 30
participant Middle order 20
participant First order 10
@enduml
|
If the keyword participant is used to declare a participant, more control on that participant is possible.
The order of declaration will be the (default) order of display.
Using these other keywords to declare participants will change the shape of the participant representation:
actor
boundary
control
entity
database
collections
queue
@startuml
participant Participant as Foo
actor Actor as Foo1
boundary Boundary as Foo2
control Control as Foo3
entity Entity as Foo4
database Database as Foo5
collections Collections as Foo6
queue Queue as Foo7
Foo -> Foo1 : To actor
Foo -> Foo2 : To boundary
Foo -> Foo3 : To control
Foo -> Foo4 : To entity
Foo -> Foo5 : To database
Foo -> Foo6 : To collections
Foo -> Foo7: To queue
@enduml
Rename a participant using the as keyword.
You can also change the background color of
actor or participant.
@startuml
actor Bob #red
' The only difference between actor
'and participant is the drawing
participant Alice
participant "I have a really\nlong name" as L #99FF99
/' You can also declare:
participant L as "I have a really\nlong name" #99FF99
'/
Alice->Bob: Authentication Request
Bob->Alice: Authentication Response
Bob->L: Log transaction
@enduml
You can use the order keyword to customize the display order of participants.
@startuml
participant Last order 30
participant Middle order 20
participant First order 10
@enduml
|
複数の行を持つ分類子の宣言
|
Declaring participant on multiline
|
|
複数の行を持つ分類子を宣言できます。
@startuml
participant Participant [
=Title
----
""SubTitle""
]
participant Bob
Participant -> Bob
@enduml
[Ref. QA-15232]
|
You can declare participant on multi-line.
@startuml
participant Participant [
=Title
----
""SubTitle""
]
participant Bob
Participant -> Bob
@enduml
[Ref. QA-15232]
|
分類子名にアルファベット以外を使う
|
Use non-letters in participants
|
|
分類子を定義するときに引用符を使用することができます。そして、分類子にエイリアスを与えるためにキーワード as を使用することができます。
@startuml
Alice -> "Bob()" : Hello
"Bob()" -> "This is very\nlong" as Long
' You can also declare:
' "Bob()" -> Long as "This is very\nlong"
Long --> "Bob()" : ok
@enduml
|
You can use quotes to define participants.
And you can use the as keyword to give an alias to those participants.
@startuml
Alice -> "Bob()" : Hello
"Bob()" -> "This is very\nlong" as Long
' You can also declare:
' "Bob()" -> Long as "This is very\nlong"
Long --> "Bob()" : ok
@enduml
|
自分自身へのメッセージ
|
Message to Self
|
|
分類子は自分自身へメッセージを送信できます。
\n を使用して、複数行のテキストを扱えます。
@startuml
Alice -> Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext
@enduml
@startuml
Alice <- Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext
@enduml
[Ref. QA-1361]
|
A participant can send a message to itself.
It is also possible to have multi-line using \n .
@startuml
Alice -> Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext
@enduml
@startuml
Alice <- Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext
@enduml
[Ref. QA-1361]
|
テキストの位置
|
Text alignment
|
|
skinparam sequenceMessageAlign を使用すると、矢印に表示するテキストの位置を left 、 right 、 center に設定することができます。
direction または reverseDirection を使用すると、矢印の方向に応じてテキストの位置が決定されます。この機能の詳細は skinparamのページを参照してください。
@startuml
skinparam sequenceMessageAlign right
Bob -> Alice : Request
Alice -> Bob : Response
@enduml
応答メッセージのテキストを矢印の下に表示する
skinparam responseMessageBelowArrow true コマンドを使用すると、応答メッセージのテキストを矢印の下に表示することができます。
@startuml
skinparam responseMessageBelowArrow true
Bob -> Alice : hello
Bob <- Alice : ok
@enduml
|
Text alignment on arrows can be set to left , right or center using skinparam sequenceMessageAlign .
You can also use direction or reverseDirection to align text depending on arrow direction. Further details and examples of this are available on the skinparam page.
@startuml
skinparam sequenceMessageAlign right
Bob -> Alice : Request
Alice -> Bob : Response
@enduml
Text of response message below the arrow
You can put the text of the response message below the arrow, with the skinparam responseMessageBelowArrow true command.
@startuml
skinparam responseMessageBelowArrow true
Bob -> Alice : hello
Bob <- Alice : ok
@enduml
|
矢印の見た目を変える
|
Change arrow style
|
|
矢印の見た目をいくつかの方法によって変更できます。
- メッセージの消失を示す最後の
x を追加
\ や / を < や > の代わりに使うと
- 矢印の先端が上側だけまたは下側だけになります。
- 矢印の先端を繰り返す (たとえば
>> や // ) と、矢印の先端が細くなります。
-- を - の代わりに使うと、矢印が点線になります。
- 矢じりに最後の "O" を追加
- 双方向の矢印を使用する
@startuml
Bob ->x Alice
Bob -> Alice
Bob ->> Alice
Bob -\ Alice
Bob \\- Alice
Bob //-- Alice
Bob ->o Alice
Bob o\\-- Alice
Bob <-> Alice
Bob <->o Alice
@enduml
|
You can change arrow style by several ways:
- add a final
x to denote a lost message
- use
\ or / instead of < or > to have only the bottom or top part of the arrow
- repeat the arrow head (for example,
>> or // ) head to have a thin drawing
- use
-- instead of - to have a dotted arrow
- add a final "o" at arrow head
- use bidirectional arrow
<->
@startuml
Bob ->x Alice
Bob -> Alice
Bob ->> Alice
Bob -\ Alice
Bob \\- Alice
Bob //-- Alice
Bob ->o Alice
Bob o\\-- Alice
Bob <-> Alice
Bob <->o Alice
@enduml
|
矢印の色を替える
|
Change arrow color
|
|
以下の表記を使って、個々の矢印の色を変えることができます。
@startuml
Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok
@enduml
|
You can change the color of individual arrows using the following notation:
@startuml
Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok
@enduml
|
メッセージシーケンスの番号付け
|
Message sequence numbering
|
|
メッセージへ自動で番号を振るために、キーワード autonumber を使います。
@startuml
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
@enduml
autonumber <開始> で開始番号を、また、 autonumber <開始> <増分> で増分も指定することができます。
@startuml
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber 15
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response
autonumber 40 10
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
二重引用符で囲って番号の書式を指定することができます。
その書式指定は Java の DecimalFormat 方式で行います。
( 0 は桁を表し, # は存在しない場合は 0 で埋める桁を意味します)。
一部のHTMLタグを書式に使うこともできます。
@startuml
autonumber "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber 15 "<b>(<u>##</u>)"
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response
autonumber 40 10 "<font color=red><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
autonumber stop と
autonumber resume <増分> <書式> を自動採番の一時停止と再開にそれぞれ使用することができます。
@startuml
autonumber 10 10 "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber stop
Bob -> Alice : dummy
autonumber resume "<font color=red><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
autonumber stop
Bob -> Alice : dummy
autonumber resume 1 "<font color=blue><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
開始番号は、2つまたは3つの部分からなる数字の列を指定することもできます。各部分は . 、 ; 、 , 、 : またはこれらの組み合わせで区切ります。例えば、 1.1.1 や 1.1:1 のようにします。
自動的に最後の数字が増加していきます。
最初の数字を増加させるには autonumber inc A を、2番目の数字を増加させるには autonumber inc B を使用します。
@startuml
autonumber 1.1.1
Alice -> Bob: Authentication request
Bob --> Alice: Response
autonumber inc A
'Now we have 2.1.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response
autonumber inc B
'Now we have 2.2.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response
autonumber inc A
'Now we have 3.1.1
Alice -> Bob: Another authentication request
autonumber inc B
'Now we have 3.2.1
Bob --> Alice: Response
@enduml
現在の autonumber の値は %autonumber% 変数で参照することができます:
@startuml
autonumber 10
Alice -> Bob
note right
the <U+0025>autonumber<U+0025> works everywhere.
Here, its value is ** %autonumber% **
end note
Bob --> Alice: //This is the response %autonumber%//
@enduml
[Ref. QA-7119]
|
The keyword autonumber is used to
automatically add an incrementing number to messages.
@startuml
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
@enduml
You can specify a startnumber with autonumber <start> , and
also an increment with autonumber <start> <increment> .
@startuml
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber 15
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response
autonumber 40 10
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
You can specify a format for your number by using between double-quote.
The formatting is done with the Java class DecimalFormat
( 0 means digit, # means digit and zero if absent).
You can use some html tag in the format.
@startuml
autonumber "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber 15 "<b>(<u>##</u>)"
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response
autonumber 40 10 "<font color=red><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
You can also use autonumber stop and
autonumber resume <increment> <format> to respectively pause and resume
automatic numbering.
@startuml
autonumber 10 10 "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber stop
Bob -> Alice : dummy
autonumber resume "<font color=red><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
autonumber stop
Bob -> Alice : dummy
autonumber resume 1 "<font color=blue><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
Your startnumber can also be a 2 or 3 digit sequence using a field delimiter such as . , ; , , , : or a mix of these. For example: 1.1.1 or 1.1:1 .
Automatically the last digit will increment.
To increment the first digit, use: autonumber inc A . To increment the second digit, use: autonumber inc B .
@startuml
autonumber 1.1.1
Alice -> Bob: Authentication request
Bob --> Alice: Response
autonumber inc A
'Now we have 2.1.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response
autonumber inc B
'Now we have 2.2.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response
autonumber inc A
'Now we have 3.1.1
Alice -> Bob: Another authentication request
autonumber inc B
'Now we have 3.2.1
Bob --> Alice: Response
@enduml
You can also use the value of autonumber with the %autonumber% variable:
@startuml
autonumber 10
Alice -> Bob
note right
the <U+0025>autonumber<U+0025> works everywhere.
Here, its value is ** %autonumber% **
end note
Bob --> Alice: //This is the response %autonumber%//
@enduml
[Ref. QA-7119]
|
タイトル、ヘッダー、フッター
|
Page Title, Header and Footer
|
|
title キーワードはページにタイトルをつけるのに使われます。
header や footer を使うことにより、ページにヘッダーやフッターをつけて表示することができます。
@startuml
header Page Header
footer Page %page% of %lastpage%
title Example Title
Alice -> Bob : message 1
Alice -> Bob : message 2
@enduml
|
The title keyword is used to add a title to the page.
Pages can display headers and footers using header and footer .
@startuml
header Page Header
footer Page %page% of %lastpage%
title Example Title
Alice -> Bob : message 1
Alice -> Bob : message 2
@enduml
|
図の分割
|
Splitting diagrams
|
|
図を複数の画像に分けるためにキーワード newpage を使います。
新しいページのタイトルをキーワード newpage の直後に書くことができます。
これは、複数ページにわたる長い図を書くときに便利な機能です。
@startuml
Alice -> Bob : message 1
Alice -> Bob : message 2
newpage
Alice -> Bob : message 3
Alice -> Bob : message 4
newpage A title for the\nlast page
Alice -> Bob : message 5
Alice -> Bob : message 6
@enduml
|
The newpage keyword is used to split a diagram into several images.
You can put a title for the new page just after the newpage
keyword. This title overrides the previously specified title if any.
This is very handy with Word to print long diagram on
several pages.
(Note: this really does work. Only the first page is shown below, but it is a display artifact.)
@startuml
Alice -> Bob : message 1
Alice -> Bob : message 2
newpage
Alice -> Bob : message 3
Alice -> Bob : message 4
newpage A title for the\nlast page
Alice -> Bob : message 5
Alice -> Bob : message 6
@enduml
|
メッセージのグループ化
|
Grouping message
|
|
次のキーワードを使えば、メッセージをまとめてグループ化できます。
alt/else
opt
loop
par
break
critical
group 表示するテキスト
ヘッダ部分に文字列を追加することが可能です。( group については、後述の「groupの2つ目のラベル」を参照)
グループを閉じるにはキーワード end を使用します。
注:グループはネスト可能です。
@startuml
Alice -> Bob: Authentication Request
alt successful case
Bob -> Alice: Authentication Accepted
else some kind of failure
Bob -> Alice: Authentication Failure
group My own label
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Log attack end
end
else Another type of failure
Bob -> Alice: Please repeat
end
@enduml
|
It is possible to group messages together using the following
keywords:
alt/else
opt
loop
par
break
critical
group , followed by a text to be displayed
It is possible to add a text that will be displayed into the
header (for group , see next paragraph 'Secondary group label').
The end keyword is used to close the group.
Note that it is possible to nest groups.
@startuml
Alice -> Bob: Authentication Request
alt successful case
Bob -> Alice: Authentication Accepted
else some kind of failure
Bob -> Alice: Authentication Failure
group My own label
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Log attack end
end
else Another type of failure
Bob -> Alice: Please repeat
end
@enduml
|
groupの2つ目のラベル
|
Secondary group label
|
|
group では、 [ と ] の間に2つ目のラベルを設定し、ヘッダに表示させることができます。
@startuml
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Failure
group My own label [My own label 2]
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Log attack end
end
@enduml
[Ref. QA-2503]
|
For group , it is possible to add, between [ and ] , a secondary text or label that will be displayed into the header.
@startuml
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Failure
group My own label [My own label 2]
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Log attack end
end
@enduml
[Ref. QA-2503]
|
メッセージに付けるノート
|
Notes on messages
|
|
メッセージのすぐ後ろにキーワード note left または note right を使用し、メッセージにノートを付けることが可能です。
end note キーワードを使って、複数行のノートを作ることができます。
@startuml
Alice->Bob : hello
note left: this is a first note
Bob->Alice : ok
note right: this is another note
Bob->Bob : I am thinking
note left
a note
can also be defined
on several lines
end note
@enduml
|
It is possible to put notes on message using the note left
or note right keywords just after the message.
You can have a multi-line note using the end note
keywords.
@startuml
Alice->Bob : hello
note left: this is a first note
Bob->Alice : ok
note right: this is another note
Bob->Bob : I am thinking
note left
a note
can also be defined
on several lines
end note
@enduml
|
その他のノート
|
Some other notes
|
|
note left of 、 note right of 、 note over のキーワードを使って、分類子からの相対位置を指定してノートを配置することもできます。
ノートを目立たせるために、 背景色を変えることができます。
また、キーワード end note を使って複数行のノートを作ることができます。
@startuml
participant Alice
participant Bob
note left of Alice #aqua
This is displayed
left of Alice.
end note
note right of Alice: This is displayed right of Alice.
note over Alice: This is displayed over Alice.
note over Alice, Bob #FFAAAA: This is displayed\n over Bob and Alice.
note over Bob, Alice
This is yet another
example of
a long note.
end note
@enduml
|
It is also possible to place notes relative to participant with note left of , note right of or note over keywords.
It is possible to highlight a note by changing its background color.
You can also have a multi-line note using the end note keywords.
@startuml
participant Alice
participant Bob
note left of Alice #aqua
This is displayed
left of Alice.
end note
note right of Alice: This is displayed right of Alice.
note over Alice: This is displayed over Alice.
note over Alice, Bob #FFAAAA: This is displayed\n over Bob and Alice.
note over Bob, Alice
This is yet another
example of
a long note.
end note
@enduml
|
ノートの形を変える [hnote, rnote]
|
Changing notes shape [hnote, rnote]
|
|
キーワード hnote と rnote を使ってノートの形を変更できます。
hnote で六角形のノートになります
rnote で四角形のノートになります
@startuml
caller -> server : conReq
hnote over caller : idle
caller <- server : conConf
rnote over server
"r" as rectangle
"h" as hexagon
endrnote
rnote over server
this is
on several
lines
endrnote
hnote over caller
this is
on several
lines
endhnote
@enduml
[Ref. QA-1765]
|
You can use hnote and rnote keywords
to change note shapes :
hnote for hexagonal note;
rnote for rectangle note.
@startuml
caller -> server : conReq
hnote over caller : idle
caller <- server : conConf
rnote over server
"r" as rectangle
"h" as hexagon
endrnote
rnote over server
this is
on several
lines
endrnote
hnote over caller
this is
on several
lines
endhnote
@enduml
[Ref. QA-1765]
|
すべての分類子にまたがるノート [across]
|
Note over all participants [across]
|
|
次の構文で、すべての分類子にまたがるノートを直接作ることができます:
@startuml
Alice->Bob:m1
Bob->Charlie:m2
note over Alice, Charlie: Old method for note over all part. with:\n ""note over //FirstPart, LastPart//"".
note across: New method with:\n""note across""
Bob->Alice
hnote across:Note across all part.
@enduml
[Ref. QA-9738]
|
You can directly make a note over all participants, with the syntax:
note across: note_description
@startuml
Alice->Bob:m1
Bob->Charlie:m2
note over Alice, Charlie: Old method for note over all part. with:\n ""note over //FirstPart, LastPart//"".
note across: New method with:\n""note across""
Bob->Alice
hnote across:Note across all part.
@enduml
[Ref. QA-9738]
|
複数のノートを同じレベルに並べる [/]
|
Several notes aligned at the same level [/]
|
|
/ を使って、複数のノートを同じレベルに並べることができます:
/ を使わない場合(デフォルトでは、ノートは整列されません)
@startuml
note over Alice : initial state of Alice
note over Bob : initial state of Bob
Bob -> Alice : hello
@enduml
@startuml
note over Alice : initial state of Alice
/ note over Bob : initial state of Bob
Bob -> Alice : hello
@enduml
[Ref. QA-354]
|
You can make several notes aligned at the same level, with the syntax / :
- without
/ (by default, the notes are not aligned)
@startuml
note over Alice : initial state of Alice
note over Bob : initial state of Bob
Bob -> Alice : hello
@enduml
- with
/ (the notes are aligned)
@startuml
note over Alice : initial state of Alice
/ note over Bob : initial state of Bob
Bob -> Alice : hello
@enduml
[Ref. QA-354]
|
Creole と HTML
|
Creole and HTML
|
|
PlantUML では creole フォーマットを使うこともできます。
@startuml
participant Alice
participant "The **Famous** Bob" as Bob
Alice -> Bob : hello --there--
... Some ~~long delay~~ ...
Bob -> Alice : ok
note left
This is **bold**
This is //italics//
This is ""monospaced""
This is --stroked--
This is __underlined__
This is ~~waved~~
end note
Alice -> Bob : A //well formatted// message
note right of Alice
This is <back:cadetblue><size:18>displayed</size></back>
__left of__ Alice.
end note
note left of Bob
<u:red>This</u> is <color #118888>displayed</color>
**<color purple>left of</color> <s:red>Alice</strike> Bob**.
end note
note over Alice, Bob
<w:#FF33FF>This is hosted</w> by <img sourceforge.jpg>
end note
@enduml
|
It is also possible to use creole formatting:
@startuml
participant Alice
participant "The **Famous** Bob" as Bob
Alice -> Bob : hello --there--
... Some ~~long delay~~ ...
Bob -> Alice : ok
note left
This is **bold**
This is //italics//
This is ""monospaced""
This is --stroked--
This is __underlined__
This is ~~waved~~
end note
Alice -> Bob : A //well formatted// message
note right of Alice
This is <back:cadetblue><size:18>displayed</size></back>
__left of__ Alice.
end note
note left of Bob
<u:red>This</u> is <color #118888>displayed</color>
**<color purple>left of</color> <s:red>Alice</strike> Bob**.
end note
note over Alice, Bob
<w:#FF33FF>This is hosted</w> by <img sourceforge.jpg>
end note
@enduml
|
境界線(区切り線)
|
Divider or separator
|
|
== を使って、図を論理的なステップに分けることも出来ます。
@startuml
== Initialization ==
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
== Repetition ==
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
|
If you want, you can split a diagram using == separator to
divide your diagram into logical steps.
@startuml
== Initialization ==
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
== Repetition ==
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
|
リファレンス
|
Reference
|
|
キーワード ref over を使用して、図中にリファレンスを挿入できます。
@startuml
participant Alice
actor Bob
ref over Alice, Bob : init
Alice -> Bob : hello
ref over Bob
This can be on
several lines
end ref
@enduml
|
You can use reference in a diagram, using the keyword ref over .
@startuml
participant Alice
actor Bob
ref over Alice, Bob : init
Alice -> Bob : hello
ref over Bob
This can be on
several lines
end ref
@enduml
|
遅延
|
Delay
|
|
処理の遅延を表すために ... が使えます。また、作成した遅延にコメントを付けることもできます。
@startuml
Alice -> Bob: Authentication Request
...
Bob --> Alice: Authentication Response
...5 minutes later...
Bob --> Alice: Good Bye !
@enduml
|
You can use ... to indicate a delay in the diagram.
And it is also possible to put a message with this delay.
@startuml
Alice -> Bob: Authentication Request
...
Bob --> Alice: Authentication Response
...5 minutes later...
Bob --> Alice: Good Bye !
@enduml
|
テキストの折り返し
|
Text wrapping
|
|
\n を使って改行することで、長いメッセージを折り返すことができます。
また、 maxMessageSize を設定するという方法もあります。
@startuml
skinparam maxMessageSize 50
participant a
participant b
a -> b :this\nis\nmanually\ndone
a -> b :this is a very long message on several words
@enduml
|
To break long messages, you can manually add \n in your text.
Another option is to use maxMessageSize setting:
@startuml
skinparam maxMessageSize 50
participant a
participant b
a -> b :this\nis\nmanually\ndone
a -> b :this is a very long message on several words
@enduml
|
間隔
|
Space
|
|
図の間隔を調整するために、記号 ||| を使用することができます。
さらにピクセル数を指定することもできます。
@startuml
Alice -> Bob: message 1
Bob --> Alice: ok
|||
Alice -> Bob: message 2
Bob --> Alice: ok
||45||
Alice -> Bob: message 3
Bob --> Alice: ok
@enduml
|
You can use ||| to indicate some spacing in the diagram.
It is also possible to specify a number of pixel to be used.
@startuml
Alice -> Bob: message 1
Bob --> Alice: ok
|||
Alice -> Bob: message 2
Bob --> Alice: ok
||45||
Alice -> Bob: message 3
Bob --> Alice: ok
@enduml
|
ライフラインの活性化と破棄
|
Lifeline Activation and Destruction
|
|
activate と deactivate を使って分類子の活性化を表します。
分類子の活性化はライフラインで表されます。
activate と deactivate は直前のメッセージに適用されます。
destroy は分類子のライフラインが終わったことを表します。
@startuml
participant User
User -> A: DoWork
activate A
A -> B: << createRequest >>
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: RequestCreated
deactivate B
A -> User: Done
deactivate A
@enduml
ライフラインはネスト(入れ子に)することができ、色をつけることもできます。
@startuml
participant User
User -> A: DoWork
activate A #FFBBBB
A -> A: Internal call
activate A #DarkSalmon
A -> B: << createRequest >>
activate B
B --> A: RequestCreated
deactivate B
deactivate A
A -> User: Done
deactivate A
@enduml
自動的に活性化(autoactivate)することもできます。この場合はreturnキーワードを使用します。
@startuml
autoactivate on
alice -> bob : hello
bob -> bob : self call
bill -> bob #005500 : hello from thread 2
bob -> george ** : create
return done in thread 2
return rc
bob -> george !! : delete
return success
@enduml
|
The activate and deactivate are used to denote
participant activation.
Once a participant is activated, its lifeline appears.
The activate and deactivate apply on
the previous message.
The destroy denote the end of the lifeline of a
participant.
@startuml
participant User
User -> A: DoWork
activate A
A -> B: << createRequest >>
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: RequestCreated
deactivate B
A -> User: Done
deactivate A
@enduml
Nested lifeline can be used, and it is possible to add a color on the lifeline.
@startuml
participant User
User -> A: DoWork
activate A #FFBBBB
A -> A: Internal call
activate A #DarkSalmon
A -> B: << createRequest >>
activate B
B --> A: RequestCreated
deactivate B
deactivate A
A -> User: Done
deactivate A
@enduml
Autoactivation is possible and works with the return keywords:
@startuml
autoactivate on
alice -> bob : hello
bob -> bob : self call
bill -> bob #005500 : hello from thread 2
bob -> george ** : create
return done in thread 2
return rc
bob -> george !! : delete
return success
@enduml
|
Return
|
Return
|
|
新しいコマンド return は、リターンメッセージを生成し、オプションでテキストラベルをつけることができます。
リターンする先は最も最近活性化したライフラインです。
構文は単純にreturn ラベルです。ラベルを与える場合には、通常のメッセージに与えることが可能な文字列を何でも与えることができます。
@startuml
Bob -> Alice : hello
activate Alice
Alice -> Alice : some action
return bye
@enduml
|
Command return generates a return message with optional text label.
The return point is that which caused the most recent life-line activation.
The syntax is return label where label if provided is any string acceptable for conventional messages.
@startuml
Bob -> Alice : hello
activate Alice
Alice -> Alice : some action
return bye
@enduml
|
分類子の生成
|
Participant creation
|
|
キーワード create を、オブジェクトが最初のメッセージを受信する直前に置くことにより、このメッセージがオブジェクトを新しく 生成 していることを強調して表現できます。
@startuml
Bob -> Alice : hello
create Other
Alice -> Other : new
create control String
Alice -> String
note right : You can also put notes!
Alice --> Bob : ok
@enduml
|
You can use the create keyword just before the first
reception of a message to emphasize the fact that this message is
actually creating this new object.
@startuml
Bob -> Alice : hello
create Other
Alice -> Other : new
create control String
Alice -> String
note right : You can also put notes!
Alice --> Bob : ok
@enduml
|
活性化、非活性化、生成のショートカット記法
|
Shortcut syntax for activation, deactivation, creation
|
|
対象の分類子を記述した直後に、次の記法を使うことができます。
++ 対象を活性化する (続けて色を記述することもできます)
-- 起点側を非活性化する
** 対象のインスタンスを生成する
!! 対象のインスタンスを破棄する
@startuml
alice -> bob ++ : hello
bob -> bob ++ : self call
bob -> bib ++ #005500 : hello
bob -> george ** : create
return done
return rc
bob -> george !! : delete
return success
@enduml
同じ行に活性化と非活性化を混ぜることもできます:
@startuml
alice -> bob ++ : hello1
bob -> charlie --++ : hello2
charlie --> alice -- : ok
@enduml
@startuml
@startuml
alice -> bob --++ #gold: hello
bob -> alice --++ #gold: you too
alice -> bob --: step1
alice -> bob : step2
@enduml
@enduml
[Ref. QA-4834, QA-9573 and QA-13234]
|
Immediately after specifying the target participant, the following syntax can be used:
++ Activate the target (optionally a color may follow this)
-- Deactivate the source
** Create an instance of the target
!! Destroy an instance of the target
@startuml
alice -> bob ++ : hello
bob -> bob ++ : self call
bob -> bib ++ #005500 : hello
bob -> george ** : create
return done
return rc
bob -> george !! : delete
return success
@enduml
Then you can mix activation and deactivation, on same line:
@startuml
alice -> bob ++ : hello1
bob -> charlie --++ : hello2
charlie --> alice -- : ok
@enduml
@startuml
@startuml
alice -> bob --++ #gold: hello
bob -> alice --++ #gold: you too
alice -> bob --: step1
alice -> bob : step2
@enduml
@enduml
[Ref. QA-4834, QA-9573 and QA-13234]
|
インとアウトのメッセージ
|
Incoming and outgoing messages
|
|
図の一部だけにフォーカスを当てたい場合には、「外から入ってくる」または「外に出ていく」メッセージを使えます。
左角括弧 " [ " を使って図の左端、 右角括弧 " ] " を使って図の右側を表せます。
@startuml
[-> A: DoWork
activate A
A -> A: Internal call
activate A
A ->] : << createRequest >>
A<--] : RequestCreated
deactivate A
[<- A: Done
deactivate A
@enduml
また、次の書き方も使えます:
@startuml
participant Alice
participant Bob #lightblue
Alice -> Bob
Bob -> Carol
...
[-> Bob
[o-> Bob
[o->o Bob
[x-> Bob
...
[<- Bob
[x<- Bob
...
Bob ->]
Bob ->o]
Bob o->o]
Bob ->x]
...
Bob <-]
Bob x<-]
@enduml
|
You can use incoming or outgoing arrows if you want to focus on a part
of the diagram.
Use square brackets to denote the left " [ " or the
right " ] " side of the diagram.
@startuml
[-> A: DoWork
activate A
A -> A: Internal call
activate A
A ->] : << createRequest >>
A<--] : RequestCreated
deactivate A
[<- A: Done
deactivate A
@enduml
You can also have the following syntax:
@startuml
participant Alice
participant Bob #lightblue
Alice -> Bob
Bob -> Carol
...
[-> Bob
[o-> Bob
[o->o Bob
[x-> Bob
...
[<- Bob
[x<- Bob
...
Bob ->]
Bob ->o]
Bob o->o]
Bob ->x]
...
Bob <-]
Bob x<-]
@enduml
|
インとアウトのメッセージに短い矢印を使う
|
Short arrows for incoming and outgoing messages
|
|
? で 短い矢印を使用することができます。
@startuml
?-> Alice : ""?->""\n**short** to actor1
[-> Alice : ""[->""\n**from start** to actor1
[-> Bob : ""[->""\n**from start** to actor2
?-> Bob : ""?->""\n**short** to actor2
Alice ->] : ""->]""\nfrom actor1 **to end**
Alice ->? : ""->?""\n**short** from actor1
Alice -> Bob : ""->"" \nfrom actor1 to actor2
@enduml
[Ref. QA-310]
|
You can have short arrows with using ? .
@startuml
?-> Alice : ""?->""\n**short** to actor1
[-> Alice : ""[->""\n**from start** to actor1
[-> Bob : ""[->""\n**from start** to actor2
?-> Bob : ""?->""\n**short** to actor2
Alice ->] : ""->]""\nfrom actor1 **to end**
Alice ->? : ""->?""\n**short** from actor1
Alice -> Bob : ""->"" \nfrom actor1 to actor2
@enduml
[Ref. QA-310]
|
アンカーと持続時間
|
Anchors and Duration
|
|
teoz を使用するとダイアグラムにアンカーを追加することができ、それによって持続時間を表現することができます。
@startuml
!pragma teoz true
{start} Alice -> Bob : start doing things during duration
Bob -> Max : something
Max -> Bob : something else
{end} Bob -> Alice : finish
{start} <-> {end} : some time
@enduml
コマンドラインで -P オプションを使用してpragmaを指定することもできます:
java -jar plantuml.jar -Pteoz=true
[Ref. issue-582]
|
With teoz it is possible to add anchors to the diagram and use the anchors to specify duration time.
@startuml
!pragma teoz true
{start} Alice -> Bob : start doing things during duration
Bob -> Max : something
Max -> Bob : something else
{end} Bob -> Alice : finish
{start} <-> {end} : some time
@enduml
You can use the -P command-line option to specify the pragma:
java -jar plantuml.jar -Pteoz=true
[Ref. issue-582]
|
ステレオタイプとスポット
|
Stereotypes and Spots
|
|
<< と >> を使い分類子にステレオタイプをつけることができます。
(X,color) と記述することによりステレオタイプに色付きの文字と円のアイコンをつけることができます。
@startuml
participant "Famous Bob" as Bob << Generated >>
participant Alice << (C,#ADD1B2) Testable >>
Bob->Alice: First message
@enduml
デフォルトでは guillemet キャラクターがステレオタイプを表示するために使用されます。
スキンパラメータ guillemet を使用してこの動作を変更することができます:
@startuml
skinparam guillemet false
participant "Famous Bob" as Bob << Generated >>
participant Alice << (C,#ADD1B2) Testable >>
Bob->Alice: First message
@enduml
@startuml
participant Bob << (C,#ADD1B2) >>
participant Alice << (C,#ADD1B2) >>
Bob->Alice: First message
@enduml
|
It is possible to add stereotypes to participants using <<
and >> .
In the stereotype, you can add a spotted character
in a colored circle using the syntax (X,color) .
@startuml
participant "Famous Bob" as Bob << Generated >>
participant Alice << (C,#ADD1B2) Testable >>
Bob->Alice: First message
@enduml
By default, the guillemet character is used to display the stereotype.
You can change this behavious using the skinparam guillemet :
@startuml
skinparam guillemet false
participant "Famous Bob" as Bob << Generated >>
participant Alice << (C,#ADD1B2) Testable >>
Bob->Alice: First message
@enduml
@startuml
participant Bob << (C,#ADD1B2) >>
participant Alice << (C,#ADD1B2) >>
Bob->Alice: First message
@enduml
|
|
Position of the stereotypes
|
|
|
It is possible to define stereotypes position ( top or bottom ) with the command skinparam stereotypePosition .
Top postion (by default)
@startuml
skinparam stereotypePosition top
participant A<<st1>>
participant B<<st2>>
A --> B : stereo test
@enduml
Bottom postion
@startuml
skinparam stereotypePosition bottom
participant A<<st1>>
participant B<<st2>>
A --> B : stereo test
@enduml
[Ref. QA-18650]
|
タイトルについての詳細
|
More information on titles
|
|
タイトルには creole フォーマットが使用できます。
@startuml
title __Simple__ **communication** example
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
タイトルの記述では \n を使用して新しい行を追加することができます。
@startuml
title __Simple__ communication example\non several lines
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
また、キーワード title と end title を使うことにより、タイトルを複数行にわたって記述できます。
@startuml
title
<u>Simple</u> communication example
on <i>several</i> lines and using <font color=red>html</font>
This is hosted by <img:sourceforge.jpg>
end title
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
|
You can use creole formatting in the title.
@startuml
title __Simple__ **communication** example
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
You can add newline using \n in the title description.
@startuml
title __Simple__ communication example\non several lines
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
You can also define title on several lines using title
and end title keywords.
@startuml
title
<u>Simple</u> communication example
on <i>several</i> lines and using <font color=red>html</font>
This is hosted by <img:sourceforge.jpg>
end title
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
|
分類子の囲み
|
Participants encompass
|
|
キーワード box と end box を使い、分類子のまわりにボックスを描くことができます。
タイトルや 背景色をキーワード box に続けて任意で追加できます。
@startuml
box "Internal Service" #LightBlue
participant Bob
participant Alice
end box
participant Other
Bob -> Alice : hello
Alice -> Other : hello
@enduml
WARNING This translation need to be updated. WARNING
|
It is possible to draw a box around some participants, using box
and end box commands.
You can add an optional title or a
optional background color, after the box keyword.
@startuml
box "Internal Service" #LightBlue
participant Bob
participant Alice
end box
participant Other
Bob -> Alice : hello
Alice -> Other : hello
@enduml
It is also possible to nest boxes - to draw a box within a box - when using the teoz rendering engine, for example:
@startuml
!pragma teoz true
box "Internal Service" #LightBlue
participant Bob
box "Subteam"
participant Alice
participant John
end box
end box
participant Other
Bob -> Alice : hello
Alice -> John : hello
John -> Other: Hello
@enduml
|
フッターの除去
|
Removing Foot Boxes
|
|
図からフッターを削除するにはキーワード hide footbox を使います。
@startuml
hide footbox
title Foot Box removed
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml
|
You can use the hide footbox keywords to remove the foot boxes
of the diagram.
@startuml
hide footbox
title Foot Box removed
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml
|
スキンパラメータ
|
Skinparam
|
|
ダイアグラムの色やフォントを変更するには skinparam コマンドを使用します。
このコマンドは以下の場面で使用できます。
次の例のように他のパラメータを変えることもできます。
@startuml
skinparam sequenceArrowThickness 2
skinparam roundcorner 20
skinparam maxmessagesize 60
skinparam sequenceParticipant underline
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
User -> A: DoWork
activate A
A -> B: Create Request
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request Created
deactivate B
A --> User: Done
deactivate A
@enduml
@startuml
skinparam backgroundColor #EEEBDC
skinparam handwritten true
skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
}
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
User -> A: DoWork
activate A
A -> B: Create Request
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request Created
deactivate B
A --> User: Done
deactivate A
@enduml
|
You can use the skinparam
command to change colors and fonts for the drawing.
You can use this command:
You can also change other rendering parameter, as seen in the following examples:
@startuml
skinparam sequenceArrowThickness 2
skinparam roundcorner 20
skinparam maxmessagesize 60
skinparam sequenceParticipant underline
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
User -> A: DoWork
activate A
A -> B: Create Request
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request Created
deactivate B
A --> User: Done
deactivate A
@enduml
@startuml
skinparam backgroundColor #EEEBDC
skinparam handwritten true
skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
}
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
User -> A: DoWork
activate A
A -> B: Create Request
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request Created
deactivate B
A --> User: Done
deactivate A
@enduml
|
パディングの変更
|
Changing padding
|
|
パディングの設定を変更することができます。
@startuml
skinparam ParticipantPadding 20
skinparam BoxPadding 10
box "Foo1"
participant Alice1
participant Alice2
end box
box "Foo2"
participant Bob1
participant Bob2
end box
Alice1 -> Bob1 : hello
Alice1 -> Out : out
@enduml
|
It is possible to tune some padding settings.
@startuml
skinparam ParticipantPadding 20
skinparam BoxPadding 10
box "Foo1"
participant Alice1
participant Alice2
end box
box "Foo2"
participant Bob1
participant Bob2
end box
Alice1 -> Bob1 : hello
Alice1 -> Out : out
@enduml
|
付録:全種類の矢印の例
|
Appendix: Examples of all arrow type
|
|
通常の矢印
@startuml
participant Alice as a
participant Bob as b
a -> b : ""-> ""
a ->> b : ""->> ""
a -\ b : ""-\ ""
a -\\ b : ""-\\\\""
a -/ b : ""-/ ""
a -// b : ""-// ""
a ->x b : ""->x ""
a x-> b : ""x-> ""
a o-> b : ""o-> ""
a ->o b : ""->o ""
a o->o b : ""o->o ""
a <-> b : ""<-> ""
a o<->o b : ""o<->o""
a x<->x b : ""x<->x""
a ->>o b : ""->>o ""
a -\o b : ""-\o ""
a -\\o b : ""-\\\\o""
a -/o b : ""-/o ""
a -//o b : ""-//o ""
a x->o b : ""x->o ""
@enduml
自分自身への矢印
@startuml
participant Alice as a
participant Bob as b
a -> a : ""-> ""
a ->> a : ""->> ""
a -\ a : ""-\ ""
a -\\ a : ""-\\\\""
a -/ a : ""-/ ""
a -// a : ""-// ""
a ->x a : ""->x ""
a x-> a : ""x-> ""
a o-> a : ""o-> ""
a ->o a : ""->o ""
a o->o a : ""o->o ""
a <-> a : ""<-> ""
a o<->o a : ""o<->o""
a x<->x a : ""x<->x""
a ->>o a : ""->>o ""
a -\o a : ""-\o ""
a -\\o a : ""-\\\\o""
a -/o a : ""-/o ""
a -//o a : ""-//o ""
a x->o a : ""x->o ""
@enduml
インとアウトのメッセージ('['、']')
インのメッセージ('[')
@startuml
participant Alice as a
participant Bob as b
[-> b : ""[-> ""
[->> b : ""[->> ""
[-\ b : ""[-\ ""
[-\\ b : ""[-\\\\""
[-/ b : ""[-/ ""
[-// b : ""[-// ""
[->x b : ""[->x ""
[x-> b : ""[x-> ""
[o-> b : ""[o-> ""
[->o b : ""[->o ""
[o->o b : ""[o->o ""
[<-> b : ""[<-> ""
[o<->o b : ""[o<->o""
[x<->x b : ""[x<->x""
[->>o b : ""[->>o ""
[-\o b : ""[-\o ""
[-\\o b : ""[-\\\\o""
[-/o b : ""[-/o ""
[-//o b : ""[-//o ""
[x->o b : ""[x->o ""
@enduml
アウトのメッセージ(']')
@startuml
participant Alice as a
participant Bob as b
a ->] : ""->] ""
a ->>] : ""->>] ""
a -\] : ""-\] ""
a -\\] : ""-\\\\]""
a -/] : ""-/] ""
a -//] : ""-//] ""
a ->x] : ""->x] ""
a x->] : ""x->] ""
a o->] : ""o->] ""
a ->o] : ""->o] ""
a o->o] : ""o->o] ""
a <->] : ""<->] ""
a o<->o] : ""o<->o]""
a x<->x] : ""x<->x]""
a ->>o] : ""->>o] ""
a -\o] : ""-\o] ""
a -\\o] : ""-\\\\o]""
a -/o] : ""-/o] ""
a -//o] : ""-//o] ""
a x->o] : ""x->o] ""
@enduml
短いインとアウトのメッセージ('?')
短いインのメッセージ('?')
@startuml
participant Alice as a
participant Bob as b
a -> b : //Long long label//
?-> b : ""?-> ""
?->> b : ""?->> ""
?-\ b : ""?-\ ""
?-\\ b : ""?-\\\\""
?-/ b : ""?-/ ""
?-// b : ""?-// ""
?->x b : ""?->x ""
?x-> b : ""?x-> ""
?o-> b : ""?o-> ""
?->o b : ""?->o ""
?o->o b : ""?o->o ""
?<-> b : ""?<-> ""
?o<->o b : ""?o<->o""
?x<->x b : ""?x<->x""
?->>o b : ""?->>o ""
?-\o b : ""?-\o ""
?-\\o b : ""?-\\\\o ""
?-/o b : ""?-/o ""
?-//o b : ""?-//o ""
?x->o b : ""?x->o ""
@enduml
短いアウトのメッセージ('?')
@startuml
participant Alice as a
participant Bob as b
a -> b : //Long long label//
a ->? : ""->? ""
a ->>? : ""->>? ""
a -\? : ""-\? ""
a -\\? : ""-\\\\?""
a -/? : ""-/? ""
a -//? : ""-//? ""
a ->x? : ""->x? ""
a x->? : ""x->? ""
a o->? : ""o->? ""
a ->o? : ""->o? ""
a o->o? : ""o->o? ""
a <->? : ""<->? ""
a o<->o? : ""o<->o?""
a x<->x? : ""x<->x?""
a ->>o? : ""->>o? ""
a -\o? : ""-\o? ""
a -\\o? : ""-\\\\o?""
a -/o? : ""-/o? ""
a -//o? : ""-//o? ""
a x->o? : ""x->o? ""
@enduml
|
Normal arrow
@startuml
participant Alice as a
participant Bob as b
a -> b : ""-> ""
a ->> b : ""->> ""
a -\ b : ""-\ ""
a -\\ b : ""-\\\\""
a -/ b : ""-/ ""
a -// b : ""-// ""
a ->x b : ""->x ""
a x-> b : ""x-> ""
a o-> b : ""o-> ""
a ->o b : ""->o ""
a o->o b : ""o->o ""
a <-> b : ""<-> ""
a o<->o b : ""o<->o""
a x<->x b : ""x<->x""
a ->>o b : ""->>o ""
a -\o b : ""-\o ""
a -\\o b : ""-\\\\o""
a -/o b : ""-/o ""
a -//o b : ""-//o ""
a x->o b : ""x->o ""
@enduml
Itself arrow
@startuml
participant Alice as a
participant Bob as b
a -> a : ""-> ""
a ->> a : ""->> ""
a -\ a : ""-\ ""
a -\\ a : ""-\\\\""
a -/ a : ""-/ ""
a -// a : ""-// ""
a ->x a : ""->x ""
a x-> a : ""x-> ""
a o-> a : ""o-> ""
a ->o a : ""->o ""
a o->o a : ""o->o ""
a <-> a : ""<-> ""
a o<->o a : ""o<->o""
a x<->x a : ""x<->x""
a ->>o a : ""->>o ""
a -\o a : ""-\o ""
a -\\o a : ""-\\\\o""
a -/o a : ""-/o ""
a -//o a : ""-//o ""
a x->o a : ""x->o ""
@enduml
Incoming and outgoing messages (with '[', ']')
Incoming messages (with '[')
@startuml
participant Alice as a
participant Bob as b
[-> b : ""[-> ""
[->> b : ""[->> ""
[-\ b : ""[-\ ""
[-\\ b : ""[-\\\\""
[-/ b : ""[-/ ""
[-// b : ""[-// ""
[->x b : ""[->x ""
[x-> b : ""[x-> ""
[o-> b : ""[o-> ""
[->o b : ""[->o ""
[o->o b : ""[o->o ""
[<-> b : ""[<-> ""
[o<->o b : ""[o<->o""
[x<->x b : ""[x<->x""
[->>o b : ""[->>o ""
[-\o b : ""[-\o ""
[-\\o b : ""[-\\\\o""
[-/o b : ""[-/o ""
[-//o b : ""[-//o ""
[x->o b : ""[x->o ""
@enduml
Outgoing messages (with ']')
@startuml
participant Alice as a
participant Bob as b
a ->] : ""->] ""
a ->>] : ""->>] ""
a -\] : ""-\] ""
a -\\] : ""-\\\\]""
a -/] : ""-/] ""
a -//] : ""-//] ""
a ->x] : ""->x] ""
a x->] : ""x->] ""
a o->] : ""o->] ""
a ->o] : ""->o] ""
a o->o] : ""o->o] ""
a <->] : ""<->] ""
a o<->o] : ""o<->o]""
a x<->x] : ""x<->x]""
a ->>o] : ""->>o] ""
a -\o] : ""-\o] ""
a -\\o] : ""-\\\\o]""
a -/o] : ""-/o] ""
a -//o] : ""-//o] ""
a x->o] : ""x->o] ""
@enduml
Short incoming and outgoing messages (with '?')
Short incoming (with '?')
@startuml
participant Alice as a
participant Bob as b
a -> b : //Long long label//
?-> b : ""?-> ""
?->> b : ""?->> ""
?-\ b : ""?-\ ""
?-\\ b : ""?-\\\\""
?-/ b : ""?-/ ""
?-// b : ""?-// ""
?->x b : ""?->x ""
?x-> b : ""?x-> ""
?o-> b : ""?o-> ""
?->o b : ""?->o ""
?o->o b : ""?o->o ""
?<-> b : ""?<-> ""
?o<->o b : ""?o<->o""
?x<->x b : ""?x<->x""
?->>o b : ""?->>o ""
?-\o b : ""?-\o ""
?-\\o b : ""?-\\\\o ""
?-/o b : ""?-/o ""
?-//o b : ""?-//o ""
?x->o b : ""?x->o ""
@enduml
Short outgoing (with '?')
@startuml
participant Alice as a
participant Bob as b
a -> b : //Long long label//
a ->? : ""->? ""
a ->>? : ""->>? ""
a -\? : ""-\? ""
a -\\? : ""-\\\\?""
a -/? : ""-/? ""
a -//? : ""-//? ""
a ->x? : ""->x? ""
a x->? : ""x->? ""
a o->? : ""o->? ""
a ->o? : ""->o? ""
a o->o? : ""o->o? ""
a <->? : ""<->? ""
a o<->o? : ""o<->o?""
a x<->x? : ""x<->x?""
a ->>o? : ""->>o? ""
a -\o? : ""-\o? ""
a -\\o? : ""-\\\\o?""
a -/o? : ""-/o? ""
a -//o? : ""-//o? ""
a x->o? : ""x->o? ""
@enduml
|
特有のskinparam
|
Specific SkinParameter
|
|
デフォルト
@startuml
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
ライフラインの設定(lifelineStrategy)
@startuml
skinparam lifelineStrategy nosolid
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
[Ref. QA-9016]
シーケンス図のライフラインを実線で表示するには、 skinparam lifelineStrategy solid を設定します:
@startuml
skinparam lifelineStrategy solid
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
[Ref. QA-2794]
厳密なUMLスタイル(style strictuml)
厳密なUMLに準拠する(矢印の端を矢じり形ではなく三角形にする等)には、次のようにします:
skinparam style strictuml
@startuml
skinparam style strictuml
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
[Ref. QA-1047]
|
By default
@startuml
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
LifelineStrategy
@startuml
skinparam lifelineStrategy nosolid
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
[Ref. QA-9016]
In order to have solid life line in sequence diagrams, you can use: skinparam lifelineStrategy solid
@startuml
skinparam lifelineStrategy solid
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
[Ref. QA-2794]
style strictuml
To be conform to strict UML ( for arrow style: emits triangle rather than sharp arrowheads), you can use:
skinparam style strictuml
@startuml
skinparam style strictuml
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
[Ref. QA-1047]
|
未接続の分類子を表示しない
|
Hide unlinked participant
|
|
デフォルトでは、すべての分類子が表示されます。
@startuml
participant Alice
participant Bob
participant Carol
Alice -> Bob : hello
@enduml
hide unlinked を指定すると、接続されていない分類子を非表示にできます。
@startuml
hide unlinked
participant Alice
participant Bob
participant Carol
Alice -> Bob : hello
@enduml
[Ref. QA-4247]
|
By default, all participants are displayed.
@startuml
participant Alice
participant Bob
participant Carol
Alice -> Bob : hello
@enduml
But you can hide unlinked participant.
@startuml
hide unlinked
participant Alice
participant Bob
participant Carol
Alice -> Bob : hello
@enduml
[Ref. QA-4247]
|
グループメッセージに色を付ける
|
Color a group message
|
|
グループメッセージに 色を付けることができます:
@startuml
Alice -> Bob: Authentication Request
alt#Gold #LightBlue Successful case
Bob -> Alice: Authentication Accepted
else #Pink Failure
Bob -> Alice: Authentication Rejected
end
@enduml
[Ref. QA-4750 and QA-6410]
|
It is possible to color a group messages:
@startuml
Alice -> Bob: Authentication Request
alt#Gold #LightBlue Successful case
Bob -> Alice: Authentication Accepted
else #Pink Failure
Bob -> Alice: Authentication Rejected
end
@enduml
[Ref. QA-4750 and QA-6410]
|
メインフレーム
|
Mainframe
|
|
@startuml
mainframe This is a **mainframe**
Alice->Bob : Hello
@enduml
[Ref. QA-4019 and Issue#148]
|
@startuml
mainframe This is a **mainframe**
Alice->Bob : Hello
@enduml
[Ref. QA-4019 and Issue#148]
|
|
Slanted or odd arrows
|
|
|
You can use the (nn) option (before or after arrow) to make the arrows slanted, where nn is the number of shift pixels.
[Available only after v1.2022.6beta+]
@startuml
A ->(10) B: text 10
B ->(10) A: text 10
A ->(10) B: text 10
A (10)<- B: text 10
@enduml
@startuml
A ->(40) B++: Rq
B -->(20) A--: Rs
@enduml
[Ref. QA-14145]
@startuml
!pragma teoz true
A ->(50) C: Starts\nwhen 'B' sends
& B ->(25) C: \nBut B's message\n arrives before A's
@enduml
[Ref. QA-6684]
@startuml
!pragma teoz true
S1 ->(30) S2: msg 1\n
& S2 ->(30) S1: msg 2
note left S1: msg\nS2 to S1
& note right S2: msg\nS1 to S2
@enduml
[Ref. QA-1072]
|
|
Parallel messages (with teoz)
|
|
|
You can use the & teoz command to display parallel messages:
@startuml
!pragma teoz true
Alice -> Bob : hello
& Bob -> Charlie : hi
@enduml
(See also Teoz architecture)
|
|
|