participant declarations with a space

0 votes
asked May 14 in Bug by andreas.kagedal (280 points)

Hi, I have a question about participant declarations in sequence diagrams.

Both of these work:

participant donald as "Donald\nDuck"

participant "Donald Duck"

But this does no work

participant "Donald Duck" as "Donald\nDuck"

Why? Is it intentional, or a bug?

1 Answer

0 votes
answered May 18 by anonymous

Hi,

You can not enclose double sides of "as" with double quotes.

The pattern for using "as" is:

participant  DonaldDuck1Left        as "Donald Duck 1 Right"
participant "Donald Duck 2 Left"    as  DonaldDuck2Right
participant  DonaldDuck3Left        as "Donald\nDuck\n3\nRight"
participant "Donald\nDuck\n4\nLeft" as  DonaldDuck4Right

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuIe0qfd9cGM9UIKA2YxvUOavAIwboTc6FgbfG048I2nMK898AO3a50mLWZBJCqgKa3MZgZ1I0EbNWcX6DjS8h1ENhSROROt90qd6v1d7v65QZAx892OFR3UQnIOGYnrIyrA0tWO0

commented May 20 by andreas.kagedal (280 points)
edited May 20 by andreas.kagedal

Indeed. As long as I use "as" and only use the name without double quotes when I draw the diagram I understand how it works. But it seems it is (sometimes?) possible to use the quoted version in the diagrams as well. So in the example below, my question is really, why does "Donald Duck 5" work fine? Or actually, since it does work fine, why cannot this work:

"Donald Duck 5"  as "Donald\nDuck\n5"

Example:

@startuml
participant  A
participant  DonaldDuck1Left        as "Donald Duck 1 Right"
participant "Donald Duck 2 Left"    as  DonaldDuck2Right
participant  DonaldDuck3Left        as "Donald\nDuck\n3\nRight"
participant "Donald\nDuck\n4\nLeft" as  DonaldDuck4Right
participant "Donald Duck 5"

' This works. The participant above is used.
A -> "Donald Duck 5"

' Should these go to the same lifeline?
' They don't. The second one introduces a new lifeline.
A -> DonaldDuck1Left
A -> "Donald Duck 1 Right" : This goes to a different participant.
@enduml

http://www.plantuml.com/plantuml/png/TP6zRiCm38HtFSN1IwOQo4-N3cq2PEXGT6WpUX4isXPYau558-ZRrug0rcuTBP9uF7uak0zgUnswrbp6svV-Obc1m_nx5BQjEmxbUVr6bI8Ts80iIOWQrlZmTQFPp3pBs23wisIUrjtSdFUessLgmL4iU5lm4dYUj2iuiUVWNGBVxVWnCsQ5K-C3hjAVGuvt0TCLKySeUjPUt52Ioyq13y__giGoduqCOqWR2eHQe1BV2BOZjBwYrZEzt73q1IUyqXodLqAWKjX1c7uv0JRsyUDBsB-hIi75BU4fZLKB1QZ0mlcgefvOfyFbnko9tT2rtm00

commented May 20 by andreas.kagedal (280 points)
edited May 20 by andreas.kagedal

It might seem strange that I would need this. The reason is that I am defining  macros that use the same parameter both as a participant and as text appearing in a note box. The below works fine:

@startuml
!define SERVICE(PROVIDER, NAME) rnote over "PROVIDER": **PROVIDER Service**:\n##NAME
participant  A
participant "Donald Duck"

A -> "Donald Duck": Request a good thing
activate "Donald Duck"
SERVICE(Donald Duck, Do Good Things)
A <- "Donald Duck": There you go
deactivate "Donald Duck"
@enduml

http://www.plantuml.com/plantuml/uml/TP1FImCn5CJl-HHZUh6X_GABI1SJf0V_a4fFNaBohC6QrEpBWj_Ux6715dgS6MP-ZxSPs1MktqTn4-WZ9iBEsFtsmTo-sfVzLXkxmdF_P9OeAJCXZrGWvqnsK6eMs54PeoUbklUqM4mjSMhZqSUJImpqPrBgdDmnG5V_9ONeiRu_zpfO-gaqC1mEEGVmPqm7uJp7qJ5T3Cnd_pDNq1cFK_DjQWxB1hbRNq1QHeNmcsk3Y41NvZUKGllI7m00

But if I need the name in the box at the top of the lifeline  to be written on more than one row, without changing the text in the note-box, I cannot fix it. Changing the participant declaration like this generates an error:

participant "Donald Duck" as "Donald\nDuck"

commented Jun 4 by Ichiro
edited Jun 5

Hi,
Time has passed. sorry.

This is probably a bug.
My approach is as follows. My estimation is included.

I searched for an option to get useful information.

java -jar plantuml.jar -h

There was an option I was interested in.

-pattern To print the list of Regular Expression used by PlantUML

I specified it and executed it.

java -jar plantuml.jar -pattern

Four regular expressions are output that PlantUML uses to find participant sentences.

^(?:(participant|actor|create| ... omitted

I applied the regular expression to find the participant sentence in it to the example written in this article.
Here is the regular expression number that found the statement:

participant pattern regular expression#
participant donald as "Donald\nDuck" 2
participant "Donald Duck" 4
participant "Donald Duck" as "Donald\nDuck" none
participant  DonaldDuck1Left        as "Donald Duck 1 Right" 2
participant "Donald Duck 2 Left"    as  DonaldDuck2Right 1
participant  DonaldDuck3Left        as "Donald\nDuck\n3\nRight" 2
participant "Donald\nDuck\n4\nLeft" as  DonaldDuck4Right 1
participant "Donald Duck 5"  as "Donald\nDuck\n5" none
participant  A 1
participant  DonaldDuck1Left        as "Donald Duck 1 Right" 2
participant "Donald Duck 2 Left"    as  DonaldDuck2Right 1
participant  DonaldDuck3Left        as "Donald\nDuck\n3\nRight" 2
participant "Donald\nDuck\n4\nLeft" as  DonaldDuck4Right 1
participant "Donald Duck 5" 4
participant  A 1
participant "Donald Duck" 4
participant "Donald Duck" as "Donald\nDuck" none

I think this is not intentional, but probably a bug in regular expressions....

...