Multilingual Wiki Documentation

You are currently using syntax.
In an attempt to improve PlantUML documentation...
Please do not use this website for your own diagrams.
You can click here and use the online server here for your own documentation.

Wiki Toc    View page history    Add new chapter    Reorder page    Raw


アクティビティ図(新構文)

Activity Diagram (new)

アクティビティ図の古い構文には、メンテナンスが難しいなど、いくつかの制限と欠点がありました。

そのため、現在では、完全に新規の構文と実装が提供されています。この新しい実装には、(シーケンス図と同様に)Graphvizパッケージのインストールを必要としないという利点もあります。

将来的に古い構文は新しい構文に置き換えられるでしょう。しかし、上位互換性が確保され、古い構文もそのまま認識可能となる予定です。

新しい構文へ移行することが強く推奨されています。

Old syntax for activity diagram had several limitations and drawbacks (for example, it's difficult to maintain).

So a completely new syntax and implementation is now available to users. Another advantage of this implementation is that it's done without the need of having Graphviz installed (as for sequence diagrams).

This syntax will replace the old legacy one. However, for compatibility reason, the old syntax will still be recognized, to ensure ascending compatibility.

Users are simply encouraged to migrate to the new syntax.

単純なアクティビティ

Simple action

アクティビティのラベルは:で開始し;で終了します。

テキストの書式設定は、Creole記法のWiki構文を使用して行うことができます。

それらは定義順に暗黙的にリンクされます。

@startuml
:Hello world;
:This is defined on
several **lines**;
@enduml

Activities label starts with : and ends with ;.

Text formatting can be done using creole wiki syntax.

They are implicitly linked in their definition order.

@startuml
:Hello world;
:This is defined on
several **lines**;
@enduml

開始/終了

Start/Stop/End

図の開始と終了を示すために、キーワードstartstopを使用できます。

@startuml
start
:Hello world;
:This is defined on
several **lines**;
stop
@enduml

キーワード end もまた使用できます。

@startuml
start
:Hello world;
:This is defined on
several **lines**;
end
@enduml

You can use start and stop keywords to denote the beginning and the end of a diagram.

@startuml
start
:Hello world;
:This is defined on
several **lines**;
stop
@enduml

You can also use the end keyword.

@startuml
start
:Hello world;
:This is defined on
several **lines**;
end
@enduml

条件文

Conditional

図に条件分岐を追加したい場合は、キーワードifthenそしてelseを使用することができます。ラベルは括弧を使用することで与えることができます。

3種類の構文を使うことができます。
  • if (...) then (...)

@startuml

start

if (Graphviz installed?) then (yes)
  :process all\ndiagrams;
else (no)
  :process only
  __sequence__ and __activity__ diagrams;
endif

stop

@enduml

  • if (...) is (...) then

@startuml
if (color?) is (<color:red>red) then
:print red;
else 
:print not red;
@enduml

  • if (...) equals (...) then

@startuml
if (counter?) equals (5) then
:print 5;
else 
:print not 5;
@enduml

[Ref. QA-301]

複数条件(水平モード)

いくつもの条件分岐がある場合には、キーワードelseifを使用できます。(デフォルトで水平モードになります):

@startuml
start
if (condition A) then (yes)
  :Text 1;
elseif (condition B) then (yes)
  :Text 2;
  stop
elseif (condition C) then (yes)
  :Text 3;
elseif (condition D) then (yes)
  :Text 4;
else (nothing)
  :Text else;
endif
stop
@enduml

複数条件(垂直モード)

!pragma useVerticalIf onコマンドを使用すると、垂直モードの分岐になります:

@startuml
!pragma useVerticalIf on
start
if (condition A) then (yes)
  :Text 1;
elseif (condition B) then (yes)
  :Text 2;
  stop
elseif (condition C) then (yes)
  :Text 3;
elseif (condition D) then (yes)
  :Text 4;
else (nothing)
  :Text else;
endif
stop
@enduml

コマンドラインオプション-Pを使用してpragmaを指定することもできます:

java -jar plantuml.jar -PuseVerticalIf=on

[Refs. QA-3931, issue-582]

You can use if, then and else keywords to put tests in your diagram. Labels can be provided using parentheses.

The 3 syntaxes are possible:
  • if (...) then (...)

@startuml

start

if (Graphviz installed?) then (yes)
  :process all\ndiagrams;
else (no)
  :process only
  __sequence__ and __activity__ diagrams;
endif

stop

@enduml

  • if (...) is (...) then

@startuml
if (color?) is (<color:red>red) then
:print red;
else 
:print not red;
@enduml

  • if (...) equals (...) then

@startuml
if (counter?) equals (5) then
:print 5;
else 
:print not 5;
@enduml

[Ref. QA-301]

Several tests (horizontal mode)

You can use the elseif keyword to have several tests (by default, it is the horizontal mode):

@startuml
start
if (condition A) then (yes)
  :Text 1;
elseif (condition B) then (yes)
  :Text 2;
  stop
elseif (condition C) then (yes)
  :Text 3;
elseif (condition D) then (yes)
  :Text 4;
else (nothing)
  :Text else;
endif
stop
@enduml

Several tests (vertical mode)

You can use the command !pragma useVerticalIf on to have the tests in vertical mode:

@startuml
!pragma useVerticalIf on
start
if (condition A) then (yes)
  :Text 1;
elseif (condition B) then (yes)
  :Text 2;
  stop
elseif (condition C) then (yes)
  :Text 3;
elseif (condition D) then (yes)
  :Text 4;
else (nothing)
  :Text else;
endif
stop
@enduml

You can use the -P command-line option to specify the pragma:

java -jar plantuml.jar -PuseVerticalIf=on

[Refs. QA-3931, issue-582]

switch、case [switch, case, endswitch]

Switch and case [switch, case, endswitch]

switchcaseendswitchを使用して条件分岐を行うこともできます。

ラベルは括弧を使用することで与えることができます。

@startuml
start
switch (test?)
case ( condition A )
  :Text 1;
case ( condition B ) 
  :Text 2;
case ( condition C )
  :Text 3;
case ( condition D )
  :Text 4;
case ( condition E )
  :Text 5;
endswitch
stop
@enduml

You can use switch, case and endswitch keywords to put switch in your diagram.

Labels can be provided using parentheses.

@startuml
start
switch (test?)
case ( condition A )
  :Text 1;
case ( condition B ) 
  :Text 2;
case ( condition C )
  :Text 3;
case ( condition D )
  :Text 4;
case ( condition E )
  :Text 5;
endswitch
stop
@enduml

アクションの停止を伴う条件文 [kill, detach]

Conditional with stop on an action [kill, detach]

if 節内でアクションを停止できます。

@startuml
if (condition?) then
  :error;
  stop
endif
#palegreen:action;
@enduml

ただし、明確なアクションで停止したい場合は、キーワード「kill」または「detach」を使用できます:

  • kill

@startuml
if (condition?) then
  #pink:error;
  kill
endif
#palegreen:action;
@enduml

[Ref. QA-265]

  • detach

@startuml
if (condition?) then
  #pink:error;
  detach
endif
#palegreen:action;
@enduml

You can stop action on a if loop.

@startuml
if (condition?) then
  :error;
  stop
endif
#palegreen:action;
@enduml

But if you want to stop at the precise action, you can use the kill or detach keyword:

  • kill

@startuml
if (condition?) then
  #pink:error;
  kill
endif
#palegreen:action;
@enduml

[Ref. QA-265]

  • detach

@startuml
if (condition?) then
  #pink:error;
  detach
endif
#palegreen:action;
@enduml

繰り返し(後判定)

Repeat loop

繰り返し処理(後判定)がある場合には、キーワードrepeatrepeat whileを使用できます。

@startuml

start

repeat
  :read data;
  :generate diagrams;
repeat while (more data?)

stop

@enduml

アクティビティをrepeatの戻り先にすることもできます。また、backwardキーワードを使用して、戻りのパスにアクティビティを挿入することもできます。

@startuml

start

repeat :foo as starting label;
  :read data;
  :generate diagrams;
backward:This is backward;
repeat while (more data?)

stop

@enduml

You can use repeat and repeatwhile keywords to have repeat loops.

@startuml

start

repeat
  :read data;
  :generate diagrams;
repeat while (more data?) is (yes)
->no;
stop

@enduml

It is also possible to use a full action as repeat target and insert an action in the return path using the backward keyword.

@startuml

start

repeat :foo as starting label;
  :read data;
  :generate diagrams;
backward:This is backward;
repeat while (more data?)

stop

@enduml

repeat 節を中断する [break]

Break on a repeat loop [break]

アクションの後でbreakキーワードを使うと、ループを中断することができます。

@startuml
start
repeat
  :Test something;
    if (Something went wrong?) then (no)
      #palegreen:OK;
      break
    endif
    ->NOK;
    :Alert "Error with long text";
repeat while (Something went wrong with long text?) is (yes) not (no)
->//merged step//;
:Alert "Success";
stop
@enduml

[Ref. QA-6105]

You can use the break keyword after an action on a loop.

@startuml
start
repeat
  :Test something;
    if (Something went wrong?) then (no)
      #palegreen:OK;
      break
    endif
    ->NOK;
    :Alert "Error with long text";
repeat while (Something went wrong with long text?) is (yes) not (no)
->//merged step//;
:Alert "Success";
stop
@enduml

[Ref. QA-6105]

繰り返し(前判定)

While loop

繰り返し処理(前判定)がある場合には、キーワードwhileend whileを使用できます。

@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

You can use while and end while keywords to have repeat loops.

@startuml

start

while (data available?)
  :read data;
  :generate diagrams;
endwhile

stop

@enduml

It is possible to provide a label after the endwhile keyword, or using the is keyword.

@startuml
while (check filesize ?) is (not empty)
  :read file;
endwhile (empty)
:close file;
@enduml

並列処理

Parallel processing [fork, fork again, end fork, end merge]

キーワードforkfork againそしてend forkまたはend mergeを使用して、並列処理を記述することができます。

単純なfork

@startuml
start
fork
  :action 1;
fork again
  :action 2;
end fork
stop
@enduml

end mergeを使ったfork

@startuml
start
fork
  :action 1;
fork again
  :action 2;
end merge
stop
@enduml

[Ref. QA-5320]

@startuml
start
fork
  :action 1;
fork again
  :action 2;
fork again
  :action 3;
fork again
  :action 4;
end merge
stop
@enduml

@startuml
start
fork
  :action 1;
fork again
  :action 2;
  end
end merge
stop
@enduml

[Ref. QA-13731]

end forkのラベル、またはjoin仕様(UML joinspec):

@startuml
start
fork
  :action A;
fork again
  :action B;
end fork {or}
stop
@enduml

@startuml
start
fork
  :action A;
fork again
  :action B;
end fork {and}
stop
@enduml

[Ref. QA-5346]

その他の例

@startuml

start

if (multiprocessor?) then (yes)
  fork
    :Treatment 1;
  fork again
    :Treatment 2;
  end fork
else (monoproc)
  :Treatment 1;
  :Treatment 2;
endif

@enduml

You can use fork, fork again and end fork or end merge keywords to denote parallel processing.

Simple fork

@startuml
start
fork
  :action 1;
fork again
  :action 2;
end fork
stop
@enduml

fork with end merge

@startuml
start
fork
  :action 1;
fork again
  :action 2;
end merge
stop
@enduml

[Ref. QA-5320]

@startuml
start
fork
  :action 1;
fork again
  :action 2;
fork again
  :action 3;
fork again
  :action 4;
end merge
stop
@enduml

@startuml
start
fork
  :action 1;
fork again
  :action 2;
  end
end merge
stop
@enduml

[Ref. QA-13731]

Label on end fork (or UML joinspec):

@startuml
start
fork
  :action A;
fork again
  :action B;
end fork {or}
stop
@enduml

@startuml
start
fork
  :action A;
fork again
  :action B;
end fork {and}
stop
@enduml

[Ref. QA-5346]

Other example

@startuml

start

if (multiprocessor?) then (yes)
  fork
    :Treatment 1;
  fork again
    :Treatment 2;
  end fork
else (monoproc)
  :Treatment 1;
  :Treatment 2;
endif

@enduml

処理の分岐

Split processing

Split

splitsplit againend splitキーワードを使って、プロセスの分岐を表すことができます。

@startuml
start
split
   :A;
split again
   :B;
split again
   :C;
split again
   :a;
   :b;
end split
:D;
end
@enduml

入力の分岐(複数開始)

入力の分岐を表現するには、hiddenで矢印を隠します。

@startuml
split
   -[hidden]->
   :A;
split again
   -[hidden]->
   :B;
split again
   -[hidden]->
   :C;
end split
:D;
@enduml

@startuml
split
   -[hidden]->
   :A;
split again
   -[hidden]->
   :a;
   :b;
split again
   -[hidden]->
   (Z)
end split
:D;
@enduml

[Ref. QA-8662]

出力の分岐(複数終了)

出力の分岐を表現するには、killまたはdetachを使用します。

@startuml
start
split
   :A;
   kill
split again
   :B;
   detach
split again
   :C;
   kill
end split
@enduml

@startuml
start
split
   :A;
   kill
split again
   :b;
   :c;
   detach
split again
   (Z)
   detach
split again
   end
split again
   stop
end split
@enduml

Split

You can use split, split again and end split keywords to denote split processing.

@startuml
start
split
   :A;
split again
   :B;
split again
   :C;
split again
   :a;
   :b;
end split
:D;
end
@enduml

Input split (multi-start)

You can use hidden arrows to make an input split (multi-start):

@startuml
split
   -[hidden]->
   :A;
split again
   -[hidden]->
   :B;
split again
   -[hidden]->
   :C;
end split
:D;
@enduml

@startuml
split
   -[hidden]->
   :A;
split again
   -[hidden]->
   :a;
   :b;
split again
   -[hidden]->
   (Z)
end split
:D;
@enduml

[Ref. QA-8662]

Output split (multi-end)

You can use kill or detach to make an output split (multi-end):

@startuml
start
split
   :A;
   kill
split again
   :B;
   detach
split again
   :C;
   kill
end split
@enduml

@startuml
start
split
   :A;
   kill
split again
   :b;
   :c;
   detach
split again
   (Z)
   detach
split again
   end
split again
   stop
end split
@enduml

注釈

Notes

Creole表記のWiki構文を使用することで、テキストの書式設定ができます。

キーワード floating を使用し、注釈を遊離させることもできます。

@startuml

start
:foo1;
floating 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

戻り方向(backward)のアクティビティに注釈をつけることもできます。

@startuml
start
repeat :Enter data;
:Submit;
backward :Warning;
note right: Note
repeat while (Valid?) is (No) not (Yes)
stop
@enduml

パーティションにノートを追加することもできます。

@startuml
start
partition "**process** HelloWorld" {
    note
        This is my note
        ----
        //Creole test//
    end note
    :Ready;
    :HelloWorld(i)>
    :Hello-Sent;
}
@enduml

[Ref. QA-2398]

Text formatting can be done using creole wiki syntax.

A note can be floating, using floating keyword.

@startuml

start
:foo1;
floating 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

You can add note on backward activity:

@startuml
start
repeat :Enter data;
:Submit;
backward :Warning;
note right: Note
repeat while (Valid?) is (No) not (Yes)
stop
@enduml

[Ref. QA-11788]

You can add note on partition activity:

@startuml
start
partition "**process** HelloWorld" {
    note
        This is my note
        ----
        //Creole test//
    end note
    :Ready;
    :HelloWorld(i)>
    :Hello-Sent;
}
@enduml

[Ref. QA-2398]

色指定

Colors

各アクティビティに、色を指定することができます。

@startuml

start
:starting progress;
#HotPink:reading configuration files
These files should edited at this point!;
#AAAAAA:ending of the process;

@enduml

グラデーションを使用することもできます。

@startuml
start
partition #red/white testPartition {
        #blue\green:testActivity;
}
@enduml

[Ref. QA-4906]

You can specify a color for some activities.

@startuml

start
:starting progress;
#HotPink:reading configuration files
These files should be edited at this point!;
#AAAAAA:ending of the process;

@enduml

You can also use gradient color.

@startuml
start
partition #red/white testPartition {
        #blue\green:testActivity;
}
@enduml

[Ref. QA-4906]

矢印無しの線

Lines without arrows

skinparam ArrowHeadColor noneを指定すると、アクティビティの接続線を矢印無しにすることができます。

@startuml
skinparam ArrowHeadColor none
start
:Hello world;
:This is on defined on
several **lines**;
stop
@enduml

@startuml
skinparam ArrowHeadColor none
start
repeat :Enter data;
:Submit;
backward :Warning;
repeat while (Valid?) is (No) not (Yes)
stop
@enduml

You can use skinparam ArrowHeadColor none in order to connect activities using lines only, without arrows.

@startuml
skinparam ArrowHeadColor none
start
:Hello world;
:This is on defined on
several **lines**;
stop
@enduml

@startuml
skinparam ArrowHeadColor none
start
repeat :Enter data;
:Submit;
backward :Warning;
repeat while (Valid?) is (No) not (Yes)
stop
@enduml

矢印

Arrows

記号->を用いて、矢印にテキストを添えることができ、また、色を変えることもできます。

点線、破線、太線、または、矢印なし、もまた可能です。

@startuml
:foo1;
-> You can put text on arrows;
if (test) then
  -[#blue]->
  :foo2;
  -[#green,dashed]-> The text can
  also be on several lines
  and **very** long...;
  :foo3;
else
  -[#black,dotted]->
  :foo4;
endif
-[#gray,bold]->
:foo5;
@enduml

Using the -> notation, you can add texts to arrow, and change their color.

It's also possible to have dotted, dashed, bold or hidden arrows.

@startuml
:foo1;
-> You can put text on arrows;
if (test) then
  -[#blue]->
  :foo2;
  -[#green,dashed]-> The text can
  also be on several lines
  and **very** long...;
  :foo3;
else
  -[#black,dotted]->
  :foo4;
endif
-[#gray,bold]->
:foo5;
@enduml

コネクタ

Connector

半角括弧を使用して、コネクタを記述することができます。

@startuml
start
:Some activity;
(A)
detach
(A)
:Other activity;
@enduml

You can use parentheses to denote connector.

@startuml
start
:Some activity;
(A)
detach
(A)
:Other activity;
@enduml

コネクタの色

Color on connector

コネクタにを設定することができます。

@startuml
start
:The connector below
wishes he was blue;
#blue:(B)
:This next connector
feels that she would
be better off green;
#green:(G)
stop
@enduml

[Ref. QA-10077]

You can add color on connector.

@startuml
start
:The connector below
wishes he was blue;
#blue:(B)
:This next connector
feels that she would
be better off green;
#green:(G)
stop
@enduml

[Ref. QA-10077]

グループ化(パーティション)

Grouping or partition

グループ

グループを定義して複数のアクティビティをまとめることができます:

@startuml
start
group Initialization 
    :read config file;
    :init internal variable;
end group
group Running group
    :wait for user interaction;
    :print information;
end group

stop
@enduml

パーティション

パーティションを定義して複数のアクティビティをまとめることができます:

@startuml
start
partition Initialization {
    :read config file;
    :init internal variable;
}
partition Running {
    :wait for user interaction;
    :print information;
}

stop
@enduml

パーティションのを変更することができます:

@startuml
start
partition #lightGreen "Input Interface" {
    :read config file;
    :init internal variable;
}
partition Running {
    :wait for user interaction;
    :print information;
}
stop
@enduml

[Ref. QA-2793]

パーティションにリンクを追加することもできます:

@startuml
start
partition "[[http://plantuml.com partition_name]]" {
    :read doc. on [[http://plantuml.com plantuml_website]];
    :test diagram;
}
end
@enduml

[Ref. QA-542]

グループ、パーティション、パッケージ、四角形、カード

  • グループ(group)、
  • パーティション(partition)、
  • パッケージ(package)、
  • 四角形(rectangle)、
  • カード(card)
を定義して複数のアクティビティをまとめることができます:

@startuml
start
group Group
  :Activity;
end group
floating note: Note on Group

partition Partition {
  :Activity;
}
floating note: Note on Partition

package Package {
  :Activity;
}
floating note: Note on Package 

rectangle Rectangle {
  :Activity;
}
floating note: Note on Rectangle 

card Card {
  :Activity;
}
floating note: Note on Card
end
@enduml

Group

You can group activity together by defining group:

@startuml
start
group Initialization 
    :read config file;
    :init internal variable;
end group
group Running group
    :wait for user interaction;
    :print information;
end group

stop
@enduml

Partition

You can group activity together by defining partition:

@startuml
start
partition Initialization {
    :read config file;
    :init internal variable;
}
partition Running {
    :wait for user interaction;
    :print information;
}

stop
@enduml

It's also possible to change partition color:

@startuml
start
partition #lightGreen "Input Interface" {
    :read config file;
    :init internal variable;
}
partition Running {
    :wait for user interaction;
    :print information;
}
stop
@enduml

[Ref. QA-2793]

It's also possible to add link to partition:

@startuml
start
partition "[[http://plantuml.com partition_name]]" {
    :read doc. on [[http://plantuml.com plantuml_website]];
    :test diagram;
}
end
@enduml

[Ref. QA-542]

Group, Partition, Package, Rectangle or Card

You can group activity together by defining:
  • group;
  • partition;
  • package;
  • rectangle;
  • card.

@startuml
start
group Group
  :Activity;
end group
floating note: Note on Group

partition Partition {
  :Activity;
}
floating note: Note on Partition

package Package {
  :Activity;
}
floating note: Note on Package 

rectangle Rectangle {
  :Activity;
}
floating note: Note on Rectangle 

card Card {
  :Activity;
}
floating note: Note on Card
end
@enduml

スイムレーン

Swimlanes

パイプ記号|を用いて、複数のスイムレーンを定義することができます。

さらに、スイムレーン毎にを変えることができます。

@startuml
|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml

スイムレーンの中で、if条件文やrepeatwhileのループを使用できます。

@startuml
|#pink|Actor_For_red|
start
if (color?) is (red) then
#pink:**action red**;
:foo1;
else (not red)
|#lightgray|Actor_For_no_red|
#lightgray:**action not red**;
:foo2;
endif
|Next_Actor|
#lightblue:foo3;
:foo4;
|Final_Actor|
#palegreen:foo5;
stop
@enduml

次の構文で、スイムレーンに別名(alias)を付けることができます。
  • |[#<color>|]<swimlane_alias>| <swimlane_title>

@startuml
|#palegreen|f| fisherman
|c| cook
|#gold|e| eater
|f|
start
:go fish;
|c|
:fry fish;
|e|
:eat fish;
stop
@enduml

[Ref. QA-2681]

Using pipe |, you can define swimlanes.

It's also possible to change swimlanes color.

@startuml
|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml

You can add if conditional or repeat or while loop within swimlanes.

@startuml
|#pink|Actor_For_red|
start
if (color?) is (red) then
#pink:**action red**;
:foo1;
else (not red)
|#lightgray|Actor_For_no_red|
#lightgray:**action not red**;
:foo2;
endif
|Next_Actor|
#lightblue:foo3;
:foo4;
|Final_Actor|
#palegreen:foo5;
stop
@enduml

You can also use alias with swimlanes, with this syntax:
  • |[#<color>|]<swimlane_alias>| <swimlane_title>

@startuml
|#palegreen|f| fisherman
|c| cook
|#gold|e| eater
|f|
start
:go fish;
|c|
:fry fish;
|e|
:eat fish;
stop
@enduml

[Ref. QA-2681]

矢印の除去(detach, kill)

Detach or kill [detach, kill]

キーワードdetachまたはkillを使用して、矢印を取り除くことができます。

@startuml
 :start;
 fork
   :foo1;
   :foo2;
 fork again
   :foo3;
   detach
 endfork
 if (foo4) then
   :foo5;
   detach
 endif
 :foo6;
 detach
 :foo7;
 stop
@enduml

  • kill

@startuml
 :start;
 fork
   :foo1;
   :foo2;
 fork again
   :foo3;
   kill
 endfork
 if (foo4) then
   :foo5;
   kill
 endif
 :foo6;
 kill
 :foo7;
 stop
@enduml

It's possible to remove an arrow using the detach or kill keyword:

  • detach

@startuml
 :start;
 fork
   :foo1;
   :foo2;
 fork again
   :foo3;
   detach
 endfork
 if (foo4) then
   :foo5;
   detach
 endif
 :foo6;
 detach
 :foo7;
 stop
@enduml

  • kill

@startuml
 :start;
 fork
   :foo1;
   :foo2;
 fork again
   :foo3;
   kill
 endfork
 if (foo4) then
   :foo5;
   kill
 endif
 :foo6;
 kill
 :foo7;
 stop
@enduml

SDL図

SDL (Specification and Description Language)

終端記号;を置き換えることで、アクティビティの表現形式を変えることができます:
  • |
  • <
  • >
  • /
  • \\
  • ]
  • }

@startuml
:Ready;
:next(o)|
:Receiving;
split
 :nak(i)<
 :ack(o)>
split again
 :ack(i)<
 :next(o)
 on several lines|
 :i := i + 1]
 :ack(o)>
split again
 :err(i)<
 :nak(o)>
split again
 :foo/
split again
 :bar\\
split again
 :i > 5}
stop
end split
:finish;
@enduml

By changing the final ; separator, you can set different rendering for the activity:
  • |
  • <
  • >
  • /
  • \\
  • ]
  • }

@startuml
:Ready;
:next(o)|
:Receiving;
split
 :nak(i)<
 :ack(o)>
split again
 :ack(i)<
 :next(o)
 on several lines|
 :i := i + 1]
 :ack(o)>
split again
 :err(i)<
 :nak(o)>
split again
 :foo/
split again
 :bar\\
split again
 :i > 5}
stop
end split
:finish;
@enduml

完全な例

Complete example

@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();
    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

@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();
    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

条件のスタイル

Condition Style

insideスタイル(デフォルト)

@startuml
skinparam conditionStyle inside
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

@startuml
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

diamondスタイル

@startuml
skinparam conditionStyle diamond
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

InsideDiamond (またはfoo1)スタイル

@startuml
skinparam conditionStyle InsideDiamond
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

@startuml
skinparam conditionStyle foo1
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

[Ref. QA-1290 and #400]

Inside style (by default)

@startuml
skinparam conditionStyle inside
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

@startuml
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

Diamond style

@startuml
skinparam conditionStyle diamond
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

InsideDiamond (or Foo1) style

@startuml
skinparam conditionStyle InsideDiamond
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

@startuml
skinparam conditionStyle foo1
start
repeat
  :act1;
  :act2;
repeatwhile (<b>end)
:act3;
@enduml

[Ref. QA-1290 and #400]

条件終了のスタイル

Condition End Style

diamondスタイル(デフォルト)

  • 分岐が1つの場合

@startuml
skinparam ConditionEndStyle diamond
:A;
if (decision) then (yes)
    :B1;
else (no)
endif
:C;
@enduml

  • 分岐が2つ(B1, B2)の場合

@startuml
skinparam ConditionEndStyle diamond
:A;
if (decision) then (yes)
    :B1;
else (no)
    :B2;
endif
:C;
@enduml
@enduml

水平ライン(hline)スタイル

  • 分岐が1つの場合

@startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
    :B1;
else (no)
endif
:C;
@enduml

  • 分岐が2つ(B1, B2)の場合

@startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
    :B1;
else (no)
    :B2;
endif
:C;
@enduml
@enduml

[Ref. QA-4015]

Diamond style (by default)

  • With one branch

@startuml
skinparam ConditionEndStyle diamond
:A;
if (decision) then (yes)
    :B1;
else (no)
endif
:C;
@enduml

  • With two branches (B1, B2)

@startuml
skinparam ConditionEndStyle diamond
:A;
if (decision) then (yes)
    :B1;
else (no)
    :B2;
endif
:C;
@enduml
@enduml

Horizontal line (hline) style

  • With one branch

@startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
    :B1;
else (no)
endif
:C;
@enduml

  • With two branches (B1, B2)

@startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
    :B1;
else (no)
    :B2;
endif
:C;
@enduml
@enduml

[Ref. QA-4015]

グローバル(global)スタイルの使用

Using (global) style

スタイル無し(デフォルト)

@startuml
start
:init;
-> test of color;
if (color?) is (<color:red>red) then
:print red;
else 
:print not red;
note right: no color
endif
partition End {
:end;
}
-> this is the end;
end
@enduml

スタイル有り

スタイルを指定して要素の見た目を変更することができます。

@startuml
<style>
activityDiagram {
  BackgroundColor #33668E
  BorderColor #33668E
  FontColor #888
  FontName arial

  diamond {
    BackgroundColor #ccf
    LineColor #00FF00
    FontColor green
    FontName arial
    FontSize 15
  }
  arrow {
    FontColor gold
    FontName arial
    FontSize 15
  }
  partition {
    LineColor red
    FontColor green
    RoundCorner 10
    BackgroundColor PeachPuff
  }
  note {
    FontColor Blue
    LineColor Navy
    BackgroundColor #ccf
  }
}
document {
   BackgroundColor transparent
}
</style>
start
:init;
-> test of color;
if (color?) is (<color:red>red) then
:print red;
else 
:print not red;
note right: no color
endif
partition End {
:end;
}
-> this is the end;
end
@enduml

Without style (by default)

@startuml
start
:init;
-> test of color;
if (color?) is (<color:red>red) then
:print red;
else 
:print not red;
note right: no color
endif
partition End {
:end;
}
-> this is the end;
end
@enduml

With style

You can use style to change rendering of elements.

@startuml
<style>
activityDiagram {
  BackgroundColor #33668E
  BorderColor #33668E
  FontColor #888
  FontName arial

  diamond {
    BackgroundColor #ccf
    LineColor #00FF00
    FontColor green
    FontName arial
    FontSize 15
  }
  arrow {
    FontColor gold
    FontName arial
    FontSize 15
  }
  partition {
    LineColor red
    FontColor green
    RoundCorner 10
    BackgroundColor PeachPuff
  }
  note {
    FontColor Blue
    LineColor Navy
    BackgroundColor #ccf
  }
}
document {
   BackgroundColor transparent
}
</style>
start
:init;
-> test of color;
if (color?) is (<color:red>red) then
:print red;
else 
:print not red;
note right: no color
endif
partition End {
:end;
}
-> this is the end;
end
@enduml


Please report any bugs to plantuml@gmail.com or here.
This website is still in beta testing.