Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Sequence Diagrams - creating a message which source and target is the same lifeline
Sequence Diagrams - creating a message which source and target is the same lifeline [message #477056] Tue, 11 March 2008 02:42 Go to next message
Eclipse UserFriend
Originally posted by: the.vreid.googlemail.com

Hi list,

i am currently working on small tool(bachelor exam) which creates
sequence diagrams from java sourcecode. I am able to create most of the
elements i need (Lifelines, Messages, Occurrence/Execution
Specifications,...). I am tweaking my tool so the IBM Rational Software
Modeler has no problem visualizing the model it creates. Most of my
"knowledge" comes from looking at models create by IBM Rat. Soft. Mod.
and other tools (Topcased UML, MagicDraw CE, ..). Although i've come
pretty far, i hit a dead end. I can't figure out how to create a message
from a lifeline back to itself so that the visualization shows a new
Behavior Occurrence Specification. I attached the code i use to create a
messages and to create a new Behavioral Occurrence Specification (BOS).
After the creation of the BOS i invoke
"recvExecutionSpec.getCovereds().add(lifelineSend);" (being
recvExecutionSpec the new BOS and lifelineSend the lifeline it was
created from (although only the name is used in the actual createBOS
method). Is there anything i have to look for when i want to create a
"nested" BOS to create a recursive message? I noticed that the IBM Rat.
Soft. Mod. creates Execution Events and Execution Occurrence
Specifications if i create a model visually, are there the key?

Aside from the actual question i would be very grateful for any links
and snippets (you may be able to release) which deal with the
"programmatically" creation of the UML models (especially sequence
diagram). I think i exhausted the material a newbie is able to google
and find on this newsgroup :/
Is there maybe any information available in the uml spec that i missed?
I also want to apologize for my bad english since i'm from germany.

Regards,

Steffen
Re: Sequence Diagrams - creating a message which source and target is the same lifeline [message #477062 is a reply to message #477056] Tue, 11 March 2008 18:09 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Steffen,

Are you perhaps talking about creating BehaviorExecutionSpecification? I
don't think there is such a thing as a BehavioralOccurrenceSpecification (
just MessageOccurrenceSpecification and ExecutionOccurrenceSpecification ).

Also, I did not see the code you mentioned you attached.

The UML spec is the best way to figure out the metamodel (although tough to
decipher sometimes). IBM's RSx follows the spec very closely so that is
also a good reference (should be using something later than 6.x).

Cheers,
- James.




"Steffen Rohr" <the.vreid@googlemail.com> wrote in message
news:fr4rjj$omh$1@build.eclipse.org...
> Hi list,
>
> i am currently working on small tool(bachelor exam) which creates sequence
> diagrams from java sourcecode. I am able to create most of the elements i
> need (Lifelines, Messages, Occurrence/Execution Specifications,...). I am
> tweaking my tool so the IBM Rational Software Modeler has no problem
> visualizing the model it creates. Most of my "knowledge" comes from
> looking at models create by IBM Rat. Soft. Mod. and other tools (Topcased
> UML, MagicDraw CE, ..). Although i've come pretty far, i hit a dead end. I
> can't figure out how to create a message from a lifeline back to itself so
> that the visualization shows a new Behavior Occurrence Specification. I
> attached the code i use to create a messages and to create a new
> Behavioral Occurrence Specification (BOS). After the creation of the BOS i
> invoke "recvExecutionSpec.getCovereds().add(lifelineSend);" (being
> recvExecutionSpec the new BOS and lifelineSend the lifeline it was created
> from (although only the name is used in the actual createBOS method). Is
> there anything i have to look for when i want to create a "nested" BOS to
> create a recursive message? I noticed that the IBM Rat. Soft. Mod. creates
> Execution Events and Execution Occurrence Specifications if i create a
> model visually, are there the key?
>
> Aside from the actual question i would be very grateful for any links and
> snippets (you may be able to release) which deal with the
> "programmatically" creation of the UML models (especially sequence
> diagram). I think i exhausted the material a newbie is able to google and
> find on this newsgroup :/
> Is there maybe any information available in the uml spec that i missed? I
> also want to apologize for my bad english since i'm from germany.
>
> Regards,
>
> Steffen
Re: Sequence Diagrams - creating a message which source and target is the same lifeline [message #477067 is a reply to message #477062] Wed, 12 March 2008 02:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: the.vreid.googlemail.com

Hi James,

James Bruck schrieb:
> Hi Steffen,
>
> Are you perhaps talking about creating BehaviorExecutionSpecification? I
> don't think there is such a thing as a BehavioralOccurrenceSpecification (
> just MessageOccurrenceSpecification and ExecutionOccurrenceSpecification ).
>

I mentioned it ones as "BehavioralOccurrenceSpecification", that was a
typo, i ment BehaviorOccurrenceSpecification.

> Also, I did not see the code you mentioned you attached.

i can't see my attachments either :/ This time i will attach the
sourcecode directly in the email.


>
> The UML spec is the best way to figure out the metamodel (although tough to
> decipher sometimes). IBM's RSx follows the spec very closely so that is
> also a good reference (should be using something later than 6.x).
>

I will try to summarize my steps to create a message between two
separate lifelines. First we need two Lifeslines, then we need a
BehaviorOccurrenceSpecification tied to each lifeline, then we create a
Message an the corresponding MessageOccurrenceSpecifications, we tie the
MessageOccurrenceSpecification to the Lifelines and set the send and
receive events of the Message (the MessageOccurrenceSpecifications) at
last we create a SendOperationEvent and a ReceiveOperationEvent which
hold the Operation which was invoked and tie the Events to the
corresponding MessageOccurrenceSpecifications. This schould be the right
approach because IBM Rational Software Modeler is able to visualize my
basic sequence diagrams created this way.

My question is basicly: why does the IBM RSM create
ExecutionOccurrenceSpecifications and ExecutionEvents if a Message from
a Lifeline to itself is created via the sequence diagram editor (of the
IBM RSM)?

I work very closely with the models created from "IBM Rational Software
Modeler 7.0.5", i also noticed that the models created from it are very
close to the speicfication. But i can't figure out every detail.

> Cheers,
> - James.
>
>
>
>
> "Steffen Rohr" <the.vreid@googlemail.com> wrote in message
> news:fr4rjj$omh$1@build.eclipse.org...

(formatting is just sick, try importing it in eclipse an formatting)

----- begin createMessage3 -----
public static org.eclipse.uml2.uml.Message createMessage3(
org.eclipse.uml2.uml.Interaction interaction,
String messageSignature,
org.eclipse.uml2.uml.Lifeline lifelineSend,
org.eclipse.uml2.uml.Lifeline lifelineRecv,
org.eclipse.uml2.uml.BehaviorExecutionSpecification sendExecutionSpec,
org.eclipse.uml2.uml.BehaviorExecutionSpecification recvExecutionSpec,
org.eclipse.uml2.uml.Event sendEvt,
org.eclipse.uml2.uml.Event recvEvt) {

org.eclipse.uml2.uml.Message message = interaction
.createMessage(messageSignature);
org.eclipse.uml2.uml.MessageOccurrenceSpecification sendEventOccur =
(org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
.createFragment("send " + messageSignature,
UMLPackage.eINSTANCE
.getMessageOccurrenceSpecification());
sendEventOccur.getCovereds().add(lifelineSend);
sendEventOccur.setMessage(message);
if (sendExecutionSpec.getStart() == null)
sendExecutionSpec.setStart(sendEventOccur);
sendExecutionSpec.setFinish(sendEventOccur);
org.eclipse.uml2.uml.MessageOccurrenceSpecification recvEventOccur =
(org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
.createFragment("receive " + messageSignature,
UMLPackage.eINSTANCE
.getMessageOccurrenceSpecification());
recvEventOccur.getCovereds().add(lifelineRecv);
recvEventOccur.setMessage(message);
if (recvExecutionSpec.getStart() == null)
recvExecutionSpec.setStart(recvEventOccur);
recvExecutionSpec.setFinish(recvEventOccur);

message.setSendEvent(sendEventOccur);
message.setReceiveEvent(recvEventOccur);

sendEventOccur.setEvent(sendEvt);
recvEventOccur.setEvent(recvEvt);

return message;
}
----- end createMessage3 -----

----- begin createBehaviorExecutionSpecification -----
public static BehaviorExecutionSpecification
createBehaviorExecutionSpecification(
org.eclipse.uml2.uml.Interaction interaction,
org.eclipse.uml2.uml.Lifeline lifeline) {
return (org.eclipse.uml2.uml.BehaviorExecutionSpecification) interaction
.createFragment(lifeline.getName(), UMLPackage.eINSTANCE
.getBehaviorExecutionSpecification());
}
----- end createBehaviorExecutionSpecification -----

>> Hi list,
>>
>> i am currently working on small tool(bachelor exam) which creates sequence
>> diagrams from java sourcecode. I am able to create most of the elements i
>> need (Lifelines, Messages, Occurrence/Execution Specifications,...). I am
>> tweaking my tool so the IBM Rational Software Modeler has no problem
>> visualizing the model it creates. Most of my "knowledge" comes from
>> looking at models create by IBM Rat. Soft. Mod. and other tools (Topcased
>> UML, MagicDraw CE, ..). Although i've come pretty far, i hit a dead end. I
>> can't figure out how to create a message from a lifeline back to itself so
>> that the visualization shows a new Behavior Occurrence Specification. I
>> attached the code i use to create a messages and to create a new
>> Behavioral Occurrence Specification (BOS). After the creation of the BOS i
>> invoke "recvExecutionSpec.getCovereds().add(lifelineSend);" (being
>> recvExecutionSpec the new BOS and lifelineSend the lifeline it was created
>> from (although only the name is used in the actual createBOS method). Is
>> there anything i have to look for when i want to create a "nested" BOS to
>> create a recursive message? I noticed that the IBM Rat. Soft. Mod. creates
>> Execution Events and Execution Occurrence Specifications if i create a
>> model visually, are there the key?
>>
>> Aside from the actual question i would be very grateful for any links and
>> snippets (you may be able to release) which deal with the
>> "programmatically" creation of the UML models (especially sequence
>> diagram). I think i exhausted the material a newbie is able to google and
>> find on this newsgroup :/
>> Is there maybe any information available in the uml spec that i missed? I
>> also want to apologize for my bad english since i'm from germany.
>>
>> Regards,
>>
>> Steffen
>
>
Re: Sequence Diagrams - creating a message which source and target is the same lifeline [message #477085 is a reply to message #477067] Wed, 12 March 2008 19:26 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Steffen,

There is no such meta-type called 'BehaviorOccurrenceSpecification' in UML
2.1.x. From what you describe below I think you are referring to an
ExecutionOccurrenceSpecification ( ...unless I'm completely out to
lunch ).

Your code makes use of BehaviorExecutionSpecification and
ExecutionOccurrenceSpecification , not BehaviorOccurrenceSpecification.

In any event, your question is about why RSA creates an
ExecutionOccurrenceSpecification when the message is starting and ending
from the same lifeline. From my understanding, there is no hard
requirement to actually show or create the
ExecutionOccurrenceSpecifications. I believe RSA creates an
ExecutionOccurrenceSpecification to model the behavior of the function being
called. Assume you had fn1() and fn2() on some Class C1. If fn1() calls
fn2() as part of its behavior I believe you would get into the situation you
describe. In that case the ExecutionOccurrenceSpecification would indicate
that the behavior of fn2() is being invoked. You would then see a return
message but I believe RSA has the ability to filter out return messages from
being displayed.

I think this is what you were getting at.

Cheers,
- James.


"Steffen Rohr" <the.vreid@googlemail.com> wrote in message
news:fr7ef3$ep8$1@build.eclipse.org...
> Hi James,
>
> James Bruck schrieb:
>> Hi Steffen,
>>
>> Are you perhaps talking about creating BehaviorExecutionSpecification? I
>> don't think there is such a thing as a BehavioralOccurrenceSpecification
>> ( just MessageOccurrenceSpecification and
>> ExecutionOccurrenceSpecification ).
>>
>
> I mentioned it ones as "BehavioralOccurrenceSpecification", that was a
> typo, i ment BehaviorOccurrenceSpecification.
>
>> Also, I did not see the code you mentioned you attached.
>
> i can't see my attachments either :/ This time i will attach the
> sourcecode directly in the email.
>
>
>>
>> The UML spec is the best way to figure out the metamodel (although tough
>> to decipher sometimes). IBM's RSx follows the spec very closely so that
>> is also a good reference (should be using something later than 6.x).
>>
>
> I will try to summarize my steps to create a message between two separate
> lifelines. First we need two Lifeslines, then we need a
> BehaviorOccurrenceSpecification tied to each lifeline, then we create a
> Message an the corresponding MessageOccurrenceSpecifications, we tie the
> MessageOccurrenceSpecification to the Lifelines and set the send and
> receive events of the Message (the MessageOccurrenceSpecifications) at
> last we create a SendOperationEvent and a ReceiveOperationEvent which hold
> the Operation which was invoked and tie the Events to the corresponding
> MessageOccurrenceSpecifications. This schould be the right approach
> because IBM Rational Software Modeler is able to visualize my basic
> sequence diagrams created this way.
>
> My question is basicly: why does the IBM RSM create
> ExecutionOccurrenceSpecifications and ExecutionEvents if a Message from a
> Lifeline to itself is created via the sequence diagram editor (of the IBM
> RSM)?
>
> I work very closely with the models created from "IBM Rational Software
> Modeler 7.0.5", i also noticed that the models created from it are very
> close to the speicfication. But i can't figure out every detail.
>
>> Cheers,
>> - James.
>>
>>
>>
>>
>> "Steffen Rohr" <the.vreid@googlemail.com> wrote in message
>> news:fr4rjj$omh$1@build.eclipse.org...
>
> (formatting is just sick, try importing it in eclipse an formatting)
>
> ----- begin createMessage3 -----
> public static org.eclipse.uml2.uml.Message createMessage3(
> org.eclipse.uml2.uml.Interaction interaction,
> String messageSignature,
> org.eclipse.uml2.uml.Lifeline lifelineSend,
> org.eclipse.uml2.uml.Lifeline lifelineRecv,
> org.eclipse.uml2.uml.BehaviorExecutionSpecification sendExecutionSpec,
> org.eclipse.uml2.uml.BehaviorExecutionSpecification recvExecutionSpec,
> org.eclipse.uml2.uml.Event sendEvt,
> org.eclipse.uml2.uml.Event recvEvt) {
>
> org.eclipse.uml2.uml.Message message = interaction
> .createMessage(messageSignature);
> org.eclipse.uml2.uml.MessageOccurrenceSpecification sendEventOccur =
> (org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
> .createFragment("send " + messageSignature,
> UMLPackage.eINSTANCE
> .getMessageOccurrenceSpecification());
> sendEventOccur.getCovereds().add(lifelineSend);
> sendEventOccur.setMessage(message);
> if (sendExecutionSpec.getStart() == null)
> sendExecutionSpec.setStart(sendEventOccur);
> sendExecutionSpec.setFinish(sendEventOccur);
> org.eclipse.uml2.uml.MessageOccurrenceSpecification recvEventOccur =
> (org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
> .createFragment("receive " + messageSignature,
> UMLPackage.eINSTANCE
> .getMessageOccurrenceSpecification());
> recvEventOccur.getCovereds().add(lifelineRecv);
> recvEventOccur.setMessage(message);
> if (recvExecutionSpec.getStart() == null)
> recvExecutionSpec.setStart(recvEventOccur);
> recvExecutionSpec.setFinish(recvEventOccur);
>
> message.setSendEvent(sendEventOccur);
> message.setReceiveEvent(recvEventOccur);
>
> sendEventOccur.setEvent(sendEvt);
> recvEventOccur.setEvent(recvEvt);
>
> return message;
> }
> ----- end createMessage3 -----
>
> ----- begin createBehaviorExecutionSpecification -----
> public static BehaviorExecutionSpecification
> createBehaviorExecutionSpecification(
> org.eclipse.uml2.uml.Interaction interaction,
> org.eclipse.uml2.uml.Lifeline lifeline) {
> return (org.eclipse.uml2.uml.BehaviorExecutionSpecification) interaction
> .createFragment(lifeline.getName(), UMLPackage.eINSTANCE
> .getBehaviorExecutionSpecification());
> }
> ----- end createBehaviorExecutionSpecification -----
>
>>> Hi list,
>>>
>>> i am currently working on small tool(bachelor exam) which creates
>>> sequence diagrams from java sourcecode. I am able to create most of the
>>> elements i need (Lifelines, Messages, Occurrence/Execution
>>> Specifications,...). I am tweaking my tool so the IBM Rational Software
>>> Modeler has no problem visualizing the model it creates. Most of my
>>> "knowledge" comes from looking at models create by IBM Rat. Soft. Mod.
>>> and other tools (Topcased UML, MagicDraw CE, ..). Although i've come
>>> pretty far, i hit a dead end. I can't figure out how to create a message
>>> from a lifeline back to itself so that the visualization shows a new
>>> Behavior Occurrence Specification. I attached the code i use to create a
>>> messages and to create a new Behavioral Occurrence Specification (BOS).
>>> After the creation of the BOS i invoke
>>> "recvExecutionSpec.getCovereds().add(lifelineSend);" (being
>>> recvExecutionSpec the new BOS and lifelineSend the lifeline it was
>>> created from (although only the name is used in the actual createBOS
>>> method). Is there anything i have to look for when i want to create a
>>> "nested" BOS to create a recursive message? I noticed that the IBM Rat.
>>> Soft. Mod. creates Execution Events and Execution Occurrence
>>> Specifications if i create a model visually, are there the key?
>>>
>>> Aside from the actual question i would be very grateful for any links
>>> and snippets (you may be able to release) which deal with the
>>> "programmatically" creation of the UML models (especially sequence
>>> diagram). I think i exhausted the material a newbie is able to google
>>> and find on this newsgroup :/
>>> Is there maybe any information available in the uml spec that i missed?
>>> I also want to apologize for my bad english since i'm from germany.
>>>
>>> Regards,
>>>
>>> Steffen
>>
Re: Sequence Diagrams - creating a message which source and target is the same lifeline [message #626182 is a reply to message #477056] Tue, 11 March 2008 18:09 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Steffen,

Are you perhaps talking about creating BehaviorExecutionSpecification? I
don't think there is such a thing as a BehavioralOccurrenceSpecification (
just MessageOccurrenceSpecification and ExecutionOccurrenceSpecification ).

Also, I did not see the code you mentioned you attached.

The UML spec is the best way to figure out the metamodel (although tough to
decipher sometimes). IBM's RSx follows the spec very closely so that is
also a good reference (should be using something later than 6.x).

Cheers,
- James.




"Steffen Rohr" <the.vreid@googlemail.com> wrote in message
news:fr4rjj$omh$1@build.eclipse.org...
> Hi list,
>
> i am currently working on small tool(bachelor exam) which creates sequence
> diagrams from java sourcecode. I am able to create most of the elements i
> need (Lifelines, Messages, Occurrence/Execution Specifications,...). I am
> tweaking my tool so the IBM Rational Software Modeler has no problem
> visualizing the model it creates. Most of my "knowledge" comes from
> looking at models create by IBM Rat. Soft. Mod. and other tools (Topcased
> UML, MagicDraw CE, ..). Although i've come pretty far, i hit a dead end. I
> can't figure out how to create a message from a lifeline back to itself so
> that the visualization shows a new Behavior Occurrence Specification. I
> attached the code i use to create a messages and to create a new
> Behavioral Occurrence Specification (BOS). After the creation of the BOS i
> invoke "recvExecutionSpec.getCovereds().add(lifelineSend);" (being
> recvExecutionSpec the new BOS and lifelineSend the lifeline it was created
> from (although only the name is used in the actual createBOS method). Is
> there anything i have to look for when i want to create a "nested" BOS to
> create a recursive message? I noticed that the IBM Rat. Soft. Mod. creates
> Execution Events and Execution Occurrence Specifications if i create a
> model visually, are there the key?
>
> Aside from the actual question i would be very grateful for any links and
> snippets (you may be able to release) which deal with the
> "programmatically" creation of the UML models (especially sequence
> diagram). I think i exhausted the material a newbie is able to google and
> find on this newsgroup :/
> Is there maybe any information available in the uml spec that i missed? I
> also want to apologize for my bad english since i'm from germany.
>
> Regards,
>
> Steffen
Re: Sequence Diagrams - creating a message which source and target is the same lifeline [message #626194 is a reply to message #477062] Wed, 12 March 2008 02:16 Go to previous message
Eclipse UserFriend
Originally posted by: the.vreid.googlemail.com

Hi James,

James Bruck schrieb:
> Hi Steffen,
>
> Are you perhaps talking about creating BehaviorExecutionSpecification? I
> don't think there is such a thing as a BehavioralOccurrenceSpecification (
> just MessageOccurrenceSpecification and ExecutionOccurrenceSpecification ).
>

I mentioned it ones as "BehavioralOccurrenceSpecification", that was a
typo, i ment BehaviorOccurrenceSpecification.

> Also, I did not see the code you mentioned you attached.

i can't see my attachments either :/ This time i will attach the
sourcecode directly in the email.


>
> The UML spec is the best way to figure out the metamodel (although tough to
> decipher sometimes). IBM's RSx follows the spec very closely so that is
> also a good reference (should be using something later than 6.x).
>

I will try to summarize my steps to create a message between two
separate lifelines. First we need two Lifeslines, then we need a
BehaviorOccurrenceSpecification tied to each lifeline, then we create a
Message an the corresponding MessageOccurrenceSpecifications, we tie the
MessageOccurrenceSpecification to the Lifelines and set the send and
receive events of the Message (the MessageOccurrenceSpecifications) at
last we create a SendOperationEvent and a ReceiveOperationEvent which
hold the Operation which was invoked and tie the Events to the
corresponding MessageOccurrenceSpecifications. This schould be the right
approach because IBM Rational Software Modeler is able to visualize my
basic sequence diagrams created this way.

My question is basicly: why does the IBM RSM create
ExecutionOccurrenceSpecifications and ExecutionEvents if a Message from
a Lifeline to itself is created via the sequence diagram editor (of the
IBM RSM)?

I work very closely with the models created from "IBM Rational Software
Modeler 7.0.5", i also noticed that the models created from it are very
close to the speicfication. But i can't figure out every detail.

> Cheers,
> - James.
>
>
>
>
> "Steffen Rohr" <the.vreid@googlemail.com> wrote in message
> news:fr4rjj$omh$1@build.eclipse.org...

(formatting is just sick, try importing it in eclipse an formatting)

----- begin createMessage3 -----
public static org.eclipse.uml2.uml.Message createMessage3(
org.eclipse.uml2.uml.Interaction interaction,
String messageSignature,
org.eclipse.uml2.uml.Lifeline lifelineSend,
org.eclipse.uml2.uml.Lifeline lifelineRecv,
org.eclipse.uml2.uml.BehaviorExecutionSpecification sendExecutionSpec,
org.eclipse.uml2.uml.BehaviorExecutionSpecification recvExecutionSpec,
org.eclipse.uml2.uml.Event sendEvt,
org.eclipse.uml2.uml.Event recvEvt) {

org.eclipse.uml2.uml.Message message = interaction
.createMessage(messageSignature);
org.eclipse.uml2.uml.MessageOccurrenceSpecification sendEventOccur =
(org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
.createFragment("send " + messageSignature,
UMLPackage.eINSTANCE
.getMessageOccurrenceSpecification());
sendEventOccur.getCovereds().add(lifelineSend);
sendEventOccur.setMessage(message);
if (sendExecutionSpec.getStart() == null)
sendExecutionSpec.setStart(sendEventOccur);
sendExecutionSpec.setFinish(sendEventOccur);
org.eclipse.uml2.uml.MessageOccurrenceSpecification recvEventOccur =
(org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
.createFragment("receive " + messageSignature,
UMLPackage.eINSTANCE
.getMessageOccurrenceSpecification());
recvEventOccur.getCovereds().add(lifelineRecv);
recvEventOccur.setMessage(message);
if (recvExecutionSpec.getStart() == null)
recvExecutionSpec.setStart(recvEventOccur);
recvExecutionSpec.setFinish(recvEventOccur);

message.setSendEvent(sendEventOccur);
message.setReceiveEvent(recvEventOccur);

sendEventOccur.setEvent(sendEvt);
recvEventOccur.setEvent(recvEvt);

return message;
}
----- end createMessage3 -----

----- begin createBehaviorExecutionSpecification -----
public static BehaviorExecutionSpecification
createBehaviorExecutionSpecification(
org.eclipse.uml2.uml.Interaction interaction,
org.eclipse.uml2.uml.Lifeline lifeline) {
return (org.eclipse.uml2.uml.BehaviorExecutionSpecification) interaction
.createFragment(lifeline.getName(), UMLPackage.eINSTANCE
.getBehaviorExecutionSpecification());
}
----- end createBehaviorExecutionSpecification -----

>> Hi list,
>>
>> i am currently working on small tool(bachelor exam) which creates sequence
>> diagrams from java sourcecode. I am able to create most of the elements i
>> need (Lifelines, Messages, Occurrence/Execution Specifications,...). I am
>> tweaking my tool so the IBM Rational Software Modeler has no problem
>> visualizing the model it creates. Most of my "knowledge" comes from
>> looking at models create by IBM Rat. Soft. Mod. and other tools (Topcased
>> UML, MagicDraw CE, ..). Although i've come pretty far, i hit a dead end. I
>> can't figure out how to create a message from a lifeline back to itself so
>> that the visualization shows a new Behavior Occurrence Specification. I
>> attached the code i use to create a messages and to create a new
>> Behavioral Occurrence Specification (BOS). After the creation of the BOS i
>> invoke "recvExecutionSpec.getCovereds().add(lifelineSend);" (being
>> recvExecutionSpec the new BOS and lifelineSend the lifeline it was created
>> from (although only the name is used in the actual createBOS method). Is
>> there anything i have to look for when i want to create a "nested" BOS to
>> create a recursive message? I noticed that the IBM Rat. Soft. Mod. creates
>> Execution Events and Execution Occurrence Specifications if i create a
>> model visually, are there the key?
>>
>> Aside from the actual question i would be very grateful for any links and
>> snippets (you may be able to release) which deal with the
>> "programmatically" creation of the UML models (especially sequence
>> diagram). I think i exhausted the material a newbie is able to google and
>> find on this newsgroup :/
>> Is there maybe any information available in the uml spec that i missed? I
>> also want to apologize for my bad english since i'm from germany.
>>
>> Regards,
>>
>> Steffen
>
>
Re: Sequence Diagrams - creating a message which source and target is the same lifeline [message #626212 is a reply to message #477067] Wed, 12 March 2008 19:26 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Steffen,

There is no such meta-type called 'BehaviorOccurrenceSpecification' in UML
2.1.x. From what you describe below I think you are referring to an
ExecutionOccurrenceSpecification ( ...unless I'm completely out to
lunch ).

Your code makes use of BehaviorExecutionSpecification and
ExecutionOccurrenceSpecification , not BehaviorOccurrenceSpecification.

In any event, your question is about why RSA creates an
ExecutionOccurrenceSpecification when the message is starting and ending
from the same lifeline. From my understanding, there is no hard
requirement to actually show or create the
ExecutionOccurrenceSpecifications. I believe RSA creates an
ExecutionOccurrenceSpecification to model the behavior of the function being
called. Assume you had fn1() and fn2() on some Class C1. If fn1() calls
fn2() as part of its behavior I believe you would get into the situation you
describe. In that case the ExecutionOccurrenceSpecification would indicate
that the behavior of fn2() is being invoked. You would then see a return
message but I believe RSA has the ability to filter out return messages from
being displayed.

I think this is what you were getting at.

Cheers,
- James.


"Steffen Rohr" <the.vreid@googlemail.com> wrote in message
news:fr7ef3$ep8$1@build.eclipse.org...
> Hi James,
>
> James Bruck schrieb:
>> Hi Steffen,
>>
>> Are you perhaps talking about creating BehaviorExecutionSpecification? I
>> don't think there is such a thing as a BehavioralOccurrenceSpecification
>> ( just MessageOccurrenceSpecification and
>> ExecutionOccurrenceSpecification ).
>>
>
> I mentioned it ones as "BehavioralOccurrenceSpecification", that was a
> typo, i ment BehaviorOccurrenceSpecification.
>
>> Also, I did not see the code you mentioned you attached.
>
> i can't see my attachments either :/ This time i will attach the
> sourcecode directly in the email.
>
>
>>
>> The UML spec is the best way to figure out the metamodel (although tough
>> to decipher sometimes). IBM's RSx follows the spec very closely so that
>> is also a good reference (should be using something later than 6.x).
>>
>
> I will try to summarize my steps to create a message between two separate
> lifelines. First we need two Lifeslines, then we need a
> BehaviorOccurrenceSpecification tied to each lifeline, then we create a
> Message an the corresponding MessageOccurrenceSpecifications, we tie the
> MessageOccurrenceSpecification to the Lifelines and set the send and
> receive events of the Message (the MessageOccurrenceSpecifications) at
> last we create a SendOperationEvent and a ReceiveOperationEvent which hold
> the Operation which was invoked and tie the Events to the corresponding
> MessageOccurrenceSpecifications. This schould be the right approach
> because IBM Rational Software Modeler is able to visualize my basic
> sequence diagrams created this way.
>
> My question is basicly: why does the IBM RSM create
> ExecutionOccurrenceSpecifications and ExecutionEvents if a Message from a
> Lifeline to itself is created via the sequence diagram editor (of the IBM
> RSM)?
>
> I work very closely with the models created from "IBM Rational Software
> Modeler 7.0.5", i also noticed that the models created from it are very
> close to the speicfication. But i can't figure out every detail.
>
>> Cheers,
>> - James.
>>
>>
>>
>>
>> "Steffen Rohr" <the.vreid@googlemail.com> wrote in message
>> news:fr4rjj$omh$1@build.eclipse.org...
>
> (formatting is just sick, try importing it in eclipse an formatting)
>
> ----- begin createMessage3 -----
> public static org.eclipse.uml2.uml.Message createMessage3(
> org.eclipse.uml2.uml.Interaction interaction,
> String messageSignature,
> org.eclipse.uml2.uml.Lifeline lifelineSend,
> org.eclipse.uml2.uml.Lifeline lifelineRecv,
> org.eclipse.uml2.uml.BehaviorExecutionSpecification sendExecutionSpec,
> org.eclipse.uml2.uml.BehaviorExecutionSpecification recvExecutionSpec,
> org.eclipse.uml2.uml.Event sendEvt,
> org.eclipse.uml2.uml.Event recvEvt) {
>
> org.eclipse.uml2.uml.Message message = interaction
> .createMessage(messageSignature);
> org.eclipse.uml2.uml.MessageOccurrenceSpecification sendEventOccur =
> (org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
> .createFragment("send " + messageSignature,
> UMLPackage.eINSTANCE
> .getMessageOccurrenceSpecification());
> sendEventOccur.getCovereds().add(lifelineSend);
> sendEventOccur.setMessage(message);
> if (sendExecutionSpec.getStart() == null)
> sendExecutionSpec.setStart(sendEventOccur);
> sendExecutionSpec.setFinish(sendEventOccur);
> org.eclipse.uml2.uml.MessageOccurrenceSpecification recvEventOccur =
> (org.eclipse.uml2.uml.MessageOccurrenceSpecification) interaction
> .createFragment("receive " + messageSignature,
> UMLPackage.eINSTANCE
> .getMessageOccurrenceSpecification());
> recvEventOccur.getCovereds().add(lifelineRecv);
> recvEventOccur.setMessage(message);
> if (recvExecutionSpec.getStart() == null)
> recvExecutionSpec.setStart(recvEventOccur);
> recvExecutionSpec.setFinish(recvEventOccur);
>
> message.setSendEvent(sendEventOccur);
> message.setReceiveEvent(recvEventOccur);
>
> sendEventOccur.setEvent(sendEvt);
> recvEventOccur.setEvent(recvEvt);
>
> return message;
> }
> ----- end createMessage3 -----
>
> ----- begin createBehaviorExecutionSpecification -----
> public static BehaviorExecutionSpecification
> createBehaviorExecutionSpecification(
> org.eclipse.uml2.uml.Interaction interaction,
> org.eclipse.uml2.uml.Lifeline lifeline) {
> return (org.eclipse.uml2.uml.BehaviorExecutionSpecification) interaction
> .createFragment(lifeline.getName(), UMLPackage.eINSTANCE
> .getBehaviorExecutionSpecification());
> }
> ----- end createBehaviorExecutionSpecification -----
>
>>> Hi list,
>>>
>>> i am currently working on small tool(bachelor exam) which creates
>>> sequence diagrams from java sourcecode. I am able to create most of the
>>> elements i need (Lifelines, Messages, Occurrence/Execution
>>> Specifications,...). I am tweaking my tool so the IBM Rational Software
>>> Modeler has no problem visualizing the model it creates. Most of my
>>> "knowledge" comes from looking at models create by IBM Rat. Soft. Mod.
>>> and other tools (Topcased UML, MagicDraw CE, ..). Although i've come
>>> pretty far, i hit a dead end. I can't figure out how to create a message
>>> from a lifeline back to itself so that the visualization shows a new
>>> Behavior Occurrence Specification. I attached the code i use to create a
>>> messages and to create a new Behavioral Occurrence Specification (BOS).
>>> After the creation of the BOS i invoke
>>> "recvExecutionSpec.getCovereds().add(lifelineSend);" (being
>>> recvExecutionSpec the new BOS and lifelineSend the lifeline it was
>>> created from (although only the name is used in the actual createBOS
>>> method). Is there anything i have to look for when i want to create a
>>> "nested" BOS to create a recursive message? I noticed that the IBM Rat.
>>> Soft. Mod. creates Execution Events and Execution Occurrence
>>> Specifications if i create a model visually, are there the key?
>>>
>>> Aside from the actual question i would be very grateful for any links
>>> and snippets (you may be able to release) which deal with the
>>> "programmatically" creation of the UML models (especially sequence
>>> diagram). I think i exhausted the material a newbie is able to google
>>> and find on this newsgroup :/
>>> Is there maybe any information available in the uml spec that i missed?
>>> I also want to apologize for my bad english since i'm from germany.
>>>
>>> Regards,
>>>
>>> Steffen
>>
Previous Topic:linked graphic element from a model element
Next Topic:how to setSource&setTarget for ControlFlow in Activity??
Goto Forum:
  


Current Time: Fri Dec 19 18:15:17 GMT 2014

Powered by FUDForum. Page generated in 0.04259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software