UML sequence diagrams – include

uml

I'm currently doing my OCPJEA assignment.

I have to draw several sequence diagrams for the use cases presented in the documentation. One of the use cases (A) state that after some interaction, the system executes another use case (B).

I've already drawn the diagram for B, is there any way in UML2 to show inclusion, or do I have to duplicate all those interactions into A?

Best Answer

It looks like an official notation for this kind of referencing was introduced with UML v.2 and is called ref

Usually, all your sequence diagrams will contain a label in the upper left corner to identify your diagram. For example: sd:login-verification. Using this label, you can then reference this sequence diagram from within another one by drawing a simple box onto the concerned lifeline.

This box must mention ref in its upper left corner together with the name of the referenced diagram in the middle of the box. In addition, you have to pass those instance(s) that are used within the referenced diagram.

                        |
                        |
  -----------------------------------------------
  |  ref  /                                     |
  |-------                                      |
  |   login-verification(user, token) : bool    |
  |                                             |
  -----------------------------------------------
                        |
                        |

I think that the following article might be quite helpful as it gives a concrete example. Have a look at the section called "Beyond the basics" where they talk about "Referencing another sequence diagram".

Article: UML basics : The sequence diagram