message ends in the UML 2 metamodel

message ends in the UML 2 metamodel

From: Aline Lúcia Baroni ^lt;>
Date: Wed 05 Oct 2005 - 18:28:37 BST
Message-ID: <000001c5ca4e$959559a0$8c01a8c0@fujitsupc>
Dear all,

Considering the BasicInteractions sub-package of the Interactions, in the UML 2 superstructure, and using the Lifelines and Messages diagrams (on page 501 and 502), I would like to build some OCL expressions for:
getting all the Messages a Lifeline is sending and all Messages a Lifeline is receiving.

I can easily write one expression to get all the Messages, starting in the Lifeline context, as follows:
messages(): Set(Message) =   
  -> collect (os: OccurrenceSpecification |
  -> collect (m: MessageOccurrenceSpecification | m.message) -> asSet

Ok! Now let´s supposed I want to get only the Messages received by one Lifeline, using the set of all Messages.
Looking at the metamodel, it seems I can go from the Message to its MessageEnd, through the role receiveEvent. The problem here is that I am missing something. It seems to me that there is no way to differentiate which ends are sending and which ones are receiving the Message. In fact, as MessageEnd is abstract, in this case I am refering to MessageOccurrenceSpecification.
How can I distinguish if a MessageOccurrenceSpecification is related to the reception or to the sending of the Message? Is the MM wrong?

Maybe is there another easiest way of getting all the messages related to a Lifeline and maybe also for getting just the messages that were sent or received by this lifeline.

Thanks for any help or comments! 
Aline L. Baroni
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.9/118 - Release Date: 03-10-2005
Received on Thu Oct 06 09:19:32 2005