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: 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


Syntax error

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

group sd NameOfDiagram

Alice -> Bob: sendMessage

Bob -> Alice: sendResponse


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!


3 Answers

–1 vote
answered Dec 12, 2017 by mgrol (2,810 points)


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:

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

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:

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

Which looks like this:

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

Best Regards,


commented Jan 24, 2018 by Anthony-Gaudino (5,740 points)
What OP wants is a frame around whole diagram, like the image in:

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

I also created another issue of the same problem:
–1 vote
answered May 1 by ziriguidum
frame "sd NameOfDiagram" {

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

0 votes
answered Sep 4 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.