Defining UML diagram begins like any directive definition in reStructuredText:
.. UML:: foobar
After the definition follows an indented content. The content should contain definition part and usually also layout part.
There are several possibilities for definition of UML elements. The first variant is the most clearest, but the others allow explict definition of variables for elements. After the first definition the element is referred using its name, after the later definitions the element is referred using its variable.
Syntax:
class foo
Syntax:
foo = class foo123
Syntax:
class (foo) foo123
Because of MetaPost elements' variable names cannot contain any numbers. Therefore, when e.g. a class name contains numbers one of the two later variants must be used to define legal variable for element.
Layout part is distinguished from definition part using a line with three or more -. The layout part is actually just MetaPost, but some helpful macros and attributes are provided to help placing elements. Also pure MetaPost is allowed.
Syntax:
class foo class bar --- horizontally(50, horiz, foo, bar);
The first parameter ("50") the for space between objects. The second parameter("horiz") is variable name for the layout's coordinate system.
Syntax:
class foo class bar --- vertically(50, vert, foo, bar);
Syntax:
class foo class bar class foobar --- horizontally(50, horiz, foo, bar); vertically(50, vert, horiz, foobar);
Syntax:
class foo class bar "abstract" fields field1 field2 fieldn methods method1 method2 methodn --- horizontally(50, hor_c, foo, bar);
Note: a class' name may contain a stereotype like "abstract" within quotation marks.
Syntax:
component foo
Syntax:
component foo assoc foobarA assoc foobarB foobarA = interface bar1 foobarB = interface bar2 --- horizontally(50, horiz, foobarA, foobarB); vertically(20, vert, horiz, foo);
Syntax:
package foobar
Syntax:
bigpackage foobar class foo class bar --- horizontally(50, horiz, foo, bar);
Note: The first syntax of bigpackage seem to have currently a few unfortunate restrictions:
- bigpackage itself cannot be linked
- bigpackages cannot be placed using horizontally or vertically macro
Syntax:
bigpackage foobar class foo class bar --- foo.sw = (50,25); horizontally(50, horiz, foo, bar); foobar.sw = (0, 0); foobar.ne = (200,75);
Syntax:
class foo inherit bar class bar --- horizontally(50, hor_c, foo, bar);
Syntax:
class foo abstract bar class bar "abstract" --- horizontally(50, hor_c, foo, bar);
Syntax:
class foo dep "create" bar class bar --- horizontally(100, hor_c, foo, bar);
Note: stereotype within quotation marks is obligatory.
Syntax:
class foo use bar class bar --- horizontally(50, hor_c, foo, bar);
Syntax:
class (fooA) foo1 assoc barA class (fooB) foo2 assoc multi(1) - multi(0..1) barB class (fooC) foo3 assoc aggreg multi(0..1) - multi(*) role(part-of) barC class (fooD) foo4 assoc compos multi(0..1) - multi(*) role(part-of) barD class (barA) bar1 class (barB) bar2 class (barC) bar3 class (barD) bar4 --- horizontally(150, hor_cA, fooA, barA); horizontally(150, hor_cB, fooB, barB); horizontally(150, hor_cC, fooC, barC); horizontally(150, hor_cD, fooD, barD); vertically(50, ver_c, fooA, fooB, fooC, fooD);
Syntax:
naryassoc nary class (fooA) foo1 assoc multi(1) - nary class (barA) bar1 assoc multi(*) - nary class (barB) bar2 assoc multi(*) - nary --- horizontally(150, hor_c, fooA, nary, barA); vertically(50, ver_c, barA, barB);
Syntax:
class foo qual q fields foobar assoc multi(*) - multi(0..1) bar class bar --- horizontally(150, hor_c, foo, bar); q.w = foo.e;
Note: unfortunately, qualifier must be attached manually (see the line q.w = foo.e;).
Syntax:
class foo supply bar class bar --- horizontally(50, hor_c, foo, bar);
Syntax:
seqobject foo seqobject bar --- horizontally(50, hor_c, foo, bar);
Syntax:
seqobject foo seqobject bar sequence foobar call foo call bar "foobar" return return --- horizontally(50, hor_c, foo, bar);
Syntax:
page bar link foobar bar.html
Note: available modules must be specified in config.
Syntax a)
class org.foobar.foo jlink
Syntax b)
class foo jlink org.foobar.foo
Syntax c)
jlinkpackage org.foobar class foo jlink
Note: available javadocs must be specified in config.
Syntax a)
class foobar::foo clink
Syntax b)
class foo clink foobar
Syntax c)
jlinkpackage foobar class foo clink
Note: available doc++ documentations must be specified in config.