Sequence diagram sub-diagrams

+1 vote
asked Dec 10, 2017 in To be sorted by Luke Powell
According to the documentation, it is possible to use ref frames to reference subdiagrams. However, despite searching very thoroughly I feel like I must be missing something:I can't find the proper way to declare the subdiagram to be referenced! According to the UML reference I have and multiple pages I've seen online (example: https://www.ibm.com/developerworks/rational/library/3101.html#N101C6) the sequence diagram being referenced should be enclosed in a frame labeled "sd NameOfDiagram". I haven't found a good way to do this though.

Some things that I've tried

(Maybe it's an undocumented feature)

sd NameOfDiagram

Alice -> Bob: sendMessage

Bob -> Alice: sendResponse

end

Syntax error

(Well, maybe I can just use the custom frame)

group sd NameOfDiagram

Alice -> Bob: sendMessage

Bob -> Alice: sendResponse

end

Close! But the actors are declared outside the frame, rather than inside it.

Well, maybe I just declare it as a folder

folder "sd NameOfDiagram" {

Alice -> Bob: sendMessage

Bob -> Alice: sendResponse

}

Well, everything's inside the folder, but that's a class diagram now, not a sequence diagram!

ARGH!

3 Answers

–1 vote
answered Dec 12, 2017 by mgrol (3,150 points)

Hi,

I am not quite sure if I got you right.

A reference will not draw you a subdiagramm, meaning something like a "picture in picture" feature.

To define a reference you need to declare a ref box:

@startuml
Alice -> Bob : hello
ref over Bob: Here we have\nan external process
Alice <-- Bob: hello

Alice -> Bob : Tell me something
ref over Bob
We have an external process
in a multiline "box"
end ref
Alice <-- Bob: something
@enduml

That would look like this:

The group feature is, as you already figured out, also possible. However, this would also not satisfy your needs.

This is also possible, if you can "live" with the actor at the bottom:

@startuml
Alice -> Bob : hello
group ref
create Eve
Bob -> Eve ++: gossip about hello
Bob <-- Eve --: laugh
destroy Eve
end group
Alice <-- Bob : hello
@enduml

Which looks like this:

You can of course try to tweak with the option "hide footbox".

Best Regards,

Michael

commented Jan 24, 2018 by Anthony-Gaudino (5,720 points)
What OP wants is a frame around whole diagram, like the image in: https://www.ibm.com/developerworks/rational/library/content/RationalEdge/feb04/3101_figure15.jpg

Notice that there's a frame called "sd Balance Lookup" enclosing the whole diagram.

I also created another issue of the same problem: http://forum.plantuml.net/7025
–1 vote
answered May 1, 2020 by ziriguidum
frame "sd NameOfDiagram" {

    Alice -> Bob: sendMessage
    Bob -> Alice: sendResponse

}
+1 vote
answered Sep 4, 2020 by kj-is-escape (140 points)

This is an old question but as it is the first one to appear in google I think it is worth pointing out the real solution to this is just adding the word mainframe.

mainframe "sd NameOfDiagram"

    Alice -> Bob: sendMessage
    Bob -> Alice: sendResponse

will give the desired output.

...