-
Notifications
You must be signed in to change notification settings - Fork 28
Home
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 syntax 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: -
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:
Item | Example |
---|---|
Class | [Customer] |
Directional | [Customer]->[Order] |
Bidirectional | [Customer]<->[Order] |
Aggregation |
[Customer]+-[Order] or [Customer]<>-[Order]
|
Composition | [Customer]++-[Order] |
Inheritance | [Customer]^[Cool 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}] |
// {type:class}
// {direction:topDown}
// {generate:true}
[note: You can stick notes on diagrams too!{bg:cornsilk}]
[Customer]<>1-orders 0..*>[Order]
[Order]++*-*>[LineItem]
[Order]-1>[DeliveryMethod]
[Order]*-*>[Product|EAN_Code|promo_price()]
[Category]<->[Product]
[DeliveryMethod]^[National]
[DeliveryMethod]^[International]
- The
note:
indicator defines note elements that can be associated to other elements with a simple hyphen. - The
{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:
Item | Example |
---|---|
Use Case | (Login) |
Actor | [Customer] |
<> | (Login)<(Forgot Password) |
<> | (Register)>(Confirm Email) |
Actor Inheritance | [Admin]^[User] |
Note | [Admin]-(note: Most privilidged user) |
// {type:usecase}
// {direction:leftToRight}
// {generate:true}
(note: figure 1.2{bg:beige})
[User]-(Login)
[Site Maintainer]-(Add User)
(Add User)<(Add Company)
[Site Maintainer]-(Upload Docs)
(Upload Docs)<(Manage Folders)
[User]-(Upload Docs)
[User]-(Full Text Search Docs)
(Full Text Search Docs)>(Preview Doc)
(Full Text Search Docs)>(Download Docs)
[User]-(Browse Docs)
(Browse Docs)>(Preview Doc)
(Download Docs)
[Site Maintainer]-(Post New Event to the Web Site)
[User]-(View Events)
- Unlike the class diagram syntax, the notes shall be surrounded by parenthesis rather than brackets.
The following constructions were taken from the yuml.me page for activity diagrams:
Item | Example |
---|---|
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) <d1>not logged in-> (Show Login Page)
|
Parallel |
(Action 1)->|a| <br> and (Action 2)->|a|
|
// {type:activity}
// {generate:true}
(start)-><a>[kettle empty]->(Fill Kettle)->|b|
<a>[kettle full]->|b|->(Boil Kettle)->|c|
|b|->(Add Tea Bag)->(Add Milk)->|c|->(Pour Water)
(Pour Water)->(end)
-
start
andend
are special labels (case-sensitive). - In contrast to the previous diagrams, this diagram syntax accepts concatenation of more than two elements.
- The labels for decision diamonds and parallel bars are not shown.
This syntax is not officially defined in yuml.me, and is inspired on the activity diagram:
Item | Example |
---|---|
Start | (start) |
End | (end) |
Activity | (Find Products) |
Flow | (start)->(Find Products) |
Multiple Assoc. | (start)->(Find Products)->(end) |
Complex case | `(Simulator running)[Pause]->(Simulator paused |
Note | (state)-(note: a note here) |
// {type:state}
// {generate:true}
(start)[Start]->(Simulator running)
(Simulator running)[Pause]->(Simulator paused|do / wait)
(Simulator running)[Stop]->(end)
(Log retrieval)[Continue]->(Simulator running)
(Simulator paused)[Unpause]->(Simulator running)
(Simulator paused)[Data requested]->(Log retrieval|do / output log)
(Log retrieval)->(end)
This syntax is not officially defined in yuml.me, and is inspired on the class diagram:
Item | Example |
---|---|
Node | [node1] |
Association | [node1]-[node2] |
Labeled Assoc. | [node1]label-[node2] |
Note | [node1]-[note: a note here] |
// {type:deployment}
// {generate:true}
[Presentation Server]-[Policy Server]
[Policy Server]-[Document Server]
[Product Server]-[Document Server]
[Document Server]ASP.Net-[Workstation]
[Policy Server]-[Database Server]
[Product Server]-[Database Server]
[Policy Server]-[note: To be clustered to meet throughput needs{bg:cornsilk}]
[Policy Server]-[Directory Server]
[Policy Server]-[Underwriting & Rating Server]
- The deployment diagram currently doesn't allow nesting nodes or components
This syntax is not officially defined in yuml.me, and is inspired on the class diagram:
Item | Example |
---|---|
Object | [Patron] |
Message | [Patron]order food>[Waiter] |
Response | [Waiter]serve wine.>[Patron] |
Note | [Actor]-[note: a note message] |
Asynchronous | [Patron]order food>>[Waiter] |
// {type:sequence}
// {generate:true}
[:Computer]sendUnsentEmail>[:Server]
[:Computer]newEmail>[:Server]
[:Server]reponse.>[:Computer]
[:Computer]downloadEmail>[:Server]
[:Computer]deleteOldEmail>[:Server]
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:
Item | Example |
---|---|
Package | [package1] |
Association | [package1]->[package2] |
Labeled assoc | [package1]label->[package2] |
Note | [package1]-[note: a note here] |
// {type:deployment}
// {generate:true}
[Presentation Server]-[Policy Server]
[Policy Server]-[Document Server]
[Product Server]-[Document Server]
[Document Server]ASP.Net-[Workstation]
[Policy Server]-[Database Server]
[Product Server]-[Database Server]
[Policy Server]-[note: To be clustered to meet throughput needs{bg:cornsilk}]
[Policy Server]-[Directory Server]
[Policy Server]-[Underwriting & Rating Server]
- The package diagram currently doesn't allow nesting packages or classes
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:
- Look if there is a new definition in yuml.me.
- Look for other contributors implementing their own yUML tools.
- Derive a proposal from previous diagram syntaxes.