Unified Modeling Language (UML)

Installation

  1. Install plantuml:

    $ sudo apt install plantuml
    
    $ brew install plantuml
    
    $ choco install plantuml
    
  2. Install sphinxcontrib-plantuml:

    $ python -m pip install sphinxcontrib-plantuml
    
    $ python -m pip install sphinxcontrib-plantuml
    
    C:> python -m pip install sphinxcontrib-plantuml
    
  3. Configure Sphinx in the conf.py file:

    extensions = [..., "sphinxcontrib.plantuml"]
    
    plantuml = "/PATH/TO/PLANTUML"
    

    Note

    Also in Windows, the path is specified with /.

Sequence diagram

../../../_images/sequence-diagram.svg
.. 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

../../../_images/use-case-diagram.svg
.. 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, else

Keywords 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
../../../_images/activity-diagram.svg
fork, fork again and end fork or end merge

Keywords for parallel processing.

Example:

.. uml::

   start
   fork
     :Action 1;
   fork again
     :Action 2;
   end fork
   stop
../../../_images/parallel.svg