Implementation Expansion region / Loop node with Plant

+1 vote
asked Mar 18, 2022 in Question / help by him
Hi, how do I represent the following loop in  this Activity diagram with Plant UML? (Especially, using Expansion node and Loop node)

https://stackoverflow.com/questions/37710695/how-do-i-represent-a-loop-in-an-activity-diagram

1 Answer

0 votes
answered Mar 18, 2022 by The-Lu (64,340 points)
 
Best answer

Hello H.,

To achieve this `Expansion node and Loop node`:

Source:

You can use expansionInput/Output  as (here is an attempts...):

@startuml
mainframe act FolderDocumentER
state Folder {
  state "<<iterative>>" as fi <<expansionInput>>
  state "Folder" as fo <<expansionOutput>>
  state Document {
    state "<<iterative>>" as di  <<expansionInput>>
    state "Document" as do <<expansionOutput>>
    state c1 <<choice>>
    state c2 <<choice>>
    state x : Action X
    di --> c1
    c1 -r-> x : [Document invalid]
    c1 --> c2 : [Document valid]
    x --> c2
    c2 --> do
    do --> fo
  }
}
[*] --> fi
fi --> di
fo --> [*]
@enduml

See also doc. here:

If that can help,
Regards,
Th.

commented Mar 19, 2022 by him
Thank you for your helping.
But, that is in a state-machine-diagrams. So, 'Action X' block has a line in middle as a state.
 I want to represent 'Expansion resion node' in a activity-diagrams. Is not support?
commented Mar 19, 2022 by The-Lu (64,340 points)

Hello H.,

For that, you can add on State diagram:

hide empty description
state "Action X" as x

As:

@startuml
hide empty description
mainframe act FolderDocumentER
state Folder {
  state "<<iterative>>" as fi <<expansionInput>>
  state "Folder" as fo <<expansionOutput>>
  state Document {
    state "<<iterative>>" as di  <<expansionInput>>
    state "Document" as do <<expansionOutput>>
    state c1 <<choice>>
    state c2 <<choice>>
    state "Action X" as x
    di --> c1
    c1 -r-> x : [Document invalid]
    c1 --> c2 : [Document valid]
    x --> c2
    c2 --> do
    do --> fo
  }
}
[*] --> fi
fi --> di
fo --> [*]
@enduml

If that can help,
Regards,
Th.

...