How to constrain the Message "tail" in Sequence Diagram?

UML related questions and discussions

Moderator: Moderators

How to constrain the Message "tail" in Sequence Diagram?

Postby » Mon Sep 23, 2013 12:23 pm

I have tried to find a simple solution to this problem, and I'm stuck. It's been a while since I've used UML for anything and my searches here on the forum and through Google have not found me an answer yet. I'd appreciate a little nudge in the right direction for what I'm doing.

See the attached image of a sequence diagram that demonstrates the issue I'm trying to solve.

Over in a Class Diagram, I set the Generalizations:
:Lester Flatt ---------|> :Bluegrass Player (isAbstract = true)
:Earl Scruggs---------|>

Then on a Sequence Diagram objects with lifelines are created for:
:Jimi Hendrix
:Lester Flatt (Generalization points to :Bluegrass Player)
:Earl Scruggs (Generalization points to :Bluegrass Player)
:Bluegrass Band

I create a message from :Lester Flatt to :Bluegrass Band
I use that message again from :Earl Scruggs to :Bluegrass Band
This is desired behavior
:Bluegrass Band owns the message at the "tip" end of the message

I can also use the same message from :Jimi Hendrix to :Bluegrass Band
This is NOT desired behavior
I want to prevent :Jimi Hendrix from sending the message "I_Play_Bluegrass()" to :Bluegrass Band

I'm sure that the answer is out there somewhere. The myriad options of MagicDraw hint that it may have something to do with Visibility, Stereotypes, or Constraints.
I have not, however, been able to control the "tail" end of the message.

Thanks in advance for your help,
You do not have the required permissions to view the files attached to this post.
Forum Beginner
Forum Beginner
Posts: 47
Posts Rating:2
Joined: Wed Jul 24, 2013 10:24 am

Re: How to constrain the Message "tail" in Sequence Diagram?

Postby vytdag » Tue Sep 24, 2013 8:42 am

Hi William,

unfortunately Magic Draw does not provide strict rules with regards to Message relationship connection rules. Basically it would be quite hard to edit the model if there would be very strict connection rules (e.g. changing visibility option to private, when there are some messages which require public access).

The basic idea how Magic Draw proposes to handle such situations is by using validation constraints, which show when some model elements are used inappropriately. You may create your own OCL constraint and use it as validation rule. In such cases if :Jimi Hendrix would try to send the message "I_Play_Bluegrass()" the message would be marked as error in the model. The modeler should prevent this situation.

There is Call from Foreign Classifier validation rule in the UML correctness constraints validation suite which is also based on OCL, and checks if the private operation is not called from foreign classifier. Maybe it would be possible to use it for your situation.

Let me know if it solves your problem.
Kind Regards,
Vytautas Dagilis
No Magic Customer Support
Customer Support
Customer Support
Posts: 18
Posts Rating:9
Joined: Tue Dec 11, 2012 2:26 am

Re: How to constrain the Message "tail" in Sequence Diagram?

Postby » Tue Aug 29, 2017 10:18 am


An alternate method than OCL would be to have Bluegrass Bands Operation take an argument of type Bluegrass Player. Lester Flatt and Earl Scruggs could pass themselves since they are specializations of Bluegrass Player, Jimi Hendrix could not pass himself, he would fail the type check. Hopefully adding an argument to I_Play_Bluegrass() to make it I_Play_Bluegrass(bluegrassPlayer : Bluegrass Player ) is an allowable solution. Note that this does not prevent Jimi Hendix from calling I_Play_Bluegrass(Earl Scruggs) on Bluegrass Band. To truly get that behavior limitation other than OCL, you are correct in that you need to declare the VisibilityKind of the I_Play_Bluegrass() operation to be "Package", you also have to declare Lester Flatt and Earl Scruggs to be in the same Package as Bluegrass Band (so they have visibility), and make sure Jimi Hendrix class is not declared in the same package as Bluegrass Band (so they will not have visibility). I think this second option is worse than the first, but you know your system design best. Hope this helps.
Forum Newbie
Forum Newbie
Posts: 21
Posts Rating:1
Joined: Mon Jul 24, 2017 4:15 pm

Return to Software Modeling (UML)

Who is online

Users browsing this forum: No registered users and 1 guest