アクティビティ図に使用されていた以前の構文には、いくつかの制限や保守性の問題がありました。 新しい構文の利点- Graphvizに依存しない:* シーケンス図と同様に、新しい構文ではGraphvizをインストールする必要がないため、セットアッププロセスが簡素化されます。
- メンテナンスの容易さ:
新シンタックスへの移行 互換性を維持するため、旧シンタックスも引き続きサポートしますが、強化された機能と利点を活用するために、新シンタックスに移行することを強くお勧めします。 - 今すぐ移行して、新しいアクティビティ図のシンタックスで、より合理的で効率的なダイアグラム作成プロセスを体験してください 。
アクティビティのラベルは: で開始し; で終了します。 テキストの書式設定は、Creole記法のWiki構文を使用して行うことができます。 それらは定義順に暗黙的にリンクされます。 🎉 Copied! 
 | @startuml
:Hello world;
:This is defined on
several **lines**;
@enduml
|
図の開始と終了を示すために、キーワードstart とstop を使用できます。 🎉 Copied! 
 | @startuml
start
:Hello world;
:This is defined on
several **lines**;
stop
@enduml
| キーワード end もまた使用できます。 🎉 Copied! 
 | @startuml
start
:Hello world;
:This is defined on
several **lines**;
end
@enduml
|
図に条件分岐を追加したい場合は、キーワードif 、then そしてelse を使用することができます。ラベルは括弧を使用することで与えることができます。 3種類の構文を使うことができます。 🎉 Copied! 
 | @startuml
start
if (Graphviz installed?) then (yes)
:process all\ndiagrams;
else (no)
:process only
__sequence__ and __activity__ diagrams;
endif
stop
@enduml
|
🎉 Copied! 
 | @startuml
if (color?) is (<color:red>red) then
:print red;
else
:print not red;
@enduml
|
if (...) equals (...) then
🎉 Copied! 
 | @startuml
if (counter?) equals (5) then
:print 5;
else
:print not 5;
@enduml
| [Ref. QA-301]複数条件(水平モード) いくつもの条件分岐がある場合には、キーワードelseif を使用できます。(デフォルトで水平モードになります): 🎉 Copied! 
 | @startuml
start
if (condition A) then (yes)
:Text 1;
elseif (condition B) then (yes)
:Text 2;
stop
(no) elseif (condition C) then (yes)
:Text 3;
(no) elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif
stop
@enduml
|
複数条件(垂直モード)!pragma useVerticalIf on コマンドを使用すると、垂直モードの分岐になります: 🎉 Copied! 
 | @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]switch ,case ,endswitch キーワードを使って、図の中にスイッチを入れることができます。 ラベルは括弧を使って提供できます。 🎉 Copied! 
 | @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
|
if 節内でアクションを停止できます。 🎉 Copied! 
 | @startuml
if (condition?) then
:error;
stop
endif
#palegreen:action;
@enduml
| ただし、明確なアクションで停止したい場合は、キーワード「kill」または「detach」を使用できます: 🎉 Copied! 
 | @startuml
if (condition?) then
#pink:error;
kill
endif
#palegreen:action;
@enduml
| [Ref. QA-265] 🎉 Copied! 
 | @startuml
if (condition?) then
#pink:error;
detach
endif
#palegreen:action;
@enduml
|
繰り返し処理(後判定)がある場合には、キーワードrepeat とrepeat while を使用できます。 🎉 Copied! 
 | @startuml
start
repeat
:read data;
:generate diagrams;
repeat while (more data?)
stop
@enduml
| アクティビティをrepeat の戻り先にすることもできます。また、backward キーワードを使用して、戻りのパスにアクティビティを挿入することもできます。 🎉 Copied! 
 | @startuml
start
repeat :foo as starting label;
:read data;
:generate diagrams;
backward:This is backward;
repeat while (more data?)
stop
@enduml
| [Ref. QA-5826]WARNING This translation need to be updated. WARNING アクションの後でbreak キーワードを使うと、ループを中断することができます。 🎉 Copied! 
 | @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] ⚠ It is currently only experimental 🚧 You can use label and goto keywords to denote goto processing, with: label <label_name> goto <label_name>
🎉 Copied! 
 | @startuml
title Point two queries to same activity\nwith `goto`
start
if (Test Question?) then (yes)
'space label only for alignment
label sp_lab0
label sp_lab1
'real label
label lab
:shared;
else (no)
if (Second Test Question?) then (yes)
label sp_lab2
goto sp_lab1
else
:nonShared;
endif
endif
:merge;
@enduml
| [Ref. QA-15026, QA-12526 and initially QA-1626] 繰り返し処理(前判定)がある場合には、キーワードwhile とendwhile を使用できます。 🎉 Copied! 
 | @startuml
start
while (data available?)
:read data;
:generate diagrams;
endwhile
stop
@enduml
| キーワードendwhile の後ろ、または、 キーワードis を使用することで、ラベルを与えることができます。 🎉 Copied! 
 | @startuml
while (check filesize ?) is (not empty)
:read file;
endwhile (empty)
:close file;
@enduml
|
detach を使用して無限ループを作る場合は、-[hidden]-> を使用して不要な矢印を隠すと良いでしょう。 🎉 Copied! 
 | @startuml
:Step 1;
if (condition1) then
while (loop forever)
:Step 2;
endwhile
-[hidden]->
detach
else
:end normally;
stop
endif
@enduml
|
WARNING This translation need to be updated. WARNING キーワードfork 、fork again そしてend fork またはend merge を使用して、並列処理を記述することができます。 単純なfork 🎉 Copied! 
 | @startuml
start
fork
:action 1;
fork again
:action 2;
end fork
stop
@enduml
|
end merge を使ったfork
🎉 Copied! 
 | @startuml
start
fork
:action 1;
fork again
:action 2;
end merge
stop
@enduml
|
[Ref. QA-5320] 🎉 Copied! 
 | @startuml
start
fork
:action 1;
fork again
:action 2;
fork again
:action 3;
fork again
:action 4;
end merge
stop
@enduml
|
🎉 Copied! 
 | @startuml
start
fork
:action 1;
fork again
:action 2;
end
end merge
stop
@enduml
| [Ref. QA-13731]end fork のラベル、またはjoin仕様(UML joinspec):
🎉 Copied! 
 | @startuml
start
fork
:action A;
fork again
:action B;
end fork {or}
stop
@enduml
|
🎉 Copied! 
 | @startuml
start
fork
:action A;
fork again
:action B;
end fork {and}
stop
@enduml
| [Ref. QA-5346]その他の例 🎉 Copied! 
 | @startuml
start
if (multiprocessor?) then (yes)
fork
:Treatment 1;
fork again
:Treatment 2;
end fork
else (monoproc)
:Treatment 1;
:Treatment 2;
endif
@enduml
|
Splitsplit 、split again 、end split キーワードを使って、プロセスの分岐を表すことができます。 🎉 Copied! 
 | @startuml
start
split
:A;
split again
:B;
split again
:C;
split again
:a;
:b;
end split
:D;
end
@enduml
|
入力の分岐(複数開始) 入力の分岐を表現するには、hidden で矢印を隠します。 🎉 Copied! 
 | @startuml
split
-[hidden]->
:A;
split again
-[hidden]->
:B;
split again
-[hidden]->
:C;
end split
:D;
@enduml
|
🎉 Copied! 
 | @startuml
split
-[hidden]->
:A;
split again
-[hidden]->
:a;
:b;
split again
-[hidden]->
(Z)
end split
:D;
@enduml
|
[Ref. QA-8662] 出力の分岐(複数終了) 出力の分岐を表現するには、kill またはdetach を使用します。 🎉 Copied! 
 | @startuml
start
split
:A;
kill
split again
:B;
detach
split again
:C;
kill
end split
@enduml
|
🎉 Copied! 
 | @startuml
start
split
:A;
kill
split again
:b;
:c;
detach
split again
(Z)
detach
split again
end
split again
stop
end split
@enduml
|
Creole表記のWiki構文を使用することで、テキストの書式設定ができます。 キーワード floating を使用し、注釈を遊離させることもできます。 🎉 Copied! 
 | @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)のアクティビティに注釈をつけることもできます。 🎉 Copied! 
 | @startuml
start
repeat :Enter data;
:Submit;
backward :Warning;
note right: Note
repeat while (Valid?) is (No) not (Yes)
stop
@enduml
| パーティションにノートを追加することもできます。 🎉 Copied! 
 | @startuml
start
partition "**process** HelloWorld" {
note
This is my note
----
//Creole test//
end note
:Ready;
:HelloWorld(i)>
:Hello-Sent;
}
@enduml
|
[Ref. QA-2398] 各アクティビティに、色を指定することができます。 🎉 Copied! 
 | @startuml
start
:starting progress;
#HotPink:reading configuration files
These files should edited at this point!;
#AAAAAA:ending of the process;
@enduml
| グラデーションを使用することもできます。 🎉 Copied! 
 | @startuml
start
partition #red/white testPartition {
#blue\green:testActivity;
}
@enduml
|
[Ref. QA-4906] skinparam ArrowHeadColor none を指定すると、アクティビティの接続線を矢印無しにすることができます。 🎉 Copied! 
 | @startuml
skinparam ArrowHeadColor none
start
:Hello world;
:This is on defined on
several **lines**;
stop
@enduml
|
🎉 Copied! 
 | @startuml
skinparam ArrowHeadColor none
start
repeat :Enter data;
:Submit;
backward :Warning;
repeat while (Valid?) is (No) not (Yes)
stop
@enduml
|
記号-> を用いて、矢印にテキストを添えることができ、また、色を変えることもできます。 点線、破線、太線、または、矢印なし、もまた可能です。 🎉 Copied! 
 | @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
| 半角括弧を使用して、コネクタを記述することができます。 🎉 Copied! 
 | @startuml
start
:Some activity;
(A)
detach
(A)
:Other activity;
@enduml
|
コネクタに色を設定することができます。 🎉 Copied! 
 | @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]グループ グループを定義して複数のアクティビティをまとめることができます: 🎉 Copied! 
 | @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
|
パーティション パーティションを定義して複数のアクティビティをまとめることができます: 🎉 Copied! 
 | @startuml
start
partition Initialization {
:read config file;
:init internal variable;
}
partition Running {
:wait for user interaction;
:print information;
}
stop
@enduml
| パーティションの色を変更することができます: 🎉 Copied! 
 | @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] パーティションにリンクを追加することもできます: 🎉 Copied! 
 | @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)
を定義して複数のアクティビティをまとめることができます: 🎉 Copied! 
 | @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
|
パイプ記号| を用いて、複数のスイムレーンを定義することができます。 さらに、スイムレーン毎に色を変えることができます。 🎉 Copied! 
 | @startuml
|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml
| スイムレーンの中で、if 条件文やrepeat 、while のループを使用できます。 🎉 Copied! 
 | @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>
🎉 Copied! 
 | @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 を使用して、矢印を取り除くことができます。 🎉 Copied! 
 | @startuml
:start;
fork
:foo1;
:foo2;
fork again
:foo3;
detach
endfork
if (foo4) then
:foo5;
detach
endif
:foo6;
detach
:foo7;
stop
@enduml
|
🎉 Copied! 
 | @startuml
:start;
fork
:foo1;
:foo2;
fork again
:foo3;
kill
endfork
if (foo4) then
:foo5;
kill
endif
:foo6;
kill
:foo7;
stop
@enduml
|
終端記号; を置き換えることで、アクティビティの表現形式を変えることができます: 🎉 Copied! 
 | @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
|
WARNING This translation need to be updated. WARNING 🎉 Copied! 
 | @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
|
insideスタイル(デフォルト) 🎉 Copied! 
 | @startuml
skinparam conditionStyle inside
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
|
🎉 Copied! 
 | @startuml
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
|
diamondスタイル 🎉 Copied! 
 | @startuml
skinparam conditionStyle diamond
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
|
InsideDiamond (またはfoo1)スタイル 🎉 Copied! 
 | @startuml
skinparam conditionStyle InsideDiamond
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
|
🎉 Copied! 
 | @startuml
skinparam conditionStyle foo1
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
| [Ref. QA-1290 and #400]diamondスタイル(デフォルト) 🎉 Copied! 
 | @startuml
skinparam ConditionEndStyle diamond
:A;
if (decision) then (yes)
:B1;
else (no)
endif
:C;
@enduml
|
🎉 Copied! 
 | @startuml
skinparam ConditionEndStyle diamond
:A;
if (decision) then (yes)
:B1;
else (no)
:B2;
endif
:C;
@enduml
@enduml
|
水平ライン(hline)スタイル 🎉 Copied! 
 | @startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
:B1;
else (no)
endif
:C;
@enduml
|
🎉 Copied! 
 | @startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
:B1;
else (no)
:B2;
endif
:C;
@enduml
@enduml
| [Ref. QA-4015]スタイル無し(デフォルト) 🎉 Copied! 
 | @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
|
スタイル有りスタイルを指定して要素の見た目を変更することができます。 🎉 Copied! 
 | @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
|
| |