Unified Modeling Language (UML)¶
Installation¶
Install plantuml:
$ sudo apt install plantuml
$ brew install plantuml
$ choco install plantuml
Install sphinxcontrib-plantuml:
$ python -m pip install sphinxcontrib-plantuml
$ python -m pip install sphinxcontrib-plantuml
C:> python -m pip install sphinxcontrib-plantumlConfigure Sphinx in the
conf.pyfile:extensions = [..., "sphinxcontrib.plantuml"] plantuml = "/PATH/TO/PLANTUML"
Note
Also in Windows, the path is specified with
/.
Sequence diagram¶
.. uml::
Browser -> Server: Authentication request
Server --> Browser: Authentication response
Browser -> Server: Another authentication request
Browser <-- Server: Another authentication response
->is used to draw a message between two actors. The actors do not have to be explicitly declared.
-->is used to draw a dotted line.
<- und <--do not change the drawing, but can increase readability.
Use case diagram¶
.. uml::
:User: --> (usage)
"Group of\nAdministrators" as Admin
"Using the\napplication" as (usage)
Admin --> (Administrate\nthe application)
Use cases are enclosed in round brackets () and resemble an oval.
Alternatively, the keyword usecase can also be used to define a use case. It
is also possible to define an alias using the keyword as. This alias can
then be used when defining relationships.
You can use \n to insert line breaks in the names of the use cases.
Activity diagram¶
(*)Start and end nodes of an activity diagram.
(*top)In some cases, this can be used to move the start point to the beginning of a diagram.
-->defines an activity
-down->down arrow (default value)
-right-> or ->arrow to the right
-left->Arrow to the left
-up->Arrow up
if,then,elseKeywords for the definition of branches.
Example:
.. uml:: (*) --> "Initialisation" if ‘a test’ then -->[true] "An activity" --> "Another activity" -right-> (*) else ->[false] "Something else" -->[end of the process] (*) endif
fork,fork againandend forkorend mergeKeywords for parallel processing.
Example:
.. uml:: start fork :Action 1; fork again :Action 2; end fork stop