2.3. Examples from web Site#

ネットで出会ったPlantUMLの見本を順不同で並べてあります。

participant Alice as A
participant Bob as B

A -> B: Hi!
A <- B: How are you?
A -> B : Fine. Thnak  you!

Foo <|-- Bar

Foo <|-- Bar

図 2.25 Caption with bold and italic#

Alice -> Bob: test

図 2.26 this is caption in sphinx directive#

プリプロセス機能の使用例

!define Junction_Or circle #black
!define Junction_And circle #whitesmoke

Junction_And JunctionAnd
Junction_Or JunctionOr

archimate #Technology "VPN サーバ" as vpnServerA <<technology-device>>

rectangle 実行 #lightgreen
rectangle 終了 #red
rectangle 待機 #orange
実行 -up-> JunctionOr
終了 -up-> JunctionOr
終了 -down-> JunctionAnd
待機 -down-> JunctionAnd

タイミングチャートの例

Title タイミングチャート
robust "スタートスイッチ X001" as x001
robust "ランプ Y000" as y000
robust "ブザー Y001" as y001
robust "MC Y002" as y002
robust "モータ Y003" as y003
robust "電磁弁 Y004" as y004

x001 is 非励磁
y000 is 非励磁
y001 is 非励磁
y002 is 非励磁
y003 is 非励磁
y004 is 非励磁

@x001
0 is 励磁
+30 is 非励磁
@y000
0 is 励磁
@0 <->  @+20 :{2秒間隔}
100 is 非励磁
@y001
20 is 励磁
100 is 非励磁
@20 <->  @+20 :{2秒間隔}
@y002
40 is 励磁
100 is 非励磁
@40 <->  @+20 :{2秒間隔}
@y003
60 is 励磁
100 is 非励磁
@60 <->  @+20 :{2秒間隔}
@y004
80 is 励磁
100 is 非励磁
@80 <->  @+20 :{2秒間隔}


@0
x001 -> y000
@20
y000 -> y001
@40
y001 -> y002
@60
y002 -> y003
@80
y003 -> y004
@100
y004 -> y003
y003 -> y002
y002 -> y001
y001 -> x001

図 2.27 タイミングチャート(UML)サンプル#

clock   "Clock_0"   as C0 with period 50
clock   "Clock_1"   as C1 with period 50 pulse 15 offset 10
binary  "Binary"  as B
concise "Concise" as C
robust  "Robust"  as R


@0
C is Idle
R is Idle

@100
B is high
C is Waiting
R is Processing

@300
R is Waiting

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

@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

: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;

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

#

@startgantt
[Task1] requires 4 days
then [Task1.1] requires 4 days
[Task1.2] starts at [Task1]'s end and requires 7 days

[Task2] requires 5 days
then [Task2.1] requires 4 days

[MaxTaskEnd] happens at [Task1.1]'s end
[MaxTaskEnd] happens at [Task1.2]'s end
[MaxTaskEnd] happens at [Task2.1]'s end

@endgantt

図 2.28 PlantUMLのガントチャート作成機能の例#

2.3.1. JSON#

JSONを表示

@startjson
<style>
jsonDiagram {
   node {
          BackGroundColor Khaki
          LineColor lightblue
          FontName Helvetica
          FontColor red
          FontSize 18
          FontStyle bold
          RoundCorner 0
          LineThickness 2
          LineStyle 10-5
          separator {
          LineThickness 0.5
          LineColor black
          LineStyle 1-5
          }
}
arrow {
          BackGroundColor lightblue
          LineColor green
          LineThickness 2
          LineStyle 2-5
}
highlight {
          BackGroundColor red
          FontColor white
          FontStyle italic
          }
}
</style>
#highlight "1" / "hr"
[
   {
          "name": "Mark McGwire",
          "hr":   65,
          "avg":  0.278
   },
   {
          "name": "Sammy Sosa",
          "hr":   63,
          "avg":  0.288
   }
]
@endjson

図 2.29 JSONの表示.#

2.3.2. GUI設計図(Salt)#

Saltは PlantUML のサブプロジェクトで、グラフィカルなインターフェイスやウェブサイトワイヤーフレーム、ページ概略図、画面青写真 グラフィカルなインターフェイス、回路図、青写真を作るのにとても便利です。概念的な構造を視覚的なデザインと整合させ、美しさよりも機能性を強調するのに役立ちます。

@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

hide circle
hide empty members

package "bdd 渦巻ポンプ" <<Frame>> {
class 羽根車 <<block >>{
    Text=回転して液に遠心力を与える
}
class ケーシング <<block >>{
    Text=液の通り道をつくる
}
class グランドパッキン <<block >>
class メカニカルシール <<block>>
class スリーブ <<block >>
class ベアリングハウジング <<block >>
class ボールベアリング <<block >>
class 本体部 <<block >>
class 軸シール部 <<block >>{
   Text=主軸とケーシングの貫通部から液が漏れないようにする
}
class 軸受け部 <<block >>{
    Text=主軸を支える
    }
class 渦巻ポンプ <<block >>
class 主軸 <<block >>{
    Text=駆動部からトルクを伝える
}
class モーター <<block >>
class 電源 <<block >>
class 駆動部 <<block >>

}

渦巻ポンプ *-- 本体部
渦巻ポンプ *-- 軸シール部
渦巻ポンプ *-- 軸受け部
渦巻ポンプ *-- 駆動部

駆動部 *-- モーター
駆動部 *-- 電源


本体部 *-- 羽根車
本体部 *-- ケーシング
本体部 *-- 主軸

軸シール部 *-- グランドパッキン
軸シール部 *-- メカニカルシール
軸シール部 *-- スリーブ

軸受け部 *-- ベアリングハウジング
軸受け部 *-- ボールベアリング

モーター --> 主軸 :トルクを伝える
主軸 --> 羽根車:トルクを伝える

2.3.3. ガントチャート#

@startgantt
[Prototype design] requires 15 days
[Test prototype] requires 10 days
-- All example --
[Task 1 (1 day)] requires 1 day
[T2 (5 days)] requires 5 days
[T3 (1 week)] requires 1 week
[T4 (1 week and 4 days)] requires 1 week and 4 days
[T5 (2 weeks)] requires 2 weeks
@endgantt

@startgantt
[task1] links to [[http://plantuml.com]]
[task1] requires 3 days
then [task2] requires 4 days
@endgantt

ガントチャートを**mainframe**の中に作成。

@startgantt
mainframe This is a **mainframe**

[task] lasts 5 days
@endgantt

2.3.4. シーケンス図 (プロトコル図)#

Alice -> Bob: Hi!
Alice <- Bob: How are you?

2.3.5. クラス図#

class "This is my class" as class1 {
   +myMethods()
   -myMethods2()
   String name
}

class class2 as "It works this way too" <<Serializable>> {
   String name
}

class2 *--  "foo/dummy": use

2.3.6. ER図#

' hide the spot
hide circle
' avoid problems with angled crows feet
skinparam linetype ortho
entity "Entity01" as e01 {
  *e1_id : number <<generated>>
  --
  *name : text
  description : text
}
entity "Entity02" as e02 {
  *e2_id : number <<generated>>
  --
  *e1_id : number <<FK>>
  other_details : text
}
entity "Entity03" as e03 {
  *e3_id : number <<generated>>
  --
  e1_id : number <<FK>>
  other_details : text
}
e01 ||..o{ e02
e01 |o..o{ e03

図 2.30 PlantUMLのER図#

@startchen

entity "Customer" as CUSTOMER {
  "customer number" as Number <<key>>
  "member bonus" as Bonus <<derived>>
  "first and last names" as Name <<multi>>
}

entity "Movie" as MOVIE {
  "barcode" as Code
}

relationship "was-rented-to" as RENTED_TO {
  "date rented" as Date
}

RENTED_TO -1- CUSTOMER
RENTED_TO -N- MOVIE

@endchen

図 2.31 ER図の別の形(Chen式)#

2.3.7. ユースケース図#

left to right direction
actor Guest as g
package Professional {
  actor Chef as c
  actor "Food Critic" as fc
}
package Restaurant {
  usecase "Eat Food" as UC1
  usecase "Pay for Food" as UC2
  usecase "Drink" as UC3
  usecase "Review" as UC4
}
fc --> UC4
g --> UC1
g --> UC2
g --> UC3