PlantUML Language Reference Guide

PlantUML を使った UML の描き方
Language Reference Guide
(2016 年 2 月 10 日 11:11)
PlantUML は以下のような図を手早く書くためのオープンソースプロジェクトです。
• シーケンス図,
• ユースケース図,
• クラス図,
• アクティビティ図,
• コンポーネント図,
• 状態遷移図,
• オブジェクト図.
これらの図はシンプルかつ直感的な言語によって定義されています。
1 シーケンス図
1 シーケンス図
1.1 基本的な例
シーケンス”->” を、2 つのパーティシパント間のメッセージを描画するために使います。パーティシ
パントを、明示的に宣言する必要はありません。
点線の矢印を使う場合は、”-->” とします。
また、”<-” や”<--” を使うこともできます。これらは図を変更することなく、可読性を高めること
ができます。Note that this is only true for sequence diagrams, rules are different for the other diagrams.
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
1.2 コメント
シングルクォート ' から始まるものはコメントとして扱われます。
また、/' で初まり'/で終わる複数行にまたがるコメントも書けます。
1.3 パーティシパントの宣言
participant キーワードを使って、パーティシパントの並び順を変えることができます。
It is also possible to use other keywords to declare a participant:
• actor
• boundary
• control
• entity
• database
@startuml
actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
Foo1 -> Foo2 :
Foo1 -> Foo3 :
Foo1 -> Foo4 :
Foo1 -> Foo5 :
To
To
To
To
boundary
control
entity
database
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
1 of 118
1.4 参加者名にアルファベット以外を使う
1 シーケンス図
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 #99 FF99
/' You can also declare:
participant L as "I have a really\nlong name" #99 FF99
'/
Alice ->Bob: Authentication Request
Bob ->Alice: Authentication Response
Bob ->L: Log transaction
@enduml
1.4 参加者名にアルファベット以外を使う
あなたは、参加者を定義するときに引用符を使用することができます。そして、あなたは参加者にエ
イリアスを与えるために 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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
2 of 118
1.5 自分自身へのメッセージ
1 シーケンス図
1.5 自分自身へのメッセージ
パーティシパントは自分自身へメッセージを送信できます。
\n を使用して、複数行のテキストを扱えます。
@startuml
Alice ->Alice: This is a signal to self .\nIt also demonstrates\nmultiline \ntext
@enduml
1.6 矢印の見た目を変える
矢印の見た目をいくつかの方法によって変更できます。
• add a final x to denote a lost message
• \ や / を < や > の代わりに使うと矢印の先端が上側だけまたは下側だけになります。
• 矢印の先端を繰り返す (たとえば >> や //) と、矢印の先端が細くなります。
• -- を - の代わりに使うと、矢印が点線になります。
• 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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
3 of 118
1.7 矢印の色を替える
1 シーケンス図
1.7 矢印の色を替える
以下の表記を使って、個々の矢印の色を変えることができます。
@startuml
Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok
@enduml
1.8 メッセージシーケンスの番号付け
メッセージへ自動で番号を振るために、autonumber キーワードを使います。
@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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
4 of 118
1.8 メッセージシーケンスの番号付け
1 シーケンス図
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).
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
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
5 of 118
1.9 タイトル
1 シーケンス図
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
"
1.9 タイトル
タイトルの指定に title キーワードを使います。
@startuml
title Simple communication example
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml
1.10
図の説明文
legend と end legend は説明文を記入するために使用されるキーワードです。
You can optionally specify to have left, right or center alignment for the legend.
@startuml
Alice -> Bob : Hello
legend right
Short
legend
endlegend
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
6 of 118
1.11 図の分割
1.11
1 シーケンス図
図の分割
図を複数の画像に分けるために 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
1.12
メッセージのグループ化
次のキーワードを使えば、メッセージをまとめてグループ化できます。
• alt/else
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
7 of 118
1.13 メッセージの注釈
1 シーケンス図
• opt
• loop
• par
• break
• critical
• group 表示するテキスト
It is possible a add a text that will be displayed into the header (except for group).
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
1.13
メッセージの注釈
It is possible to put notes on message using the note left or note right keywords just after the message.
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
8 of 118
1.14 その他の注釈
1 シーケンス図
a note
can also be defined
on several lines
end note
@enduml
1.14
その他の注釈
パーティシパントとの相対位置を指定して注釈を付けるには、次のものを使います:
注釈を目立たせるために、背景色を変えることができます。
また、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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
9 of 118
1.15 Changing notes shape
1 シーケンス図
1.15 Changing notes shape
You can use hnote and rnote keywords to change note shapes.
@startuml
caller -> server : conReq
hnote over caller : idle
caller <- server : conConf
rnote over server
"r" as rectangle
"h" as hexagon
endrnote
@enduml
1.16 Creole and HTML
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 >
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
10 of 118
1.17 Divider
1 シーケンス図
**<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
1.17 Divider
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
1.18 Reference
You can use reference in a diagram, using the keyword ref over.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
11 of 118
1.19 Delay
1 シーケンス図
@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
1.19 Delay
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 latter ...
Bob --> Alice: Bye !
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
12 of 118
1.20 間隔
1.20
1 シーケンス図
間隔
図の間隔を調整するために、記号 ||| を使用することができます。
さらにピクセル数を指定することもできます。
@startuml
Alice -> Bob: message 1
Bob --> Alice: ok
|||
Alice -> Bob: message 2
Bob --> Alice: ok
||45||
Alice -> Bob: message 3
Bob --> Alice: ok
@enduml
1.21 Lifeline Activation and Destruction
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
13 of 118
1.22 Participant creation
1 シーケンス図
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
1.22 Participant creation
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!
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
14 of 118
1.23 Incoming and outgoing messages
1 シーケンス図
Alice --> Bob : ok
@enduml
1.23 Incoming and outgoing messages
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
[-> Bob
[o-> Bob
[o->o Bob
[x-> Bob
[<- Bob
[x<- Bob
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
15 of 118
1.24 Stereotypes and Spots
Bob
Bob
Bob
Bob
1 シーケンス図
->]
->o]
o->o]
->x]
Bob <-]
Bob x<-]
@enduml
1.24 Stereotypes and Spots
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
16 of 118
1.25 More information on titles
1 シーケンス図
@startuml
participant Bob << (C,# ADD1B2) >>
participant Alice << (C,# ADD1B2) >>
Bob ->Alice: First message
@enduml
1.25 More information on titles
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
17 of 118
1.26 Participants encompass
1 シーケンス図
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
1.26 Participants encompass
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
18 of 118
1.27 フッタの除去
1.27
1 シーケンス図
フッタの除去
You can use the hide footbox keywords to remove the footer of the diagram.
@startuml
hide footbox
title Footer removed
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml
1.28 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command:
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
@startuml
skinparam backgroundColor #EEEBDC
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
19 of 118
1.28 Skinparam
1 シーケンス図
}
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
20 of 118
2 ユースケース図
2 ユースケース図
2.1 ユースケース
ユースケースは丸括弧で囲んで使います (丸括弧の対は楕円に似ているからです)。
usecase キーワードを使ってユースケースを定義することもできます。as キーワードを使ってエ
イリアスを定義することもできます。このエイリアスはあとで、ユースケースの関係を定義するため
に使います。
@startuml
(First usecase)
(Another usecase) as (UC2)
usecase UC3
usecase (Last\nusecase) as UC4
@enduml
2.2 アクター
アクターは 2 つのコロンで囲まれます。
actor キーワードを使ってアクターを定義することもできます。as キーワードを使ってエイリア
スを定義することもできます。このエイリアスはあとで、ユースケースの関係を定義するために使い
ます。
We will see later that the actor definitions are optional.
@startuml
:First Actor:
:Another\nactor: as Men2
actor Men3
actor :Last actor: as Men4
@enduml
2.3 Usecases description
If you want to have description on several lines, you can use quotes.
You can also use the following separators: -- .. == __. And you can put titles within the separators.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
21 of 118
2.4 Basic example
2 ユースケース図
@startuml
usecase UC1 as "You can use
several lines to define your usecase.
You can also use separators.
-Several separators are possible.
==
And you can add titles:
.. Conclusion ..
This allows large description ."
@enduml
2.4 Basic example
To link actors and use cases, the arrow --> is used.
The more dashes "-" in the arrow, the longer the arrow. You can add a label on the arrow, by adding
a ”:” character in the arrow definition.
In this example, you see that User has not been defined before, and is used as an actor.
@startuml
User -> (Start)
User --> (Use the application) : A small label
:Main Admin: ---> (Use the application) : This is\nyet another\nlabel
@enduml
2.5 Extension
If one actor/use case extends another one, you can use the symbol <|-- (which stands for
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
).
22 of 118
2.6 Using notes
2 ユースケース図
@startuml
:Main Admin: as Admin
(Use the application) as (Use)
User <|-- Admin
(Start) <|-- (Use)
@enduml
2.6 Using notes
You can use the note left of , note right of , note top of , note bottom of keywords to define
notes related to a single object.
A note can be also define alone with the note keywords, then linked to other objects using the ..
symbol.
@startuml
:Main Admin: as Admin
(Use the application) as (Use)
User -> (Start)
User --> (Use)
Admin ---> (Use)
note right of Admin : This is an example.
note right of (Use)
A note can also
be on several lines
end note
note "This note is connected\nto several objects ." as N2
(Start) .. N2
N2 .. (Use)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
23 of 118
2.7 Stereotypes
2 ユースケース図
2.7 Stereotypes
You can add stereotypes while defining actors and use cases using ” << ” and ” >> ”.
@startuml
User << Human >>
:Main Database: as MySql << Application >>
(Start) << One Shot >>
(Use the application) as (Use) << Main >>
User -> (Start)
User --> (Use)
MySql --> (Use)
@enduml
2.8 Changing arrows direction
By default, links between classes have two dashes -- and are vertically oriented. It is possible to use
horizontal link by putting a single dash (or dot) like this:
@startuml
:user: --> (Use case 1)
:user: -> (Use case 2)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
24 of 118
2.8 Changing arrows direction
2 ユースケース図
You can also change directions by reversing the link:
@startuml
(Use case 1) <.. :user:
(Use case 2) <- :user:
@enduml
It is also possible to change arrow direction by adding left, right, up or down keywords inside the
arrow:
@startuml
:user: -left -> (dummyLeft)
:user: -right -> (dummyRight)
:user: -up -> (dummyUp)
:user: -down -> (dummyDown)
@enduml
You can shorten the arrow by using only the first character of the direction (for example, -d- instead
of -down-) or the two first characters (-do-).
Please note that you should not abuse this functionality : Graphviz gives usually good results without
tweaking.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
25 of 118
2.9 Title the diagram
2 ユースケース図
2.9 Title the diagram
The title keywords is used to put a title.
You can use title and end title keywords for a longer title, as in sequence diagrams.
@startuml
title Simple <b>Usecase </b>\ nwith one actor
"Use the application" as (Use)
User -> (Use)
@enduml
2.10 Splitting diagrams
The newpage keywords to split your diagram into several pages or images.
@startuml
:actor1: --> (Usecase1)
newpage
:actor2: --> (Usecase2)
@enduml
2.11 Left to right direction
The general default behavior when building diagram is top to bottom.
@startuml
'default
top to bottom direction
user1 --> (Usecase 1)
user2 --> (Usecase 2)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
26 of 118
2.12 Skinparam
2 ユースケース図
You may change to left to right using the left to right direction command. The result is often
better with this direction.
@startuml
left to right direction
user1 --> (Usecase 1)
user2 --> (Usecase 2)
@enduml
2.12 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can define specific color and fonts for stereotyped actors and usecases.
@startuml
skinparam handwritten true
skinparam usecase {
BackgroundColor DarkSeaGreen
BorderColor DarkSlateGray
BackgroundColor << Main >> YellowGreen
BorderColor << Main >> YellowGreen
ArrowColor Olive
ActorBorderColor black
ActorFontName Courier
ActorBackgroundColor << Human >> Gold
}
User << Human >>
:Main Database: as MySql << Application >>
(Start) << One Shot >>
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
27 of 118
2.13 Complete example
2 ユースケース図
(Use the application) as (Use) << Main >>
User -> (Start)
User --> (Use)
MySql --> (Use)
@enduml
2.13 Complete example
@startuml
left to right direction
skinparam packageStyle rect
actor customer
actor clerk
rectangle checkout {
customer -- (checkout)
(checkout) .> (payment) : include
(help) .> (checkout) : extends
(checkout) -- clerk
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
28 of 118
3
クラス図
3 クラス図
3.1 クラス間の関係
クラス間の関係は次の記号を使用して定義されています:
継承 <|-合成 *-集約 o-”--” を”..” に置き換えると点線にできます。
Knowing those rules, it is possible to draw the following drawings:
@startuml
Class01 <|-- Class02
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 -- Class10
@enduml
@startuml
Class11 <|.. Class12
Class13 --> Class14
Class15 ..> Class16
Class17 ..|> Class18
Class19 <--* Class20
@enduml
3.2 関連のラベル
”:” にテキストを続けることによって、関連へラベルを追加することが可能です。
多重度を示す為に関連のそれぞれの側にダブルクォーテーション"" を使うことができます。
@startuml
Class01 "1" *-- "many" Class02 : contains
Class03 o-- Class04 : aggregation
Class05 --> "1" Class06
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
29 of 118
3.2 関連のラベル
3
クラス図
You can add an extra arrow pointing at one object showing which object acts on the other object,
using < or > at the begin or at the end of the label.
@startuml
class Car
Driver - Car : drives >
Car *- Wheel : have 4 >
Car -- Person : < owns
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
30 of 118
3.3 メソッドの追加
3
クラス図
3.3 メソッドの追加
":" に続けてフィールド名やメソッド名を記述すると、フィールドやメソッドを宣言できます。
The system checks for parenthesis to choose between methods and fields.
@startuml
Object <|-- ArrayList
Object : equals ()
ArrayList : Object [] elementData
ArrayList : size ()
@enduml
波括弧 { を使って、フィールドやメソッドをくくることもできます。
Note that the syntax is highly flexible about type/name order.
@startuml
class Dummy {
String data
void methods ()
}
class Flight {
flightNumber : Integer
departureTime : Date
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
31 of 118
3.4 Defining visibility
3
クラス図
3.4 Defining visibility
When you define methods or fields, you can use characters to define the visibility of the corresponding
item:
#
̃
+
private
protected
package private
public
@startuml
class Dummy {
-field1
#field2
~method1 ()
+method2 ()
}
@enduml
You can turn off this feature using the skinparam classAttributeIconSize 0 command :
@startuml
skinparam classAttributeIconSize 0
class Dummy {
-field1
#field2
~method1 ()
+method2 ()
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
32 of 118
3.5 Abstract and Static
3
クラス図
3.5 Abstract and Static
You can define static or abstract methods or fields using the {static} or {abstract} modifier.
These modifiers can be used at the start or at the end of the line. You can also use {classifier}
instead of {static}.
@startuml
class Dummy {
{static} String id
{abstract} void methods ()
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
33 of 118
3.6 Advanced class body
3
クラス図
3.6 Advanced class body
By default, methods and fields are automatically regrouped by PlantUML. You can use separators to
define your own way of ordering fields and methods. The following separators are possible : -- ..
== __.
You can also use titles within the separators:
@startuml
class Foo1 {
You can use
several lines
..
as you want
and group
==
things together.
__
You can have as many groups
as you want
-End of class
}
class User {
.. Simple Getter ..
+ getName ()
+ getAddress ()
.. Some setter ..
+ setName ()
__ private data __
int age
-- encrypted -String password
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
34 of 118
3.7 Notes and stereotypes
3
クラス図
3.7 Notes and stereotypes
Stereotypes are defined with the class keyword, ” << ” and ” >> ”.
You can also define notes using note left of , note right of , note top of , note bottom of
keywords.
You can also define a note on the last defined class using note left, note right, note top, note
bottom.
A note can be also define alone with the note keywords, then linked to other objects using the ..
symbol.
@startuml
class Object << general >>
Object <|--- ArrayList
note top of Object : In java , every class\nextends this one.
note "This is a floating note" as N1
note "This note is connected\nto several objects ." as N2
Object .. N2
N2 .. ArrayList
class Foo
note left: On last defined class
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
35 of 118
3.8 More on notes
3.8
3
クラス図
More on notes
It is also possible to use few html tags like :
• <b>
• <u>
• <i>
• <s>, <del>, <strike>
• <font color="#AAAAAA"> or <font color="colorName">
• <color:#AAAAAA> or <color:colorName>
• <size:nn> to change font size
• <img src="file"> or <img:file> : the file must be accessible by the filesystem
You can also have a note on several lines You can also define a note on the last defined class using
note left, note right, note top, note bottom.
@startuml
class Foo
note left: On last defined class
note top of Object
In java , <size :18>every </size > <u>class </u>
<b>extends </b>
<i>this </i> one.
end note
note as N1
This note is <u>also </u>
<b><color:royalBlue >on several </color >
<s>words </s> lines
And this is hosted by <img:sourceforge.jpg >
end note
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
36 of 118
3.9 Note on links
3.9
3
クラス図
Note on links
It is possible to add a note on a link, just after the link definition, using note on link.
You can also use note left on link, note right on link, note top on link, note bottom on
link if you want to change the relative position of the note with the label.
@startuml
class Dummy
Dummy --> Foo : A link
note on link #red: note that is red
Dummy --> Foo2 : Another link
note right on link #blue
this is my note on right link
and in blue
end note
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
37 of 118
3.10 Abstract class and interface
3
クラス図
3.10 Abstract class and interface
You can declare a class as abstract using "abstract" or "abstract class" keywords.
The class will be printed in italic.
You can use the interface, annotation and enum keywords too.
@startuml
abstract class AbstractList
abstract AbstractCollection
interface List
interface Collection
List <|-- AbstractList
Collection <|-- AbstractCollection
Collection <|- List
AbstractCollection <|- AbstractList
AbstractList <|-- ArrayList
class ArrayList {
Object [] elementData
size ()
}
enum TimeUnit {
DAYS
HOURS
MINUTES
}
annotation SuppressWarnings
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
38 of 118
3.11 Using non-letters
3
クラス図
3.11 Using non-letters
If you want to use non-letters in the class (or enum...) display, you can either :
• Use the as keyword in the class definition
• Put quotes "" around the class name
@startuml
class "This is my class" as class1
class class2 as "It works this way too"
class2 *-- "foo/dummy" : use
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
39 of 118
3.12 Hide attributes, methods...
3
クラス図
3.12 Hide attributes, methods...
You can parameterize the display of classes using the hide/show command.
The basic command is: hide empty members. This command will hide attributes or methods if
they are empty.
Instead of empty members, you can use:
• empty fields or empty attributes for empty fields,
• empty methods for empty methods,
• fields or attributes which will hide fields, even if they are described,
• methods which will hide methods, even if they are described,
• members which will hide fields and methods, even if they are described,
• circle for the circled character in front of class name,
• stereotype for the stereotype.
You can also provide, just after the hide or show keyword:
• class for all classes,
• interface for all interfaces,
• enum for all enums,
• <<foo1>> for classes which are stereotyped with foo1,
• an existing class name.
You can use several show/hide commands to define rules and exceptions.
@startuml
class Dummy1 {
+myMethods ()
}
class Dummy2 {
+hiddenMethod ()
}
class Dummy3 <<Serializable >> {
String name
}
hide
hide
show
show
members
<<Serializable >> circle
Dummy1 methods
<<Serializable >> fields
@enduml
3.13 Hide classes
You can also use the show/hide commands to hide classes.
This may be useful if you define a large !included file, and if you want to hide come classes after
file inclusion.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
40 of 118
3.14 Use generics
3
クラス図
@startuml
class Foo1
class Foo2
Foo2 *-- Foo1
hide Foo2
@enduml
3.14 Use generics
You can also use bracket < and > to define generics usage in a class.
@startuml
class Foo <? extends Element > {
int size ()
}
Foo *- Element
@enduml
3.15 Specific Spot
Usually, a spotted character (C, I, E or A) is used for classes, interface, enum and abstract classes.
But you can define your own spot for a class when you define the stereotype, adding a single
character and a color, like in this example:
@startuml
class System << (S,# FF7700) Singleton >>
class Date << (D,orchid) >>
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
41 of 118
3.16 Packages
3
クラス図
3.16 Packages
You can define a package using the package keyword, and optionally declare a background color
for your package (Using a html color code or name).
Note that package definitions can be nested.
@startuml
package "Classic Collections" #DDDDDD {
Object <|-- ArrayList
}
package net.sourceforge.plantuml {
Object <|-- Demo1
Demo1 *- Demo2
}
@enduml
3.17 Packages style
There are different styles available for packages.
You can specify them either by setting a default style with the command : skinparam packageStyle,
or by using a stereotype on the package:
@startuml
scale 750 width
package foo1 <<Node >> {
class Class1
}
package foo2 <<Rect >> {
class Class2
}
package foo3 <<Folder >> {
class Class3
}
package foo4 <<Frame >> {
class Class4
}
package foo5 <<Cloud >> {
class Class5
}
package foo6 <<Database >> {
class Class6
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
42 of 118
3.18 Namespaces
3
クラス図
You can also define links between packages, like in the following example:
@startuml
skinparam packageStyle rect
package foo1.foo2 {
}
package foo1.foo2.foo3 {
class Object
}
foo1.foo2 +-- foo1.foo2.foo3
@enduml
3.18 Namespaces
In packages, the name of a class is the unique identifier of this class. It means that you cannot have
two classes with the very same name in different packages.
In that case, you should use namespaces instead of packages.
You can refer to classes from other namespaces by fully qualify them. Classes from the default
namespace are qualified with a starting dot.
Note that you don’t have to explicitly create namespace : a fully qualified class is automatically
put in the right namespace.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
43 of 118
3.19 Automatic namespace creation
3
クラス図
@startuml
class BaseClass
namespace net.dummy #DDDDDD {
.BaseClass <|-- Person
Meeting o-- Person
.BaseClass <|- Meeting
}
namespace net.foo {
net.dummy.Person <|- Person
.BaseClass <|-- Person
net.dummy.Meeting o-- Person
}
BaseClass <|-- net.unused.Person
@enduml
3.19 Automatic namespace creation
You can define another separator (other than the dot) using the command : set namespaceSeparator
???.
@startuml
set namespaceSeparator ::
class X1::X2::foo {
some info
}
@enduml
You can disable automatic package creation using the command set namespaceSeparator none.
@startuml
set namespaceSeparator none
class X1.X2.foo {
some info
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
44 of 118
3.20 Lollipop interface
3
クラス図
3.20 Lollipop interface
You can also define lollipops interface on classes, using the following syntax:
• bar ()- foo
• bar ()-- foo
• foo -() bar
@startuml
class foo
bar ()- foo
@enduml
3.21 Changing arrows direction
By default, links between classes have two dashes -- and are vertically oriented. It is possible to
use horizontal link by putting a single dash (or dot) like this:
@startuml
Room o- Student
Room *-- Chair
@enduml
逆のリンクによりディレクトリを変えることができる:
@startuml
Student -o Room
Chair --* Room
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
45 of 118
3.22 Title the diagram
3
クラス図
It is also possible to change arrow direction by adding left, right, up or down keywords inside the
arrow:
@startuml
foo -left -> dummyLeft
foo -right -> dummyRight
foo -up -> dummyUp
foo -down -> dummyDown
@enduml
You can shorten the arrow by using only the first character of the direction (for example, -dinstead of -down-) or the two first characters (-do-).
Please note that you should not abuse this functionality : Graphviz gives usually good results
without tweaking.
3.22 Title the diagram
The title keyword is used to put a title.
You can use title and end title keywords for a longer title, as in sequence diagrams.
@startuml
title Simple <b>example </b>\nof title
Object <|-- ArrayList
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
46 of 118
3.23 Legend the diagram
3
クラス図
3.23 Legend the diagram
The legend and end legend are keywords is used to put a legend.
You can optionally specify to have left, right or center alignment for the legend.
@startuml
Object <|- ArrayList
legend right
<b>Object </b> and <b>ArrayList </b>
are simple class
endlegend
@enduml
3.24 Association classes
You can define association class after that a relation has been defined between two classes, like in
this example:
@startuml
class Student {
Name
}
Student "0..*" - "1..*" Course
(Student , Course) .. Enrollment
class Enrollment {
drop ()
cancel ()
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
47 of 118
3.25 Skinparam
3
クラス図
You can define it in another direction:
@startuml
class Student {
Name
}
Student "0..*" -- "1..*" Course
(Student , Course) . Enrollment
class Enrollment {
drop ()
cancel ()
}
@enduml
3.25 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
@startuml
skinparam class {
BackgroundColor PaleGreen
ArrowColor SeaGreen
BorderColor SpringGreen
}
skinparam stereotypeCBackgroundColor YellowGreen
Class01 "1" *-- "many" Class02 : contains
Class03 o-- Class04 : aggregation
@enduml
3.26 Skinned Stereotypes
You can define specific color and fonts for stereotyped classes.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
48 of 118
3.27 Color gradient
3
クラス図
@startuml
skinparam class {
BackgroundColor PaleGreen
ArrowColor SeaGreen
BorderColor SpringGreen
BackgroundColor <<Foo >> Wheat
BorderColor <<Foo >> Tomato
}
skinparam stereotypeCBackgroundColor YellowGreen
skinparam stereotypeCBackgroundColor << Foo >> DimGray
Class01 <<Foo >>
Class03 <<Foo >>
Class01 "1" *-- "many" Class02 : contains
Class03 o-- Class04 : aggregation
@enduml
3.27 Color gradient
It’s possible to declare individual color for classes or note using the notation.
You can use either standard color name or RGB code.
You can also use color gradient in background, with the following syntax: two colors names separated
either by:
• |,
• /,
• \,
• or depending the direction of the gradient.
For example, you could have:
@startuml
skinparam backgroundcolor AntiqueWhite/Gold
skinparam classBackgroundColor Wheat|CornflowerBlue
class Foo #red -green
note left of Foo #blue \9932 CC
this is my
note on this class
end note
package example #GreenYellow/ LightGoldenRodYellow {
class Dummy
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
49 of 118
3.28 Splitting large files
3
クラス図
3.28 Splitting large files
Sometimes, you will get some very large image files.
You can use the ”page (hpages)x(vpages)” command to split the generated image into several
files :
hpages is a number that indicated the number of horizontal pages, and vpages is a number that
indicated the number of vertical pages.
@startuml
' Split into 4 pages
page 2x2
class BaseClass
namespace net.dummy #DDDDDD {
.BaseClass <|-- Person
Meeting o-- Person
.BaseClass <|- Meeting
}
namespace net.foo {
net.dummy.Person <|- Person
.BaseClass <|-- Person
net.dummy.Meeting o-- Person
}
BaseClass <|-- net.unused.Person
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
50 of 118
4
4
4.1
アクティビティ図
アクティビティ図
単純なアクティビティ
(*) をアクティビティ図の開始点と終了点に使います。
In some occasion, you may want to use (*top) to force the starting point to be at the top of the
diagram.
--> で矢印を表します。
@startuml
(*) --> "First Activity"
"First Activity" --> (*)
@enduml
4.2
矢印のラベル
デフォルトで、矢印は最後に書いたアクティビティを起点に描かれます。
矢印にラベルを付けるために brackets [ and ] を使います just after the arrow definition.
@startuml
(*) --> "First Activity"
-->[You can put also labels] "Second Activity"
--> (*)
@enduml
4.3
矢印の方向を変える
You can use -> for horizontal arrows. It is possible to force arrow’s direction using the following
syntax:
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
51 of 118
4.4 分岐
4
アクティビティ図
• -down-> (default arrow)
• -right-> or ->
• -left->
• -up->
@startuml
(*) -up -> "First Activity"
-right -> "Second Activity"
--> "Third Activity"
-left -> (*)
@enduml
4.4
分岐
You can use if/then/else keywords to define branches.
@startuml
(*) --> "Initialization"
if "Some Test" then
-->[true] "Some Activity"
--> "Another activity"
-right -> (*)
else
->[false] "Something else"
-->[Ending process] (*)
endif
@enduml
Unfortunately, you will have to sometimes repeat the same activity in the diagram text:
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
52 of 118
4.5 より多い分岐
4
アクティビティ図
@startuml
(*) --> "check input"
If "input is verbose" then
--> [Yes] "turn on verbosity"
--> "run command"
else
--> "run command"
Endif
-->(*)
@enduml
4.5
より多い分岐
By default, a branch is connected to the last defined activity, but it is possible to override this and
to define a link with the if keywords.
It is also possible to nest branches.
@startuml
(*) --> if "Some Test" then
-->[true] "activity 1"
if "" then
-> "activity 3" as a3
else
if "Other test" then
-left -> "activity 5"
else
--> "activity 6"
endif
endif
else
->[false] "activity 2"
endif
a3 --> if "last test" then
--> "activity 7"
else
-> "activity 8"
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
53 of 118
4.6 同期
4
アクティビティ図
endif
@enduml
4.6
同期
You can use === code === to display synchronization bars.
@startuml
(*) --> ===B1===
--> "Parallel Activity 1"
--> ===B2===
===B1=== --> "Parallel Activity 2"
--> ===B2===
--> (*)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
54 of 118
4.7 長いアクティビティの記述
4.7
4
アクティビティ図
長いアクティビティの記述
When you declare activities, you can span on several lines the description text. You can also add
\n in the description.
You can also give a short code to the activity with the as keyword. This code can be used latter
in the diagram description.
@startuml
(*) -left -> "this <size :20> activity </size >
is <b>very </b> <color:red >long2 </color >
and defined on several lines
that contains many <i>text </i>" as A1
-up -> "Another activity\n on several lines"
A1 --> "Short activity <img:sourceforge.jpg >"
@enduml
4.8
Notes
You can add notes on a activity using the commands note left, note right, note top or note
bottom, just after the description of the activity you want to note.
If you want to put a note on the starting point, define the note at the very beginning of the diagram
description.
You can also have a note on several lines, using the endnote keywords.
@startuml
(*) --> "Some Activity"
note right: This activity has to be defined
"Some Activity" --> (*)
note left
This note is on
several lines
end note
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
55 of 118
4.9 Partition
4.9
4
アクティビティ図
Partition
You can define a partition using the partition keyword, and optionally declare a background color
for your partition (Using a html color code or name)
When you declare activities, they are automatically put in the last used partition.
You can close the partition definition using a closing bracket }.
@startuml
partition Conductor {
(*) --> "Climbs on Platform"
--> === S1 ===
--> Bows
}
partition Audience LightSkyBlue {
=== S1 === --> Applauds
}
partition Conductor {
Bows --> === S2 ===
--> WavesArmes
Applauds --> === S2 ===
}
partition Orchestra #CCCCEE {
WavesArmes --> Introduction
--> "Play music"
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
56 of 118
4.10 Title the diagram
4
アクティビティ図
4.10 Title the diagram
The title keywords is used to put a title.
You can use title and end title keywords for a longer title, as in sequence diagrams.
@startuml
title Simple example\nof title
(*) --> "First activity"
--> (*)
@enduml
4.11 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can define specific color and fonts for stereotyped activities.
@startuml
skinparam backgroundColor #AAFFFF
skinparam activity {
StartColor red
BarColor SaddleBrown
EndColor Silver
BackgroundColor Peru
BackgroundColor << Begin >> Olive
BorderColor Peru
FontName Impact
}
(*)
-->
-->
-->
-->
-->
--> "Climbs on Platform" << Begin >>
=== S1 ===
Bows
=== S2 ===
WavesArmes
(*)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
57 of 118
4.12 Octagon
4
アクティビティ図
4.12 Octagon
You can change the shape of activities to octagon using the skinparam activityShape octagon
command.
@startuml
'Default is skinparam activityShape roundBox
skinparam activityShape octagon
(*) --> "First Activity"
"First Activity" --> (*)
@enduml
4.13
完全な例
@startuml
title Servlet Container
(*) --> "ClickServlet.handleRequest ()"
--> "new Page"
if "Page.onSecurityCheck" then
->[true] "Page.onInit ()"
if "isForward ?" then
->[no] "Process controls"
if "continue processing ?" then
-->[yes] === RENDERING ===
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
58 of 118
4.13 完全な例
4
アクティビティ図
else
-->[no] === REDIRECT_CHECK ===
endif
else
-->[yes] === RENDERING ===
endif
if "is Post ?" then
-->[yes] "Page.onPost ()"
--> "Page.onRender ()" as render
--> === REDIRECT_CHECK ===
else
-->[no] "Page.onGet ()"
--> render
endif
else
-->[false] === REDIRECT_CHECK ===
endif
if "Do redirect ?" then
->[yes] "redirect request"
--> == BEFORE_DESTROY ===
else
if "Do Forward ?" then
-left ->[yes] "Forward request"
--> == BEFORE_DESTROY ===
else
-right ->[no] "Render page template"
--> == BEFORE_DESTROY ===
endif
endif
--> "Page.onDestroy ()"
-->(*)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
59 of 118
4.13 完全な例
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
4
アクティビティ図
60 of 118
5 アクティビティ図(ベータ版)
5
アクティビティ図(ベータ版)
アクティビティ図ための現在の構文には、いくつかの制限と欠点(例えば、メンテナンスが難し
い)があります。
私たちがより良い書式と構文を定義できるように、そのような完全な構文と実装は、ベータ版と
してユーザーに提案されています。
この新しい実装のもう一つの利点は、Graphviz パッケージのインストールを必要としないこと
です(シーケンス図には必要)。
新しい構文は古いものに取って代わるでしょう。しかし、互換性の理由で、上位互換を確保する
ことで、古い構文は認識されるでしょう。
ユーザーは新しい構文に移行することをつよく奨励されます。
5.1
単純なアクティビティ
アクティビティのラベルは: で開始し; で終了します。
テキストの書式設定は、Creole 記法の Wiki 構文を使用して行うことができます。
それらは定義順に暗黙的にリンクされます。
@startuml
:Hello world;
:This is on defined on
several ** lines **;
@enduml
5.2
開始/終了
図の開始と終了を示すために、キーワード start と stop を使用できます。
@startuml
start
:Hello world;
:This is on defined on
several ** lines **;
stop
@enduml
キーワード end もまた使用できます。
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
61 of 118
5.3 条件文
5 アクティビティ図(ベータ版)
@startuml
start
:Hello world;
:This is on defined on
several ** lines **;
end
@enduml
5.3
条件文
図に条件分岐を追加したい場合は、キーワード if、then そして else を使用することができま
す。ラベルは括弧を使用することで与えることができます。
@startuml
start
if (Graphviz installed ?) then (yes)
:process all\ndiagrams;
else (no)
:process only
__sequence__ and __activity__ diagrams;
endif
stop
@enduml
いくつもの条件分岐がある場合には、キーワード elseif を使用できます:
@startuml
start
if (condition A) then (yes)
:Text 1;
elseif (condition B) then (yes)
:Text 2;
stop
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
62 of 118
5.4 繰り返し(後判定)
5 アクティビティ図(ベータ版)
elseif (condition C) then (yes)
:Text 3;
elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif
stop
@enduml
5.4
繰り返し(後判定)
繰り返し処理(後判定)がある場合には、キーワード repeat と repeat while を使用できます。
@startuml
start
repeat
:read data;
:generate diagrams;
repeat while (more data ?)
stop
@enduml
5.5
繰り返し(前判定)
繰り返し処理(前判定)がある場合には、キーワード while と end while を使用できます。
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
63 of 118
5.6 並列処理
5 アクティビティ図(ベータ版)
@startuml
start
while (data available ?)
:read data;
:generate diagrams;
endwhile
stop
@enduml
キーワード endwhile の後ろ、または、キーワード is を使用することで、ラベルを与えること
ができます。
@startuml
while (check filesize ?) is (not empty)
:read file;
endwhile (empty)
:close file;
@enduml
5.6
並列処理
並列処理を示すために、キーワード fork、fork again そして end fork が使用できます。
@startuml
start
if (multiprocessor ?) then (yes)
fork
:Treatment 1;
fork again
:Treatment 2;
end fork
else (monoproc)
:Treatment 1;
:Treatment 2;
endif
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
64 of 118
5.7 注釈
5 アクティビティ図(ベータ版)
@enduml
5.7
注釈
Creole 表記の Wiki 構文を使用することで、テキストの書式設定ができます。
@startuml
start
:foo1;
note left: This is a note
:foo2;
note right
This note is on several
// lines // and can
contain <b>HTML </b>
====
* Calling the method ""foo ()"" is prohibited
end note
stop
@enduml
5.8
タイトル&説明文
タイトル、ヘッダ、フッタ、図の説明を付け足すことができます:
@startuml
title this is my title
if (condition ?) then (yes)
:yes;
else (no)
:no;
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
65 of 118
5.9 色指定
5 アクティビティ図(ベータ版)
note right
this is a note
end note
endif
stop
legend
this is the legend
endlegend
footer dummy footer
header
this is
a long __dummy__ header
end header
@enduml
5.9
色指定
各アクティビティに、色を指定することができます。
@startuml
start
:starting progress;
#HotPink:reading configuration files
These files should edited at this point !;
#AAAAAA:ending of the process;
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
66 of 118
5.10 矢印
5.10
5 アクティビティ図(ベータ版)
矢印
記号 -> を用いて、矢印にテキストを添えることができ、また、色を変えることもできます。
@startuml
:foo1;
-> You can put text on arrows;
if (test) then
-[#blue]->
:foo2;
-[#green]-> The text can
also be on several lines
and ** very ** long ...;
:foo3;
else
-[#black]->
:foo4;
endif
-[#gray]->
:foo5;
@enduml
5.11
グループ化
キーワード partition で複数のアクティビティを分割して、グループ化できます:
@startuml
start
partition Initialization {
:read config file;
:init internal variable;
}
partition Running {
:wait for user interaction;
:print information;
}
stop
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
67 of 118
5.12 動線
5.12
5 アクティビティ図(ベータ版)
動線
パイプ記号 | を用いて、複数の動線を定義することができます。
さらに、動線毎に色を変えることができます。
@startuml
|Swimlane1|
start
:foo1;
|# AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
68 of 118
5.13 分離
5.13
5 アクティビティ図(ベータ版)
分離
キーワード detach を使用して、矢印を取り除くことができます。
@startuml
:start;
fork
:foo1;
:foo2;
fork again
:foo3;
detach
endfork
if (foo4) then
:foo5;
detach
endif
:foo6;
detach
:foo7;
stop
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
69 of 118
5.14 SDL 図
5 アクティビティ図(ベータ版)
5.14 SDL 図
終端記号; を置き換えることで、アクティビティの表現形式を変えることができます:
• |
• <
• >
• /
• ]
• }
@startuml
:Ready;
:next(o)|
:Receiving;
split
:nak(i)<
:ack(o)>
split again
:ack(i)<
:next(o)
on several line|
:i := i + 1]
:ack(o)>
split again
:err(i)<
:nak(o)>
split again
:foo/
split again
:i > 5}
stop
end split
:finish;
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
70 of 118
5.15 完全な例
5.15
5 アクティビティ図(ベータ版)
完全な例
@startuml
start
:ClickServlet.handleRequest ();
:new page;
if (Page.onSecurityCheck) then (true)
:Page.onInit ();
if (isForward ?) then (no)
:Process controls;
if (continue processing ?) then (no)
stop
endif
if (isPost ?) then (yes)
:Page.onPost ();
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
71 of 118
5.15 完全な例
5 アクティビティ図(ベータ版)
else (no)
:Page.onGet ();
endif
:Page.onRender ();
endif
else (false)
endif
if (do redirect ?) then (yes)
:redirect process;
else
if (do forward ?) then (yes)
:Forward request;
else (no)
:Render page template;
endif
endif
stop
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
72 of 118
6
6
6.1
コンポーネント図
コンポーネント図
コンポーネント
コンポーネントは括弧でくくります。
また、component キーワードでもコンポーネントを定義できます。そして、コンポーネントには
as キーワードにより別名をつけることができます。この別名は、後でリレーションを定義する
ときに使えます。
@startuml
[First component]
[Another component] as Comp2
component Comp3
component [Last\ncomponent] as Comp4
@enduml
6.2
インタフェース
Interface can be defined using the () symbol (because this looks like a circle).
You can also use the interface keyword to defines an interface. And you can define an alias, using
the as keyword. This alias will be used latter, when defining relations.
We will see latter that interface definition is optional.
@startuml
() "First Interface"
() "Another interface" as Interf2
interface Interf3
interface "Last\ninterface" as Interf4
@enduml
6.3
Basic example
Links between elements are made using combinations of dotted line (..), straight line (--), and
arrows (-->) symbols.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
73 of 118
6.4 Using notes
6
コンポーネント図
@startuml
DataAccess - [First Component]
[First Component] ..> HTTP : use
@enduml
6.4
Using notes
You can use the note left of , note right of , note top of , note bottom of keywords to
define notes related to a single object.
A note can be also define alone with the note keywords, then linked to other objects using the ..
symbol.
@startuml
interface "Data Access" as DA
DA - [First Component]
[First Component] ..> HTTP : use
note left of HTTP : Web Service only
note right of [First Component]
A note can also
be on several lines
end note
@enduml
6.5
Grouping Components
You can use several keywords to group components and interfaces together:
• package
• node
• folder
• frame
• cloud
• database
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
74 of 118
6.5 Grouping Components
6
コンポーネント図
@startuml
package "Some Group" {
HTTP - [First Component]
[Another Component]
}
node "Other Groups" {
FTP - [Second Component]
[First Component] --> FTP
}
cloud {
[Example 1]
}
database "MySql" {
folder "This is my folder" {
[Folder 3]
}
frame "Foo" {
[Frame 4]
}
}
[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
75 of 118
6.6 Changing arrows direction
6.6
6
コンポーネント図
Changing arrows direction
By default, links between classes have two dashes -- and are vertically oriented. It is possible to
use horizontal link by putting a single dash (or dot) like this:
@startuml
[Component] --> Interface1
[Component] -> Interface2
@enduml
You can also change directions by reversing the link:
@startuml
Interface1 <-- [Component]
Interface2 <- [Component]
@enduml
また、left を加えることで矢印の向きを変更することもできます。right, up, down などのキー
ワードを矢印の間に記述します。:
@startuml
[Component]
[Component]
[Component]
[Component]
@enduml
-left -> left
-right -> right
-up -> up
-down -> down
You can shorten the arrow by using only the first character of the direction (for example, -dinstead of -down-) or the two first characters (-do-).
Please note that you should not abuse this functionality : Graphviz gives usually good results
without tweaking.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
76 of 118
6.7 Title the diagram
6.7
6
コンポーネント図
Title the diagram
The title keywords is used to put a title.
You can use title and end title keywords for a longer title, as in sequence diagrams.
@startuml
title Very simple component\ndiagram
interface "Data Access" as DA
DA - [First Component]
[First Component] ..> HTTP : use
@enduml
6.8
Use UML2 notation
The skinparam componentStyle uml2 command is used to switch to UML2 notation.
@startuml
skinparam componentStyle uml2
interface "Data Access" as DA
DA - [First Component]
[First Component] ..> HTTP : use
@enduml
6.9
Individual colors
You can specify a color after component definition.
@startuml
component
@enduml
[Web Server] #Yellow
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
77 of 118
6.10 Skinparam
6
コンポーネント図
6.10 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can define specific color and fonts for stereotyped components and interfaces.
@startuml
skinparam component {
FontSize 13
InterfaceBackgroundColor RosyBrown
InterfaceBorderColor orange
BackgroundColor <<Apache >> Red
BorderColor <<Apache >> #FF6655
FontName Courier
BorderColor black
BackgroundColor gold
ArrowFontName Impact
ArrowColor #FF6655
ArrowFontColor #777777
}
() "Data Access" as DA
DA - [First Component]
[First Component] ..> () HTTP : use
HTTP - [Web Server] << Apache >>
@enduml
@startuml
[AA] <<static lib >>
[BB] <<shared lib >>
[CC] <<static lib >>
node node1
node node2 <<shared node >>
database Production
skinparam component {
backgroundColor <<static lib >> DarkKhaki
backgroundColor <<shared lib >> Green
}
skinparam node {
borderColor Green
backgroundColor Yellow
backgroundColor <<shared node >> Magenta
}
skinparam databaseBackgroundColor Aqua
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
78 of 118
6.10 Skinparam
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
6
コンポーネント図
79 of 118
7
7
7.1
ステート図
ステート図
簡単なステート
ステート図の始点と終点は、[*] で示します。
矢印は、--> で示します。
@startuml
[*] --> State1
State1 --> [*]
State1 : this is a string
State1 : this is another string
State1 -> State2
State2 --> [*]
@enduml
7.2
複合状態
状態は複合することができます。キーワード state と中括弧を使用して定義することができま
す。
@startuml
scale 350 width
[*] --> NotShooting
state NotShooting {
[*] --> Idle
Idle --> Configuring : EvConfig
Configuring --> Idle : EvConfig
}
state Configuring {
[*] --> NewValueSelection
NewValueSelection --> NewValuePreview : EvNewValue
NewValuePreview --> NewValueSelection : EvNewValueRejected
NewValuePreview --> NewValueSelection : EvNewValueSaved
state NewValuePreview {
State1 -> State2
}
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
80 of 118
7.3 長い言葉
7.3
7
ステート図
長い言葉
キーワード state によって、状態についての長めの記述を使用することができます。
@startuml
scale 600 width
[*] -> State1
State1 --> State2 : Succeeded
State1 --> [*] : Aborted
State2 --> State3 : Succeeded
State2 --> [*] : Aborted
state State3 {
state "Accumulate Enough Data\nLong State Name" as long1
long1 : Just a test
[*] --> long1
long1 --> long1 : New Data
long1 --> ProcessData : Enough Data
}
State3 --> State3 : Failed
State3 --> [*] : Succeeded / Save Result
State3 --> [*] : Aborted
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
81 of 118
7.4 同時状態
7.4
7
ステート図
同時状態
記号 --で分離することで、同時状態となる複合状態を定義することができます。
@startuml
[*] --> Active
state Active {
[*] -> NumLockOff
NumLockOff --> NumLockOn : EvNumLockPressed
NumLockOn --> NumLockOff : EvNumLockPressed
-[*] -> CapsLockOff
CapsLockOff --> CapsLockOn : EvCapsLockPressed
CapsLockOn --> CapsLockOff : EvCapsLockPressed
-[*] -> ScrollLockOff
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
82 of 118
7.5 矢印の方向
7.5
7
ステート図
矢印の方向
記号 -> を水平矢印として使用でき、以下の構文を使用することで、矢印の方向を支配すること
ができます。
• -down-> (default arrow)
• -right-> or ->
• -left->
• -up->
@startuml
[*] -up -> First
First -right -> Second
Second --> Third
Third -left -> Last
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
83 of 118
7.6 注釈
7
ステート図
方向を示す単語の、最初の文字だけ(例:-down-の代わりに -d-)、または 2 文字(-do-)を使
用することで、矢印の記述を短くすることができます。
この機能を乱用しないよう注意しなくてはいけません:通常、Graphviz は微調整なしでよい結
果をもたらしてくれます。
7.6
注釈
キーワード note left of, note right of, note top of, note bottom of を使用して注釈を定
義することができます。
さらに、いくつもの行で注釈を定義できます。
@startuml
[*] --> Active
Active --> Inactive
note left of Active : this is a short\nnote
note right of Inactive
A note can also
be defined on
several lines
end note
@enduml
さらに、状態にひもづかない注釈を定義できます。
@startuml
state foo
note "This is a floating note" as N1
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
84 of 118
7.7 もっと注釈
7.7
7
ステート図
もっと注釈
複合状態にも注釈をつけることができます。
@startuml
[*] --> NotShooting
state "Not Shooting State" as NotShooting {
state "Idle mode" as Idle
state "Configuring mode" as Configuring
[*] --> Idle
Idle --> Configuring : EvConfig
Configuring --> Idle : EvConfig
}
note right of NotShooting : This is a note on a composite state
@enduml
7.8
見栄え
描画のフォントや色を変えるコマンド skinparam を使用できます。
このコマンドは以下のように使用できます。
• 図の定義において、他のコマンドと同じように。
• インクルードファイルとして。
• 設定ファイルとして、コマンドラインや ANT タスクから提供する。
定型化した状態に、特定の色とフォントを定義することができます。
@startuml
skinparam backgroundColor LightYellow
skinparam state {
StartColor MediumBlue
EndColor Red
BackgroundColor Peru
BackgroundColor <<Warning >> Olive
BorderColor Gray
FontName Impact
}
[*] --> NotShooting
state "Not Shooting State" as NotShooting {
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
85 of 118
7.8 見栄え
7
ステート図
state "Idle mode" as Idle <<Warning >>
state "Configuring mode" as Configuring
[*] --> Idle
Idle --> Configuring : EvConfig
Configuring --> Idle : EvConfig
}
NotShooting --> [*]
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
86 of 118
8
8
8.1
OBJECT DIAGRAM
Object Diagram
Definition of objects
You define instance of objects using the object keywords.
@startuml
object firstObject
object "My Second Object" as o2
@enduml
8.2
Relations between objects
Relations between objects are defined using the following symbols :
Extension
Composition
Aggregation
<|-*-o--
It is possible to replace -- by .. to have a dotted line.
Knowing those rules, it is possible to draw the following drawings.
It is possible a add a label on the relation, using ” : ”, followed by the text of the label.
For cardinality, you can use double-quotes "" on each side of the relation.
@startuml
object Object01
object Object02
object Object03
object Object04
object Object05
object Object06
object Object07
object Object08
Object01
Object03
Object05
Object07
@enduml
8.3
<|-- Object02
*-- Object04
o-- "4" Object06
.. Object08 : some labels
Adding fields
To declare fields, you can use the symbol ":" followed by the field’s name.
@startuml
object user
user : name = "Dummy"
user : id = 123
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
87 of 118
8.4 Common features with class diagrams
8
OBJECT DIAGRAM
It is also possible to ground between brackets {} all fields.
@startuml
object user {
name = "Dummy"
id = 123
}
@enduml
8.4
Common features with class diagrams
• Visibility
• Defines notes
• Use packages
• Title the diagram
• Skin the output
• Split the image
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
88 of 118
9 共通コマンド
共通コマンド
9
9.1
フッターとヘッダー
どのダイアグラムも、header 及び footer で、ヘッダー及びフッターを追加できます。
You can optionally specify if you want a center, left or right footer/header, by adding a keyword.
As for title, it is possible to define a header or a footer on several lines.
It is also possible to put some HTML into the header or footer.
@startuml
Alice -> Bob: Authentication Request
header
<font color=red >Warning :</font >
Do not use in production.
endheader
center footer Generated for demonstration
@enduml
9.2
Zoom
You can use the scale command to zoom the generated image.
You can use either a number or a fraction to define the scale factor. You can also specify either
width or height (in pixel). And you can also give both width and height : the image is scaled to fit
inside the specified dimension.
• scale 1.5
• scale 2/3
• scale 200 width
• scale 200 height
• scale 200*100
• scale max 300*200
@startuml
scale 180*90
Bob ->Alice : hello
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
89 of 118
10
10
SALT
Salt
Salt is a subproject included in PlantUML that may help you to design graphical interface.
You can use either @startsalt keyword, or @startuml followed by a line with salt keyword.
10.1
Basic widgets
A window must start and end with brackets. You can then define:
•
•
•
•
Button using [ and ].
Radio button using ( and ).
Checkbox using [ and ].
User text area using ".
@startuml
salt
{
Just plain text
[This is my button]
() Unchecked radio
(X) Checked radio
[] Unchecked box
[X] Checked box
"Enter text here
"
^This is a droplist^
}
@enduml
The goal of this tool is to discuss about simple and sample windows.
10.2
Using grid
A table is automatically created when you use an opening bracket {.
And you have to use | to separate columns.
For example:
@startsalt
{
Login
| "MyName
"
Password | "****
"
[Cancel] | [ OK
]
}
@endsalt
Just after the opening bracket, you can use a character to define if you want to draw lines or columns
of the grid :
# To display all vertical and horizontal lines
! To display all vertical lines
- To display all horizontal lines
+ To display external lines
@startsalt
{+
Login
| "MyName
"
Password | "****
"
[Cancel] | [ OK
]
}
@endsalt
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
90 of 118
10.3 Using separator
10.3
10
SALT
Using separator
You can use several horizontal lines as separator.
@startsalt
{
Text1
..
"Some field"
==
Note on usage
~~
Another text
-[Ok]
}
@endsalt
10.4
Tree widget
To have a Tree, you have to start with {T and to use + to denote hierarchy.
@startsalt
{
{T
+ World
++ America
+++ Canada
+++ USA
++++ New York
++++ Boston
+++ Mexico
++ Europe
+++ Italy
+++ Germany
++++ Berlin
++ Africa
}
}
@endsalt
10.5
Enclosing brackets
You can define subelements by opening a new opening bracket.
@startsalt
{
Name
| "
"
Modifiers:
| { (X) public | () default | () private | () protected
[] abstract | [] final
| [] static }
Superclass: | { "java.lang.Object " | [Browse ...] }
}
@endsalt
10.6
Adding tabs
You can add tabs using {/ notation. Note that you can use HTML code to have bold text.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
91 of 118
10.7 Using menu
10
SALT
@startsalt
{+
{/ <b>General | Fullscreen | Behavior | Saving }
{
{ Open image in: | ^Smart Mode^ }
[X] Smooth images when zoomed
[X] Confirm image deletion
[ ] Show hidden images
}
[Close]
}
@endsalt
Tab could also be vertically oriented:
@startsalt
{+
{/ <b>General
Fullscreen
Behavior
Saving } |
{
{ Open image in: | ^Smart Mode^ }
[X] Smooth images when zoomed
[X] Confirm image deletion
[ ] Show hidden images
[Close]
}
}
@endsalt
10.7
Using menu
You can add a menu by using {* notation.
@startsalt
{+
{* File | Edit | Source | Refactor }
{/ General | Fullscreen | Behavior | Saving }
{
{ Open image in: | ^Smart Mode^ }
[X] Smooth images when zoomed
[X] Confirm image deletion
[ ] Show hidden images
}
[Close]
}
@endsalt
It is also possible to open a menu:
@startsalt
{+
{* File | Edit | Source | Refactor
Refactor | New | Open File | - | Close | Close All }
{/ General | Fullscreen | Behavior | Saving }
{
{ Open image in: | ^Smart Mode^ }
[X] Smooth images when zoomed
[X] Confirm image deletion
[ ] Show hidden images
}
[Close]
}
@endsalt
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
92 of 118
10.8 Advanced table
10.8
10
SALT
Advanced table
You can use two special notations for table :
• * to indicate that a cell with span with left
• . to denotate an empty cell
@startsalt
{#
. | Column 2 | Column 3
Row header 1 | value 1 | value 2
Row header 2 | A long cell | *
}
@endsalt
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
93 of 118
11
11
CREOLE
Creole
A light Creole engine have been integrated into PlantUML to have a standardized way of defining
text style.
All diagrams are now supporting this syntax.
(Note that ascending compatibility with HTML syntax is preserved)
11.1
Emphasized text
@startuml
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
@enduml
11.2
List
@startuml
object demo {
* Bullet list
* Second item
** Sub item
}
legend
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item
end legend
@enduml
11.3
Escape character
You can use the tilde ~ to escape special creole characters.
@startuml
object demo {
This is not ~___underscored__.
This is not ~"" monospaced "".
}
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
94 of 118
11.4 Horizontal lines
11.4
11
CREOLE
Horizontal lines
@startuml
database DB1 as "
You can have horizontal line
---Or double line
====
Or strong line
____
Or dotted line
..My title ..
Enjoy!
"
note right
This is working also in notes
You can also add title in all these lines
== Title ==
--Another title -end note
@enduml
11.5
Headings
@startuml
usecase UC1 as "
= Extra -large heading
Some text
== Large heading
Other text
=== Medium heading
Information
....
==== Small heading"
@enduml
11.6
Legacy HTML
Some HTML tags are also working:
• <b> for bold text
• <u> or <u:#AAAAAA> or <u:colorName> for underline
• <i> for italic
• <s> or <s:#AAAAAA> or <s:colorName> for strike text
• <w> or <w:#AAAAAA> or <w:colorName> for wave underline text
• <color:#AAAAAA> or <color:colorName>
• <back:#AAAAAA> or <back:colorName> for background color
• <size:nn> to change font size
• <img:file> : the file must be accessible by the filesystem
• <img:http://url> : the URL must be available from the Internet
@startuml
:* You can change <color:red >text color </color >
* You can change <back:cadetblue >background color </back >
* You can change <size :18>size </size >
* You use <u>legacy </u> <b>HTML <i>tag </i></b>
* You use <u:red >color </u> <s:green >in HTML </s> <w:#0000FF >tag </w>
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
95 of 118
11.7 Table
11
CREOLE
---* Use image : <img:sourceforge.jpg >
;
@enduml
11.7
Table
@startuml
skinparam titleFontSize 14
title
Example of simple table
|= |= table |= header |
| a | table | row |
| b | table | row |
end title
[*] --> State1
@enduml
11.8
Tree
You can use |_ characters to build a tree.
@startuml
skinparam titleFontSize 14
title
Example of Tree
|_ First line
|_ **Bom(Model )**
|_ prop1
|_ prop2
|_ prop3
|_ Last line
end title
[*] --> State1
@enduml
11.9
Special characters
It’s possible to use any unicode characters with &# syntax or <U+XXXX>
@startuml
usecase foo as "this is &#8734; long"
usecase bar as "this is also <U+221E> long"
@enduml
11.10
OpenIconic
OpenIconic is an very nice open source icon set. Those icons have been integrated into the creole
parser, so you can use them out-of-the-box.
You can use the following syntax: <&ICON_NAME>.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
96 of 118
11.10 OpenIconic
11
CREOLE
@startuml
title: <size :20><&heart >Use of OpenIconic <&heart ></size >
class Wifi
note left
Click on <&wifi >
end note
@enduml
The complete list is available on OpenIconic Website, or you can use the following special diagram:
@startuml
listopeniconic
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
97 of 118
11.11 Defining and using sprites
11.11
11
CREOLE
Defining and using sprites
A Sprite is a small graphic element that can be used in diagrams.
In PlantUML, sprites are monochrome and can have either 4, 8 or 16 gray level.
To define a sprite, you have to use a hexadecimal digit between 0 and F per pixel.
Then you can use the sprite using <$XXX> where XXX is the name of the sprite.
@startuml
sprite $foo1 {
FFFFFFFFFFFFFFF
F0123456789ABCF
F0123456789ABCF
F0123456789ABCF
F0123456789ABCF
F0123456789ABCF
F0123456789ABCF
F0123456789ABCF
F0123456789ABCF
FFFFFFFFFFFFFFF
}
Alice -> Bob : Testing <$foo1 >
@enduml
11.12
Encoding Sprite
To encode sprite, you can use the command line like:
java -jar plantuml.jar -encodesprite 16z foo.png
where foo.png if the image file you want to use (it will be converted to gray automatically).
After -encodesprite, you have to specify a format: 4, 8, 16, 4z, 8z or 16z.
The number indicates the gray level and the optionnal z is used to enable compression in sprite
definition.
11.13
Importing Sprite
You can also launch the GUI to generate a sprite from an existing image.
Click in the menubar then on File/Open Sprite Window.
After copying an image into you clipboard, several possible definitions of the corresponding sprite
will be displayed : you will just have to pickup the one you want.
11.14
Examples
@startuml
sprite $printer [15 x15/8z] NOtH3W0W208HxFz_kMAhj7lHWpa1XC716sz0Pq4MVPEWfBHIuxP3L6kbTcizR8tAhzaqFvXwvFfPEq
start
:click on <$printer > to print the page;
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
98 of 118
11.14 Examples
11
CREOLE
@startuml
sprite $bug [15 x15 /16z] PKzR2i0m2BFMi15p__FEjQEqB1z27aeqCqixa8S4OT7C53cKpsHpaYPDJY_12MHM - BLRyywPhrrlw3qum
sprite $printer [15 x15/8z] NOtH3W0W208HxFz_kMAhj7lHWpa1XC716sz0Pq4MVPEWfBHIuxP3L6kbTcizR8tAhzaqFvXwvFfPEq
sprite $disk {
444445566677881
436000000009991
43600000000 ACA1
53700000001 A7A1
53700000012 B8A1
53800000123 B8A1
63800001233 C9A1
634999 AABBC99B1
744566778899 AB1
7456 AAAAA99AAB1
8566 AFC228AABB1
8567 AC8118BBBB1
867 BD4433BBBBB1
39 AAAAABBBBBBC1
}
title Use of sprites (<$printer >, <$bug >...)
class Example {
Can have some bug : <$bug >
Click on <$disk > to save
}
note left : The printer <$printer > is available
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
99 of 118
12
12
12.1
フォントや色の変更
フォントや色の変更
使い方
You can change colors and font of the drawing using the skinparam command. Example:
skinparam backgroundColor yellow
You can use this command :
• In the diagram definition, like any other commands,
• In an included file (see Preprocessing),
• In a configuration file, provided in the command line or the ANT task.
12.2
Nested
To avoid repetition, it is possible to nest definition. So the following definition :
skinparam
skinparam
skinparam
skinparam
xxxxParam1
xxxxParam2
xxxxParam3
xxxxParam4
value1
value2
value3
value4
is strictly equivalent to:
skinparam xxxx {
Param1 value1
Param2 value2
Param3 value3
Param4 value4
}
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
100 of 118
12.3 Color
12.3
12
フォントや色の変更
Color
You can use either standard color name or RGB code.
Parameter name
backgroundColor
activityArrowColor
activityBackgroundColor
activityBorderColor
activityStartColor
activityEndColor
activityBarColor
usecaseArrowColor
usecaseActorBackgroundColor
usecaseActorBorderColor
usecaseBackgroundColor
usecaseBorderColor
classArrowColor
classBackgroundColor
classBorderColor
packageBackgroundColor
packageBorderColor
stereotypeCBackgroundColor
stereotypeABackgroundColor
stereotypeIBackgroundColor
stereotypeEBackgroundColor
componentArrowColor
componentBackgroundColor
componentBorderColor
componentInterfaceBackgroundColor
componentInterfaceBorderColor
noteBackgroundColor
noteBorderColor
stateBackgroundColor
stateBorderColor
stateArrowColor
stateStartColor
stateEndColor
sequenceArrowColor
sequenceActorBackgroundColor
sequenceActorBorderColor
sequenceGroupBackgroundColor
sequenceLifeLineBackgroundColor
sequenceLifeLineBorderColor
sequenceParticipantBackgroundColor
sequenceParticipantBorderColor
Default
Value
Color
white
#A80036
Comment
Background of the page
Color of arrows in activity diagrams
#FEFECE
Background of activities
#A80036
Color of activity borders
black
Starting circle in activity diagrams
black
Ending circle in activity diagrams
black
Synchronization bar in activity diagrams
#A80036
#FEFECE
#A80036
#FEFECE
ユースケース図中における矢印の色
Head’s color of actor in usecase diagrams
Color of actor borders in usecase diagrams
Background of usecases
#A80036
Color of usecase borders in usecase diagrams
#A80036
Color of arrows in class diagrams
#FEFECE
#A80036
#FEFECE
#A80036
Background of classes/interface/enum in class diagrams
Borders of classes/interface/enum in class diagrams
Background of packages in class diagrams
Borders of packages in class diagrams
#ADD1B2
Background of class spots in class diagrams
#A9DCDF
Background of abstract class spots in class diagrams
#B4A7E5
Background of interface spots in class diagrams
#EB937F
Background of enum spots in class diagrams
#A80036
Color of arrows in component diagrams
#FEFECE
#A80036
#FEFECE
Background of components
Borders of components
Background of interface in component diagrams
#A80036
Border of interface in component diagrams
#FBFB77
Background of notes
#A80036
Border of notes
#FEFECE
Background of states in state diagrams
#A80036
Border of states in state diagrams
#A80036
Colors of arrows in state diagrams
black
Starting circle in state diagrams
black
Ending circle in state diagrams
#A80036
#FEFECE
#A80036
#EEEEEE
white
#A80036
#FEFECE
#A80036
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
Color of arrows in sequence diagrams
Head’s color of actor in sequence diagrams
Border of actor in sequence diagrams
Header color of alt/opt/loop in sequence diagrams
Background of life line in sequence diagrams
Border of life line in sequence diagrams
Background of participant in sequence diagrams
Border of participant in sequence diagrams
101 of 118
12.4 Font color, name and size
12.4
12
フォントや色の変更
Font color, name and size
You can change the font for the drawing using xxxFontColor, xxxFontSize and xxxFontName
parameters.
Example:
skinparam classFontColor red
skinparam classFontSize 10
skinparam classFontName Aapex
You can also change the default font for all fonts using skinparam defaultFontName.
例:
skinparam defaultFontName Aapex
フォント名はシステム依存性が非常に高いため、ポータビリティを考慮する場合は多用しないで
ください。
Parameter
Name
activityFontColor
activityFontSize
activityFontStyle
activityFontName
activityArrowFontColor
activityArrowFontSize
activityArrowFontStyle
activityArrowFontName
circledCharacterFontColor
circledCharacterFontSize
circledCharacterFontStyle
circledCharacterFontName
circledCharacterRadius
classArrowFontColor
classArrowFontSize
classArrowFontStyle
classArrowFontName
classAttributeFontColor
classAttributeFontSize
classAttributeIconSize
classAttributeFontStyle
classAttributeFontName
classFontColor
classFontSize
classFontStyle
classFontName
classStereotypeFontColor
classStereotypeFontSize
classStereotypeFontStyle
classStereotypeFontName
componentFontColor
componentFontSize
componentFontStyle
componentFontName
componentStereotypeFontColor
componentStereotypeFontSize
componentStereotypeFontStyle
componentStereotypeFontName
Default
Value
black
14
plain
black
13
plain
black
17
bold
Courier
11
black
10
plain
black
10
10
plain
black
12
plain
black
12
italic
black
14
plain
black
14
italic
Comment
Used for activity box
Used for text on arrows in activity diagrams
Used for text in circle for class, enum and others
Used for text on arrows in class diagrams
Class attributes and methods
Used for classes name
Used for stereotype in classes
Used for components name
Used for stereotype in components
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
102 of 118
12.4 Font color, name and size
componentArrowFontColor
componentArrowFontSize
componentArrowFontStyle
componentArrowFontName
noteFontColor
noteFontSize
noteFontStyle
noteFontName
packageFontColor
packageFontSize
packageFontStyle
packageFontName
sequenceActorFontColor
sequenceActorFontSize
sequenceActorFontStyle
sequenceActorFontName
sequenceDividerFontColor
sequenceDividerFontSize
sequenceDividerFontStyle
sequenceDividerFontName
sequenceArrowFontColor
sequenceArrowFontSize
sequenceArrowFontStyle
sequenceArrowFontName
sequenceGroupingFontColor
sequenceGroupingFontSize
sequenceGroupingFontStyle
sequenceGroupingFontName
sequenceGroupingHeaderFontColor
sequenceGroupingHeaderFontSize
sequenceGroupingHeaderFontStyle
sequenceGroupingHeaderFontName
sequenceParticipantFontColor
sequenceParticipantFontSize
sequenceParticipantFontStyle
sequenceParticipantFontName
sequenceTitleFontColor
sequenceTitleFontSize
sequenceTitleFontStyle
sequenceTitleFontName
titleFontColor
titleFontSize
titleFontStyle
titleFontName
stateFontColor
stateFontSize
stateFontStyle
stateFontName
stateArrowFontColor
stateArrowFontSize
stateArrowFontStyle
stateArrowFontName
stateAttributeFontColor
stateAttributeFontSize
stateAttributeFontStyle
stateAttributeFontName
12
black
13
plain
black
13
plain
black
14
plain
black
13
plain
black
13
bold
black
13
plain
black
11
plain
black
13
plain
black
13
plain
black
13
plain
black
18
plain
black
14
plain
black
13
plain
black
12
plain
フォントや色の変更
Used for text on arrows in component diagrams
シーケンス図以外のすべての図の注釈に適用される
Used for package and partition names
Used for actor in sequence diagrams
Used for text on dividers in sequence diagrams
Used for text on arrows in sequence diagrams
Used for text for ”else” in sequence diagrams
Used for text for ”alt/opt/loop” headers in sequence diagrams
Used for text on participant in sequence diagrams
Used for titles in sequence diagrams
Used for titles in all diagrams but sequence diagrams
Used for states in state diagrams
Used for text on arrows in state diagrams
Used for states description in state diagrams
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
103 of 118
12.4 Font color, name and size
usecaseFontColor
usecaseFontSize
usecaseFontStyle
usecaseFontName
usecaseStereotypeFontColor
usecaseStereotypeFontSize
usecaseStereotypeFontStyle
usecaseStereotypeFontName
usecaseActorFontColor
usecaseActorFontSize
usecaseActorFontStyle
usecaseActorFontName
usecaseActorStereotypeFontColor
usecaseActorStereotypeFontSize
usecaseActorStereotypeFontStyle
usecaseActorStereotypeFontName
usecaseArrowFontColor
usecaseArrowFontSize
usecaseArrowFontStyle
usecaseArrowFontName
footerFontColor
footerFontSize
footerFontStyle
footerFontName
headerFontColor
headerFontSize
headerFontStyle
headerFontName
12
black
14
plain
black
14
italic
black
14
plain
black
14
italic
black
13
plain
black
10
plain
black
10
plain
フォントや色の変更
Used for usecase labels in usecase diagrams
Used for stereotype in usecase
Used for actor labels in usecase diagrams
Used for stereotype for actor
ユースケース図の矢印上のテキストに適用される
Used for footer
Used for header
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
104 of 118
12.5 Black and White
12.5
12
フォントや色の変更
Black and White
You can force the use of a black white output using the skinparam monochrome true command.
@startuml
skinparam monochrome true
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
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
105 of 118
13
13
プリプロセッシング
プリプロセッシング
PlantUML は、すべてのダイアグラムで利用できるいくつかのマイナーなプリプロセッシング機
能を持っています。
それらの機能は、”#” が、感嘆符”!” であることを除けば、C 言語のプリプロセッサととても良
く似ています。
13.1
ファイルのインクルード
ダイアグラム内にファイルをインクルードするには、!include ディレクティブを使います。
Imagine you have the very same class that appears in many diagrams. Instead of duplicating the
description of this class, you can define a file that contains the description.
全く同じクラスが多数のダイアグラムに登場する状況を想像してみてください。このクラスにつ
いての記述を複製する代わりに、記述の内容をファイルに定義することが可能です。
@startuml
!include List.iuml
List <|.. ArrayList
@enduml
File List.iuml: interface List List : int size() List : void clear()
この List.iuml ファイルは複数のダイアグラムでインクルード可能です。また、このファイル
の変更はインクルードした全てのダイアログに反映されます。
複数の @startuml/@enduml ブロックをインクルードファイルに記述することも可能です。!0 を
追加してインクルードすることで、0 番目のブロックをインクルードすることができます。
たとえば、
!include foo.txt!1 と記述した場合、
foo.txt ファイルの二番目の @startuml/@enduml
ブロックの内容がインクルードされます。
13.2
Including URL
Use the !includeurl directive to include file from Internet/Intranet in your diagram.
You can also use !includeurl http://someurl.com/mypath!0 to specify which @startuml/@enduml
block from http://someurl.com/mypath you want to include. The !0 notation denotes the first
diagram.
13.3
定数を定義する
定数を定義するには !define ディレクティブを使います。定数名は言語 C と同様に、英数字と
アンダースコアを含むもので、数字で始めることはできません。
@startuml
!define SEQUENCE (S,# AAAAAA) Database Sequence
!define TABLE (T,# FFAAAA) Database Table
class USER << TABLE >>
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
106 of 118
13.4 Macro definition
13
プリプロセッシング
class ACCOUNT << TABLE >>
class UID << SEQUENCE >>
USER "1" -- "*" ACCOUNT
USER -> UID
@enduml
Of course, you can use the !include directive to define all your constants in a single file that you
include in your diagram.
Constant can be undefined with the !undef XXX directive.
You can also specify constants within the command line, with the -D flags.
java -jar plantuml.jar -DTITLE ="My title" atest1.txt
Note that the -D flag must be put after the ”-jar plantuml.jar” section.
13.4
Macro definition
You can also define macro with arguments.
@startuml
!define module(x) component x <<module >>
module(ABC)
module(XYZ)
@enduml
Macro can have several arguments.
@startuml
!define send(a,b,c) a->b : c
send(Alice , Bob , Hello)
send(Bob , Alice , ok)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
107 of 118
13.5 Macro on several lines
13.5
13
プリプロセッシング
Macro on several lines
You can also define macro on several lines using !definelong and !enddefinelong.
@startuml
!define DOUBLE(x) x x
!definelong AUTHEN(x,y)
x -> y : DOUBLE(hello)
y -> x : ok
!enddefinelong
AUTHEN(Bob ,Alice)
@enduml
13.6
Conditions
You can use !ifdef XXX and !endif directives to have conditionnal drawings.
The lines between those two directives will be included only if the constant after the !ifdef directive
has been defined before.
You can also provide a !else part which will be included if the constant has not been defined.
@startuml
!include ArrayList.iuml
@enduml
File ArrayList.iuml:
class ArrayList
!ifdef SHOW_METHODS
ArrayList : int size ()
ArrayList : void clear ()
!endif
You can then use the !define directive to activate the conditionnal part of the diagram.
@startuml
!define SHOW_METHODS
!include ArrayList.iuml
@enduml
You can also use the !ifndef directive that includes lines if the provided constant has NOT been
defined.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
108 of 118
13.7 Search path
13.7
13
プリプロセッシング
Search path
You can specify the java property ”plantuml.include.path” in the command line.
For example:
java -Dplantuml.include.path ="c:/ mydir" -jar plantuml.jar atest1.txt
Note the this -D option has to put before the -jar option. -D options after the -jar option will be
used to define constants within plantuml preprocessor.
13.8
Advanced features
It is possible to append text to a macro argument using the ## syntax.
@startuml
!definelong COMP_TEXTGENCOMP(name)
[name] << Comp >>
interface Ifc << IfcType >> AS name ##Ifc
name ##Ifc - [name]
!enddefinelong
COMP_TEXTGENCOMP(dummy)
@enduml
A macro can be defined by another macro.
@startuml
!define DOUBLE(x) x x
!definelong AUTHEN(x,y)
x -> y : DOUBLE(hello)
y -> x : ok
!enddefinelong
AUTHEN(Bob ,Alice)
@enduml
A macro can be polymorphic with argument count.
@startuml
!define module(x) component x <<module >>
!define module(x,y) component x as y <<module >>
module(foo)
module(bar , barcode)
@enduml
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
109 of 118
13.8 Advanced features
13
プリプロセッシング
You can use system environment variable or constant definition when using include:
!include %windir %/ test1.txt
!define PLANTUML_HOME /home/foo
!include PLANTUML_HOME/test1.txt
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
110 of 118
14 国際化
14
国際化
PlantUML 言語は、文字を使ってアクターやユースケースを定義することができます。この 文字
には A から Z までのラテン文字に限らず、すべての言語のすべての文字を使うことができます。
@startuml
skinparam backgroundColor #EEEBDC
actor 使 用 者
participant " 頭 等 艙 " as A
participant " 第 二 類 " as B
participant " 最 後 一 堂 課 " as 別 的 東 西
使 用 者 -> A: 完 成 這 項 工 作
activate A
A -> B: 創 建 請 求
activate B
B -> 別 的 東 西 : 創 建 請 求
activate 別 的 東 西
別 的 東 西 --> B: 這 項 工 作 完 成
destroy 別 的 東 西
B --> A: 請 求 創 建
deactivate B
A --> 使 用 者 : 做 完
deactivate A
@enduml
14.1
キャラクターセット
UML の記述を含むテキストファイルが読み込まれるときのキャラクターセットはシステムに依
存します。
通常はそれだけで問題ないはずですが、必要にならば別のキャラクターセットを使うこともでき
ます。例えば、コマンドラインに以下のように入力します:
java -jar plantuml.jar -charset UTF -8 files.txt
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
111 of 118
14.1 キャラクターセット
14 国際化
または ant タスクを使うこともできます:
<target name =" main">
<plantuml dir ="./ src" charset ="UTF -8" />
</target >
必要に応じて、次に示すキャラクターセットが使えるように Java がインストールされている必
要があります: ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-16.
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
112 of 118
15
15
色の名前
色の名前
ここにある色は PlantUML によって認識されます。色の名前は、大文字と小文字が区別されるこ
とに注意してください。
AliceBlue
AntiqueWhite
Aquamarine
Aqua
Azure
Beige
Bisque
Black
BlanchedAlmond
BlueViolet
Blue
Brown
BurlyWood
CadetBlue
Chartreuse
Chocolate
Coral
CornflowerBlue
Cornsilk
Crimson
Cyan
DarkBlue
DarkCyan
DarkGoldenRod
DarkGray
DarkGreen
DarkKhaki
DarkMagenta
DarkOliveGreen
DarkOrchid
DarkRed
DarkSalmon
DarkSeaGreen
DarkSlateBlue
DarkSlateGray
DarkTurquoise
DarkViolet
Darkorange
DeepPink
DeepSkyBlue
DimGray
DodgerBlue
FireBrick
FloralWhite
ForestGreen
Fuchsia
Gainsboro
GhostWhite
GoldenRod
Gold
Gray
GreenYellow
Green
HoneyDew
HotPink
IndianRed
Indigo
Ivory
Khaki
LavenderBlush
Lavender
LawnGreen
LemonChiffon
LightBlue
LightCoral
LightCyan
LightGoldenRodYellow
LightGreen
LightGrey
LightPink
LightSalmon
LightSeaGreen
LightSkyBlue
LightSlateGray
LightSteelBlue
LightYellow
LimeGreen
Lime
Linen
Magenta
Maroon
MediumAquaMarine
MediumBlue
MediumOrchid
MediumPurple
MediumSeaGreen
MediumSlateBlue
MediumSpringGreen
MediumTurquoise
MediumVioletRed
MidnightBlue
MintCream
MistyRose
Moccasin
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
NavajoWhite
Navy
OldLace
OliveDrab
Olive
OrangeRed
Orange
Orchid
PaleGoldenRod
PaleGreen
PaleTurquoise
PaleVioletRed
PapayaWhip
PeachPuff
Peru
Pink
Plum
PowderBlue
Purple
Red
RosyBrown
RoyalBlue
SaddleBrown
Salmon
SandyBrown
SeaGreen
SeaShell
Sienna
Silver
SkyBlue
SlateBlue
SlateGray
Snow
SpringGreen
SteelBlue
Tan
Teal
Thistle
Tomato
Turquoise
Violet
Wheat
WhiteSmoke
White
YellowGreen
Yellow
113 of 118
CONTENTS
CONTENTS
Contents
1 シーケンス図
1
1.1
基本的な例 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1.2
コメント
1
1.3
パーティシパントの宣言
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1.4
参加者名にアルファベット以外を使う . . . . . . . . . . . . . . . . . . . . . . . . . .
2
1.5
自分自身へのメッセージ
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
1.6
矢印の見た目を変える . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
1.7
矢印の色を替える . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
1.8
メッセージシーケンスの番号付け . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
1.9
タイトル
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
1.10 図の説明文 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
1.11 図の分割
7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.12 メッセージのグループ化
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
1.13 メッセージの注釈 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
1.14 その他の注釈 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
1.15 Changing notes shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
1.16 Creole and HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
1.17 Divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
1.18 Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
1.19 Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
1.20 間隔 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
1.21 Lifeline Activation and Destruction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
1.22 Participant creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
1.23 Incoming and outgoing messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
1.24 Stereotypes and Spots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
1.25 More information on titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
1.26 Participants encompass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
1.27 フッタの除去 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
1.28 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
2 ユースケース図
21
2.1
ユースケース . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
2.2
アクター
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
2.3
Usecases description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
2.4
Basic example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
2.5
Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
2.6
Using notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
2.7
Stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
2.8
Changing arrows direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
2.9
Title the diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
2.10 Splitting diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
2.11 Left to right direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
2.12 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
2.13 Complete example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
114 of 118
CONTENTS
CONTENTS
3 クラス図
29
3.1
クラス間の関係 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
3.2
関連のラベル . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
3.3
メソッドの追加 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
3.4
Defining visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
3.5
Abstract and Static
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
3.6
Advanced class body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
3.7
Notes and stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
3.8
More on notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
3.9
Note on links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
3.10 Abstract class and interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
3.11 Using non-letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
3.12 Hide attributes, methods... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
3.13 Hide classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
3.14 Use generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
3.15 Specific Spot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
3.16 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
3.17 Packages style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
3.18 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
3.19 Automatic namespace creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
3.20 Lollipop interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
3.21 Changing arrows direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
3.22 Title the diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
3.23 Legend the diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
3.24 Association classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
3.25 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
3.26 Skinned Stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
3.27 Color gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
49
3.28 Splitting large files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
4 アクティビティ図
51
4.1
単純なアクティビティ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
4.2
矢印のラベル . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
4.3
矢印の方向を変える . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
4.4
分岐 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
4.5
より多い分岐 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
4.6
同期 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
4.7
長いアクティビティの記述 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
4.8
Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
4.9
Partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
4.10 Title the diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
4.11 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
4.12 Octagon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
4.13 完全な例
58
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
115 of 118
CONTENTS
CONTENTS
5 アクティビティ図(ベータ版)
61
5.1
単純なアクティビティ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
5.2
開始/終了 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
5.3
条件文 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5.4
繰り返し(後判定) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
5.5
繰り返し(前判定) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
5.6
並列処理
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
5.7
注釈 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
5.8
タイトル&説明文 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
5.9
色指定 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
66
5.10 矢印 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
67
5.11 グループ化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
67
5.12 動線 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
68
5.13 分離 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
5.14 SDL 図 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
5.15 完全な例
71
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6 コンポーネント図
73
6.1
コンポーネント . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
6.2
インタフェース . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
6.3
Basic example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
6.4
Using notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74
6.5
Grouping Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74
6.6
Changing arrows direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.7
Title the diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
77
6.8
Use UML2 notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
77
6.9
Individual colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
77
6.10 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
7 ステート図
80
7.1
簡単なステート . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
7.2
複合状態
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
7.3
長い言葉
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
7.4
同時状態
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
82
7.5
矢印の方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
83
7.6
注釈 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
7.7
もっと注釈 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
7.8
見栄え . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
8 Object Diagram
87
8.1
Definition of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
8.2
Relations between objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
8.3
Adding fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
8.4
Common features with class diagrams . . . . . . . . . . . . . . . . . . . . . . . . . .
88
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
116 of 118
CONTENTS
CONTENTS
9 共通コマンド
89
9.1
フッターとヘッダー . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
89
9.2
Zoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
89
10 Salt
90
10.1 Basic widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
10.2 Using grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
10.3 Using separator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
10.4 Tree widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
10.5 Enclosing brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
10.6 Adding tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
10.7 Using menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
92
10.8 Advanced table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
93
11 Creole
94
11.1 Emphasized text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
11.2 List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
11.3 Escape character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
11.4 Horizontal lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
11.5 Headings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
11.6 Legacy HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
11.7 Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
96
11.8 Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
96
11.9 Special characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
96
11.10OpenIconic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
96
11.11Defining and using sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
11.12Encoding Sprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
11.13Importing Sprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
11.14Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
12 フォントや色の変更
100
12.1 使い方 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
12.2 Nested . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
12.3 Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
12.4 Font color, name and size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
12.5 Black and White . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
13 プリプロセッシング
13.1 ファイルのインクルード
106
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
13.2 Including URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
13.3 定数を定義する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
13.4 Macro definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
13.5 Macro on several lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
13.6 Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
13.7 Search path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
13.8 Advanced features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
117 of 118
CONTENTS
14 国際化
CONTENTS
111
14.1 キャラクターセット . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
15 色の名前
PlantUML : Language Reference Guide (2016 年 2 月 10 日)
113
118 of 118