[ATL]Hierarchical structure not preserved with called/lazy rules [message #97998] |
Wed, 21 January 2009 12:43 |
Eclipse User |
|
|
|
Hello,
I am using ATL to produce a target UML2 Sequence model.
Therefore; I need to create two "uml::MessageOccurrenceSpecification" for
each source model element.
So I am using Called/Lazy Rules to achieve multiple target element
generation. Unfortunately, "uml:MessageOccurrenceSpecification" elements
created with the Called/Lazy Rule will not be nested within the
uml:Interaction.
If I create an equivalent Matched Rule, the target element
"uml:MessageOccurrenceSpecification" will be nested correctly. But it will
only create one "uml:MessageOccurrenceSpecification" for each source
element but I need two for each source element.
How can I solve this issue ?
Regards,
Thomas
|
|
|
|
Re: [ATL]Hierarchical structure not preserved with called/lazy rules [message #98131 is a reply to message #98045] |
Fri, 23 January 2009 00:31 |
Eclipse User |
|
|
|
Thank you very much, Tristan !
I am using the called rule with parameter and it works like a charm.
Unfortunately, ATL doesn't support polymorphic calls then the expressions
would more elegant.
> you can optimize and remember the allInstances in using section. And you
> can store the messageSpecification in other place.
I placed the allInstances Rule in the using section but where can I place
the messageSpecification rule ? You mean a helper?
Regards,
Thomas
|
|
|
|
Re: [ATL]Hierarchical structure not preserved with called/lazy rules [message #98309 is a reply to message #98146] |
Sun, 25 January 2009 14:58 |
Eclipse User |
|
|
|
Thanks Tristan !!!
Just one more question. Maybe you or anyone else can help me.
Sequence diagram needs uml:CallEvent. But I can't get it done that
uml:CallEvent is a child of Package AND it referenced by MessageOccurence.
I achieve only one of the targets (either uml:CallEvent is packagedElement
or uml:CallEvent is referenced by MessageOccurence)
The structure of sequence diagram is the following:
Model
Package
CallEvent
Collaboration
Interaction
Lifeline
MessageOccurenceSpecification
MessageOccurenceSpecification
Message
Each Message has two MessageOccurenceSpecification. Each
MessageOccurenceSpecification has the property "event" which points to
CallEvent.
Preserving the package structure for uml:CallEvent, I have the lazy rule:
from s : UML2!"uml::Package"
to out: UML2!"uml::Package" (
packagedElement<-s.packagedElement->select....->thisModule.addCallEvent(e))
This is the lazy rule:
lazy rule addCallEvent {
from s : UML2!"uml::NamedElement"
to out: UML2!"uml::CallEvent"
}
The uml:CallEvent will be correctly nested into uml:Package.
Achieving a reference by MessageOccurenceSpecification, I do the following:
--creating the 2nd MessageOccurenceSpecification
lazy rule CallOp2MessOcurSpec0 {
from s: UML2!"uml::NamedElement"
to out: UML2!"uml::MessageOccurrenceSpecification"(
name<-s.name)
do {
out.event<-thisModule.addCallEvent(s);
}
Obviously, this lazy rule will damage the hierarchical structure since the
uml:CallEvent will be placed at the top level and not within uml:Package.
How can I achieve that uml:CallEvent will be created within uml:Package
and later it will be referenced by uml:MessageOccurenceSpecification ?
Do I need a second transformation with refining mode ? If so, how would it
look like ? I didn't manage creating such a transformation with refining
mode.
Any help will be highly appreciated !
Regards,
Thomas
|
|
|
|
Re: [ATL]Hierarchical structure not preserved with called/lazy rules [message #98367 is a reply to message #98338] |
Mon, 26 January 2009 14:34 |
Eclipse User |
|
|
|
Tristan FAURE wrote:
>Maybe you should use "unique" key word (i've never used it :( )
> unique lazy rule addCallEvent {
> from s : UML2!"uml::NamedElement"
> to out: UML2!"uml::CallEvent"
> }
> it seems that this keyword means only one object will be created for an
> input element and should referenced your objects already created
That's it !! Thanks again !
The keyword "unique" is doing exactly what you described and exactly what
I want :-)
I should have read the User guide more carefully...
Cheers,
Thomas
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04341 seconds