The yUML syntax is based on the samples provided in yuml.me. There is not a formal documentation, so this page pretends to centralize the information gathered, plus some proposed extensions for new diagram types.
The following extension supports comments and directives out of the original yUML syntax. They are similar to other languages' inline comments, starting with a double slash.
Directives are required for modifying the rendering behavior and shall be placed at the beginning of the file, before any yUML statement. The type directive is the unique mandatory one.
This is the list of valid directives:
type: Mandatory, specifies the diagram type.
Valid values: class, activity, usecase, state, deployment, package, sequence
Example: // {type:class}
direction: Optional, specifies the drawing direction for certain diagram types.
Valid values: leftToRight, rightToLeft, topDown
Default: topDown
Example: // {direction:leftToRight}
generate: Optional, indicates if a .svg file shall be generated on each save. The image file is saved in the same folder as the .yuml file.
Valid values: true, false
Default: false
Example: // {generate:true}
The following constructions were taken from the yuml.me page for class diagrams:
Class [Customer]
Directional [Customer]->[Order]
Bidirectional [Customer]<->[Order]
Aggregation [Customer]+-[Order] or [Customer]<>-[Order]
Composition [Customer]++-[Order]
Inheritance [Customer]^[Cool Customer], [Customer]^[Uncool Customer]
Dependencies [Customer]uses-.->[PaymentStrategy]
Cardinality [Customer]<1-1..2>[Address]
Labels [Person]customer-billingAddress[Address]
Notes [Address]-[note: Value Object]
Full Class [Customer|Forename;Surname;Email|Save()]
Color splash [Customer{bg:orange}]<>1->*[Order{bg:green}]
note:
indicator defines note elements that can be associated to other elements with a simple hyphen.{bg: xxx}
modifier determines the background color of the element. The color codes are specified in a section below.A non-standard syntax has been added for supporting association classes. For any class-association-class construct (typically many-to-many), just append another class in the same expression, as:
[Invoice]<*-*>[Products][Invoice Item]
The following constructions were taken from the yuml.me page for use-case diagrams:
Use Case (Login)
Actor [Customer]
<<Extend>> (Login)<(Forgot Password)
<<Include>> (Register)>(Confirm Email)
Actor Inheritance [Admin]^[User]
Note [Admin]-(note: Most privilidged user)
The following constructions were taken from the yuml.me page for activity diagrams:
Start (start)
End (end)
Activity (Find Products)
Flow (start)->(Find Products)
Multiple Assoc. (start)->(Find Products)->(end)
Decisions (start)-><d1>
Decisions w/Label (start)-><d1>logged in->(Show Dashboard) and <d1>not logged in->(Show Login Page)
Parallel (Action 1)->|a| and (Action 2)->|a|
start
and end
are special labels (case-sensitive).This syntax is not officially defined in yuml.me, and is inspired on the activity diagram:
Start (start)
End (end)
Activity (Find Products)
Flow (start)->(Find Products)
Multiple Assoc. (start)->(Find Products)->(end)
Complex case (Simulator running)[Pause]->(Simulator paused|do/wait)[Unpause]->(Simulator running)
Note (state)-(note: a note here)
This syntax is not officially defined in yuml.me, and is inspired on the class diagram:
Node [node1]
Association [node1]-[node2]
Labeled Assoc. [node1]label-[node2]
Note [node1]-[note: a note here]
This syntax is not officially defined in yuml.me, and is inspired on the class diagram:
Object [Patron]
Message [Patron]order food>[Waiter]
Response [Waiter]serve wine.>[Patron]
Note [Actor]-[note: a note message]
Asynchronous [Patron]order food>>[Waiter]
The following syntax is not yet implemented but will soon:
Open activation box at source [Source](message>[Dest]
Open activation box at dest [Source]message>([Dest]
Close activation at dest [Source]message>)[Dest]
Close activation at source [Source])message>[Dest]
Cancel activation box [Source])X
This syntax is not officially defined in yuml.me, and is inspired on the class diagram:
Package [package1]
Association [package1]->[package2]
Labeled assoc [package1]label->[package2]
Note [package1]-[note: a note here]
Colors can be specified as hex values with the form #RRGGBB or with names. The names correspond to the X11 color coding.
The complete list of color names can be found at Wikipedia
For other diagram types implemented subsequently, the syntax will be determined in the following order: