活動標簽(activity label)以冒號開始,以分號結束。
文本格式支持creole wiki語法。
活動默認安裝它們定義的順序就行連接。
@startuml :Hello world; :This is on defined on several **lines**; @enduml

開始/結束
你可以使用關鍵字start
和stop
表示圖示的開始和結束。
@startuml start :Hello world; :This is on defined on several **lines**; stop @enduml

也可以使用 end
關鍵字。
@startuml start :Hello world; :This is on defined on several **lines**; end @enduml

條件語句
在圖示中可以使用關鍵字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 elseif (condition C) then (yes) :Text 3; elseif (condition D) then (yes) :Text 4; else (nothing) :Text else; endif stop @enduml

重復循環
你可以使用關鍵字repeat
和repeatwhile
進行重復循環。
@startuml start repeat :read data; :generate diagrams; repeat while (more data?) stop @enduml

while循環
可以使用關鍵字while
和end while
進行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

並行處理
你可以使用關鍵字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 @enduml

注釋
文本格式支持creole wiki語法。
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

標題和圖例
你可以給圖表(diagram)添加標題、標頭、腳注和圖例。
@startuml title this is my title if (condition?) then (yes) :yes; else (no) :no; 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

顏色
你可以為活動(activity)指定一種顏色。
@startuml start :starting progress; #HotPink:reading configuration files These files should edited at this point!; #AAAAAA:ending of the process; @enduml

箭頭
使用->
標記,你可以給箭頭添加文字或者修改箭頭顏色。
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

組合(grouping)
通過定義分區(partition),你可以把多個活動組合(group)在一起。
@startuml start partition Initialization { :read config file; :init internal variable; } partition Running { :wait for user interaction; :print information; } stop @enduml

泳道(Swimlanes)
你可以使用管道符|
來定義泳道。
還可以改變泳道的顏色。
@startuml |Swimlane1| start :foo1; |#AntiqueWhite|Swimlane2| :foo2; :foo3; |Swimlane1| :foo4; |Swimlane2| :foo5; stop @enduml

分離(detach)
可以使用關鍵字detach
移除箭頭。
@startuml :start; fork :foo1; :foo2; fork again :foo3; detach endfork if (foo4) then :foo5; detach endif :foo6; detach :foo7; stop @enduml

特殊領域語言(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

一個完整的例子
@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
