Multiplicities and roles in class diagrams

+1 vote
asked Oct 24, 2018 in To be sorted by anonymous

I tried to have a role and a multiplicity on an association, For Example:

class Example "1 example" -right- "example2 *" class Example2

This works, but I want the 1 on top of the line, example below the line. Is this possible somehow?
commented Oct 24, 2018 by albert (2,500 points)
I tried the example in the plantuml webserver but it fails. Did you have a look at the examples: ?

1 Answer

0 votes
answered Oct 25, 2018 by mgrol (2,570 points)


what you do is the definition of the classes and the linking in one step. What you need to do is to separate these

like this:

class Example
class Example2
Example "1" -right- "*" Example2 : description

or to remove the class keyword and let plantuml do the initialization of the classes like this.

Example "1" -right- "*" Example2 : description

Both result in :



commented Oct 25, 2018 by albert (2,500 points)
On important thing to not is that when not specifying "right" the "1" and "*' are on the left side and the word description is on the left side, with the word right all is above the line. From the question I gather that OP ants to have the word description below the line and the "1" and "*" above (or vice versa). See plantuml webrowser: