Would it be possible to model gates in sequence diagrams?

+1 vote
asked Aug 1, 2020 in Wanted features by Manel (120 points)

I do not see how to model a gate in sequence diagrams referencing to another diagram.

I am aware of the option 'ref over <>' and 'end ref' where you can include a string inside, but it would be nice to be able to add incoming and outgoing messages to the reference body so as to properly model gates to sub-diagrams according to the UML notation.

In the following link you have an example of such in the ref Balance Lookup:

https://creately.com/diagram-type/article/use-gates-sequence-diagrams

Is there a way to properly draw this using PlantUML syntax?

It would be be nice to have this feature included if not.

Thanks for your answers.

commented Aug 5, 2020 by mgrol (3,150 points)

Hi,

not exactly like that, as it is just a box and not a "reference box" but if you may look into the following solution:

This would be the source code.

@startuml
box "sd balance lookup"
  participant "theirLedger" as theirBank
  participant "theirLedger" as theirLedger

  [-> theirBank ++ : getBalance

  [<- theirBank --: balance
end Box
@enduml

BR,

Michael

1 Answer

+1 vote
answered Aug 8, 2020 by anonymous
Thanks for your answer Michael.

I also considered using a box as an alternative and I agree that it is quite a good option and selt descriptive. I found though a cosmetic issue when combining this with other grouping options such as 'alt' or 'group'; in this case the colouring of the box would be hidden by the grouped area.
I find using gates very useful to encapsulate portions of the sequeces for the sake of clarity.

It would be very nice PlantUML supporting this according to the UML notation. I would love a simple syntax like this (just a proposal):

@startuml
participant "teller : ATM" as teller  
participant theirBank
  gate "Balance Lookup" over theirBan
  teller -> : getBalance()
  teller <- : balance
  end gate
@enduml
...