gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
viết tất cả vĩ dụ chart thường dùng trong plantuml trong cùng file uml
- User
viết tất cả vĩ dụ chart thường dùng trong plantuml trong cùng file uml
- Assistant
Không có giới hạn cho số lượng biểu đồ trong PlantUML. Dưới đây là một số ví dụ biểu đồ thường sử dụng:
Biểu đồ lớp
@startuml class A { + attribute1: Integer - attribute2: String # attribute3: Double + operation1(param1: String): Boolean - operation2(param2: Integer): Float # operation3(param3: Double): Void } @endumlBiểu đồ use case
@startuml left to right direction actor User rectangle Website { User --> (View articles) User --> (Search articles) User --> (Create an account) User --> (Login) } @endumlBiểu đồ hoạt động
@startuml start :Login; if (Login successful?) then (yes) :View articles; while (Still viewing articles?) is (yes) :Click on an article; endwhile else (no) :Display error message; endif stop @endumlBiểu đồ trạng thái
@startuml [*] --> Locked Locked : Press the button to unlock Unlocked : Press the button to lock Locked --> Unlocked : PressButton Unlocked --> Locked : PressButton state Locked { [*] --> Locked Locked : Locked } state Unlocked { Unlocked : Unlocked } @endumlBiểu đồ thông tin
@startuml object Car { owner: User make: "Tesla" model: "Model S" licensePlate: "ABC-123" } object User { name: "John Smith" age: 35 } @endumlBiểu đồ tuần tự
@startuml actor User participant App participant API User -> App: View articles activate App App -> API: Send GET request activate API API -> App: Return articles deactivate API App -> User: Display articles deactivate App @endumlBiểu đồ gọi lại
@startuml start partition App { :Request data; if (Data is cached?) then (yes) -> HTTP :Use cached data; else (no) -> HTTP :Fetch data; -> Cache endif -> Callback :Transform data; -> User } @endumlBiểu đồ kế thừa
@startuml class Animal { + name: String + speak(): String } class Cat { + purr(): String } Animal <|-- Cat @endumlBiểu đồ hợp đồng
@startuml interface ICar { + startEngine(): void + stopEngine(): void } class Car implements ICar { + startEngine(): void + stopEngine(): void } @endumlBiểu đồ thành phần
@startuml component App { interface IAPI { + search(query: string): Promise<Article[]> } -> IAPI -> SearchResults } component SearchResults { interface IArticleList { + display(articles: Article[]): void } } class Article { + title: string + author: string + content: string } App -> SearchResults SearchResults --> Article @enduml - User
cho thêm
- Assistant
Biểu đồ gói
@startuml package Search { class SearchController { + search(query: string): Promise<Article[]> } class SearchView { + display(articles: Article[]): void } } package Article { class Article { + title: string + author: string + content: string } } SearchView -> SearchController SearchController --> Article @endumlBiểu đồ giao diện người dùng
@startuml !define AWSPUML https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v15.0.0/dist !includeurl AWSPUML/Interface%20Endpoints/AmazonAPIGateway.puml !includeurl AWSPUML/Application%20Integration/AmazonSimpleQueueService.puml frame { title API Gateway AmazonAPIGateway(apigateway,"API Gateway") } frame { title SQS Queue AmazonSimpleQueueService(sqsqueue, "SQS Queue") } boundary UserInterface UserInterface -> apigateway : Send request apigateway -> sqsqueue : Send message @endumlBiểu đồ deployment
@startuml !define AWSPUML https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v15.0.0/dist !includeurl AWSPUML/Compute/AmazonEC2.puml !includeurl AWSPUML/Deployment%20&%20Management/AWSCloudFormation.puml !includeurl AWSPUML/Deployment%20&%20Management/AWSIdentityandAccessManagement(IAM).puml skinparam backgroundColor #EEEBDC skinparam shadowing false node "AWS CloudFormation" { AmazonEC2(webserver, "Web Server") role(role, "Role") policy(policy, "Policy") IAM(user, "IAM User") webserver .. role role .. policy user -- policy } @endumlCác biểu đồ này không bao gồm tất cả các loại biểu đồ có sẵn trong PlantUML. Chúng tôi hy vọng những ví dụ trên sẽ giúp bạn bắt đầu với PlantUML.