Includes feature doesn't work well with activity diagrams

0 votes
asked Mar 16, 2021 in Bug by anonymous
edited Mar 16, 2021

When a main activity file includes two other activity files, in which first one also includes second one, then main activity diagram doesn't connect with the second one, letting line without connection:

@startuml
'https://plantuml.com/activity-diagram-beta

|Swimline1|
start
:preStep;
if (condition?) then (yes)
    !include activity1.puml
else (no)
    !include activity2.puml
endif

@enduml

1 Answer

0 votes
answered Mar 17, 2021 by The-Lu (64,340 points)

Hello A.,

in which first one also includes second one

In this case, could you test by changing 

!include

by

!include_many

See also doc. here: https://plantuml.com/preprocessing#393335a6fd28a804

If that can help,
Regards,
Th.

commented Mar 18, 2021 by anonymous
Hi yes!!! After replacing include by include_all in all places, lines are linked correctly between included diagrams. Many thanks!
commented Mar 18, 2021 by anonymous
Well after checking result closer, I realised diagrams are included multiple times... In fact this is not the desired behaviour. It is true that some diagrams are included several times, from several other included files, but I want it to be displayed just once. Is this possible?
commented Mar 18, 2021 by The-Lu (64,340 points)

Hello A.,

For that use this directive:

!include_once

See also doc. here: https://plantuml.com/preprocessing#393335a6fd28a804
Regards,
Th.

commented Mar 18, 2021 by anonymous
Hi but with include_once, then you will get an error if the file is included several times. My scenario is:

if (A) then
   include activityDiagram1
else

   include activityDiagram2

endif

And activityDiagram1 is something like:

step1

step2

include activityDiagram2

So as you see, activityDiagram2 is included twice, from main activity diagram and from activityDiagram1. So if I use include_many, then it will be included several times, and if I use include_once, then I will get an error in main activity diagram saying that activityDiagram2 is already included by activityDiagram1.

So I want activityDiagrams included only once, but well connected. In my case, I'm working with integration patterns so I'm trying to represent routes with PlantUML activity diagrams.
...