LoginSignup
2
2

PlantUMLの隠れた機能:plantuml-stdlibを使いこなそう

Last updated at Posted at 2023-08-13

PlantUMLとは

ダイアグラムを素早く作成するためのコンポーネントです。

plantuml-stdlibとは

公式リリースに含まれているライブラリです。
PlantUML単独では表現的に物足りない場合でも、plantuml-stdlibを利用することで表現の幅を広げることができます。

plantuml-stdlibの構文

以下のURLを参考に、そこからの相対パスで記載します

どんなものができますか?

C4

C4は、システムコンテキスト図、コンテナ図 、コンポーネント図、 コード図の4階層でソフトウェア アーキテクチャを視覚化するためのモデルです。

!include <C4/C4_Context>

title System Context diagram for Internet Banking System

Person(customer, "Banking Customer", "A customer of the bank, with personal bank accounts.")
System(banking_system, "Internet Banking System", "Allows customers to check their accounts.")

System_Ext(mail_system, "E-mail system", "The internal Microsoft Exchange e-mail system.")
System_Ext(mainframe, "Mainframe Banking System", "Stores all of the core banking information.")

Rel(customer, banking_system, "Uses")
Rel_Back(customer, mail_system, "Sends e-mails to")
Rel_Neighbor(banking_system, mail_system, "Sends e-mails", "SMTP")
Rel(banking_system, mainframe, "Uses")

AWS

AWSのアイコンを描画することもできます。

!include <aws/common>
!include <aws/Messaging/AmazonSES/AmazonSES>
!include <aws/Storage/AmazonS3/AmazonS3>
!include <aws/Storage/AmazonS3/bucket/bucket>

AMAZONS3(s3_internal)
AMAZONS3(s3_partner,"Vendor's S3")
s3_internal <- s3_partner
!include <awslib/AWSCommon>
!include <awslib/InternetOfThings/IoTRule>
!include <awslib/Analytics/KinesisDataStreams>
!include <awslib/ApplicationIntegration/SimpleQueueService>

left to right direction

agent "Published Event" as event

IoTRule(iotRule, "Action Error Rule", "error if Kinesis fails")
KinesisDataStreams(eventStream, "IoT Events", "2 shards")
SimpleQueueService(errorQueue, "Rule Error Queue", "failed Rule actions")

event --> iotRule : JSON message
iotRule --> eventStream : messages
iotRule --> errorQueue : Failed action message

C4とAWSを合体させてみた

C4のようにspriteを指定できる場合、AWSやその他別ライブラリであっても、spriteを埋め込むことができます

!include <C4/C4_Context>

title System Context diagram for Internet Banking System

Person(customer, "Banking Customer", "A customer of the bank, with personal bank accounts.")
System(banking_system, "Internet Banking System", "Allows customers to check their accounts.",$sprite="EC2")

System_Ext(mail_system, "E-mail system", "The internal Microsoft Exchange e-mail system.",$sprite="SimpleEmailService")
System_Ext(mainframe, "Mainframe Banking System", "Stores all of the core banking information.")

Rel(customer, banking_system, "Uses")
Rel_Back(customer, mail_system, "          Sends e-mails to", $sprite="SimpleEmailServiceEmail")
Rel_Neighbor(banking_system, mail_system, "Sends e-mails", "SMTP")
Rel(banking_system, mainframe, "Uses")

!include <awslib/AWSCommon>
!include <awslib/Compute/EC2>
!include <awslib/BusinessApplications/SimpleEmailService>
!include <awslib/BusinessApplications/SimpleEmailServiceEmail>

構文のドキュメントはどこで参照できますか?

plantuml-stdlibリポジトリで参照できます。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2