Author Topic: Messages from one sequence diagram to another?  (Read 301 times)

ty.newton

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Messages from one sequence diagram to another?
« on: June 28, 2022, 02:35:25 pm »
Hi,
This is a rehash of a question I asked some time ago.  I'm hoping someone can assist this time around.  I have a couple sequence diagrams and I'd like to call the sequence depicted in one of the diagrams from another diagram.  I have tried to use the Diagram Gate but I hit a problem:
- my Life Lines are Classes that represent applications
- the applications have Operations defined that represent functions that can be called
- to represent one application calling a function of another I use a Message (connecting Life Lines) and select the target application's Operation - that I defined earlier
- when calling another sequence diagram I add a Diagram Gate and connect a Message to it
- the problem I hit is that there doesn't seem to be any way to associate the Diagram Gate with the Operation I want to call in the other sequence diagram (or asociate the other diagram to the Diagram Gate)

Does anyone know a way to reference another sequence diagram from a sequence diagram AND define which Operation is being called?

I also tried dragging the other diagram onto the calling diagram.  This allowed me to easily navigate to the other diagram but I cannot connect a message to it.

I may be using sequence diagrams incorrectly; if what I am trying to do is just plain wrong for UML please let me know.  If it makes a difference, I am using Enterprise Architect v15.1.1526 and have a Corporate Edition license.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11851
  • Karma: +460/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Messages from one sequence diagram to another?
« Reply #1 on: June 28, 2022, 04:09:06 pm »
The way we did is was to associate operations with Interactions that contain a sequence diagram (see the behavior tab)
So a sequence diagram was always a representation of the behavior of a single operation.

That way, if you call an operation on a class, you can find the corresponding sequence diagram.
And because there is a 1:1 relation between operations and sequence diagram, we knew exactly what operations where used where.

Geert

Richard Freggi

  • EA User
  • **
  • Posts: 391
  • Karma: +14/-7
    • View Profile
Re: Messages from one sequence diagram to another?
« Reply #2 on: July 05, 2022, 02:04:24 am »
I haven't done interaction diagrams for several months so working from memory.  If I understand what you want to do I think it's possible but you have to follow UML.
I think you would need to use an interaction use = a combined fragment of REF type.  The interaction use is self-contained so don't write it as a part of a larger interaction diagram and expect to use that snippet in another diagram.  That is not UML.  You need to make a separate complete sequence diagram for the interaction use, then drag it  onto the OTHER sequence diagrams that use it.  Dragging will create a combined fragment of type REF. 

Using classes instead of objects in sequence diagrams can be problematic both in UML proper as well as in Sparx EA specifically.  I'm not sure if your model would be negatively affected by using objects of the application classes for the diagrams.

I think every operation in a class should be used in as many scenarios as possible, so hopefully the cardinality "class operation" : "interaction diagram" (regardless if normal interaction, combined fragment or interaction use) should be 1 .. m and not 1 .. 1.  Otherwise you will have a lot of redundant operations that do similar things in different interactions.

uml-diagrams.org remains the best introduction to UML ... you can find more details here:

https://www.uml-diagrams.org/sequence-diagrams.html#interaction-use

HTH!
« Last Edit: July 05, 2022, 02:14:03 am by Richard Freggi »