Unified Compliance NextGen
  • UCF NextGen
    • On-Boarding
    • PlantUML
      • Diagrams as Code
        • Why use diagrams as Code tools?
        • Use Cases
        • Introduction to PlantUML
        • Syntax
          • Basic PlantUML Syntax
          • Sequence Diagram
            • Lifelines
            • Messages
            • ExecutionSpecification
            • Autonumber
            • Notes
            • Interactions
            • Organization
          • Use Case Diagram
            • Use Case
            • Actor
            • Associations
            • Organization
            • Notes
          • Class Diagram
            • Classes and Other Entities
            • Attributes and Methods
            • Relationships
            • Organization
            • Notes
          • Object Diagram
            • Objects
            • Relations and Associations
            • Organization
            • Notes
          • Work Breakdown Structure Diagram
            • OrgMode Syntax
            • Arithmetic Notation
            • Styling
          • Activity Diagram
            • Actions and Other Objects
            • Arrows
            • Conditionals
            • Loops
            • Forks, Splits, and Merges
            • Notes
          • Text Formatting
          • Skin Parameters
    • Control Workspace
      • My Frameworks
        • Authority Document Details
        • Common Control Details
      • List Manager
      • Compare
      • Exports
    • UCF Catalog
    • Profile
    • Administration
      • Account Settings
        • General
        • Team
        • Organization
        • Industry
        • Groups
        • Initiatives
      • API Manager
      • Billing
    • API Gateway
Powered by GitBook
On this page
  • Commenting Code
  • Mixing Diagrams and Syntax Errors

Was this helpful?

Export as PDF
  1. UCF NextGen
  2. PlantUML
  3. Diagrams as Code
  4. Syntax

Basic PlantUML Syntax

Every PlantUML file requires a start and end command. These will be the first and last lines of your code. X number of them use the same command a few of the supported non-UML diagrams have their own start and end commands. The table below shows the commands for each diagram.

Diagram Type

Start Command

End Command

Sequence Diagram

@startuml

@enduml

Use Case Diagram

@startuml

@enduml

Class Diagram

@startuml

@enduml

Object Diagram

@startuml

@enduml

Activity Diagram

@startuml

@enduml

Component Diagram

@startuml

@enduml

Deployment Diagram

@startuml

@enduml

State Diagram

@startuml

@enduml

Network Diagram

@startuml

@enduml

Salt or Wireframe

@startsalt

@endsalt

Archimate Diagram

@startuml

@enduml

Gantt Chart

@startgantt

@endgantt

MindMap

@startmindmap

@endmindmap

Work Breakdown Structure

@startwbs

@endwbs

JSON

@startjson

@endjson

YAML

@startyaml

@endyaml

Example: Basic PlantUML File

@startuml



@enduml

Commenting Code

Code comments are ignored by the program. Use them to plan or explain to the next person (future you) what your code is doing. To comment in PlantUML, put a single quote at the beginning of the line.

Example: Commenting Code

@startuml
'The above line is required for most PlantUML files.

'This line will be ignored by PlantUML.

'The below line is required for most PlantUML files.
@enduml

Mixing Diagrams and Syntax Errors

PlantUML is used to make several types of diagrams. As shown above, many of them are enclosed within the same @startuml and @enduml lines. Because of this, PlantUML determines the type of diagram based on the body of your code. If you mix code from multiple types of diagrams, you may only receive a syntax error. If you continually get a syntax error and know there is nothing wrong with the particular line throwing the error, ensure you aren't accidentally using syntax from another type of diagram.

We will show this in the following three examples. The first two sets of code and images will make a proper diagram. The third set will combine the first two and throw a syntax error.

Example: Functional Sequence Diagram

@startuml

'The following code is used in a sequence diagram.

participant Sean
participant Maria

Sean  ->  Maria 
Sean  <-- Maria

@enduml

Example: Functional Use Case Diagram

@startuml

'The following code is used in a use case diagram.

(Door)

:Sean:

Sean -> Door

@enduml

Example: Broken Diagram

@startuml

'The following code is used in a sequence diagram.

participant Sean
participant Maria

Sean  ->  Maria 
Sean  <-- Maria

'The following code is used in a use case diagram.
'Because of the mixed code. PlantUML will throw an error on line 14.

(Door)

:Sean:

Sean -> Door

@enduml
PreviousSyntaxNextSequence Diagram

Last updated 1 year ago

Was this helpful?

Sequence Diagram
Use Case Diagram
Broken Diagram