Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Lazy rules & resolveTemp?
[ATL] Lazy rules & resolveTemp? [message #103247] Thu, 09 April 2009 13:59 Go to next message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
Hello,

I created an ATL transformation that uses lazy rules to implement
recursion over a collection of elements. It creates the new elements in
the appropriate way. However, I cannot get them in the right containment
reference. I tried to use resolveTemp, but this fails.

Can anybody explain me how to get the newly created model elements in the
right containment reference?


Here follows a sketch of my transformation:

rule Transition_split_effect{
from transition_in : slco!Transition

using{s : Sequence(Sequence(slco!Statement)) =
transition_in.splitEffect();
s_head: Sequence(slco!Statement) = s->first();
s_tail: Sequence(Sequence(slco!Statement)) = s->excluding(s_head);
}

to transition_out: slco!Transition(...)

do{...
if s_tail->size() > 1
then thisModule.makeStateAndTransitionRecurse(s_tail)
else thisModule.makeStateAndTransitionEnd(s_tail)
endif;
}
}

lazy rule makeStateAndTransitionRecurse{
from ss_in: Sequence(Sequence(slco!Statement))

using{s_head: Sequence(slco!Statement) = ss_in->first();
s_tail: Sequence(Sequence(slco!Statement)) =
ss_in->excluding(s_head);
}

to t_out: slco!Transition(...),

s_out: slco!State(...)

do{...
if s_tail->size() > 1
then thisModule.makeStateAndTransitionRecurse(s_tail)
else thisModule.makeStateAndTransitionEnd(s_tail)
endif;
}
}

lazy rule makeStateAndTransitionEnd{
from ss_in: Sequence(Sequence(slco!Statement))

to t_out: slco!Transition(...),
s_out: slco!State(...)
}
Re: [ATL] Lazy rules & resolveTemp? [message #103413 is a reply to message #103247] Tue, 14 April 2009 08:52 Go to previous messageGo to next message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
I read that it is not yet possible to use resolveTemp with lazy rules.
However, that post was two years ago. What is the current status on this?
( http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/m sg01257.html)

I also read a post of someone with a similar problem. I tried that
solution, but I was not successful.
( http://www.eclipse.org/newsportal/article.php?id=4018&gr oup=eclipse.modeling.m2m)

Does anybody have other ideas?

Regards,

Marcel
Re: [ATL] Lazy rules & resolveTemp? [message #104076 is a reply to message #103413] Fri, 24 April 2009 12:39 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
your code is not very clean are you sure of the structure ?
it's not very recommended to use imperative code.
Lazy rule can be a good solution but putting them in imperative section
is not a clean way :/

Marcel a écrit :
> I read that it is not yet possible to use resolveTemp with lazy rules.
> However, that post was two years ago. What is the current status on this?
> ( http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/m sg01257.html)
>
>
> I also read a post of someone with a similar problem. I tried that
> solution, but I was not successful.
> ( http://www.eclipse.org/newsportal/article.php?id=4018&gr oup=eclipse.modeling.m2m)
>
>
> Does anybody have other ideas?
>
> Regards,
>
> Marcel
>
>




Re: [ATL] Lazy rules & resolveTemp? [message #104155 is a reply to message #104076] Mon, 27 April 2009 08:20 Go to previous messageGo to next message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
Hi,

I am pretty sure of the structure. I solved the problem in another way
using lazy rules.

However, I still have a question regarding lazy rules and resolveTemp that
is very much related to this one.

My transformation builds a state machine. A state machine consists of
states and transitions.
I create a new state and a new transition in a lazy rule. How can I add
the state created in the lazy rule to the set of states of the state
machine and the transition created in the lazy rule to the set of
transitions of the state machine.

The structure is roughly as follows:

rule Class{
from
class_in: slco!Class
to
class_out: slco!Class(
...
stateMachines <- class_in.stateMachines->append(token_server)
),

token_server: slco!StateMachine (
states <- Bag{initial, idle}->union('states generated by the lazy
rule'),
transitions <- Bag{initial_to_idle}->union('transitions generated by
the lazy rule')
),

inital: slco!State(...),
idle: slco!State(...),
initial_to_idle: slco!Transition(...)
}

lazy rule tokenClient(
from sm_in: slco!stateMachine

...
to
s_out: slco!State (...)
...
t_out: slco!Transition(...)
)

For every state machine in 'class_in.stateMachines', the lazy rule should
be called.

How should I call this lazy rule such that the states end up in the bag
containing states and the transitions in the bag containing transitions?

Thanks!

Marcel
Re: [ATL] Lazy rules & resolveTemp? [message #104181 is a reply to message #104155] Mon, 27 April 2009 13:23 Go to previous messageGo to next message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
I now use matched rules to avoid this problem.

However, I would still like to know how to refer to a non-default element
generated by a lazy rule.
Re: [ATL] Lazy rules & resolveTemp? [message #107130 is a reply to message #104155] Wed, 24 June 2009 19:29 Go to previous message
bouhmid  is currently offline bouhmid Friend
Messages: 5
Registered: July 2009
Junior Member
Hi
Can u please give us the solution that u find for your problem
Thanks
Previous Topic:[ATL] Recursive NavigationOrAttributeCallExp creation
Next Topic:Invoking java code modules within an ATL transformation
Goto Forum:
  


Current Time: Fri Apr 26 05:36:16 GMT 2024

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

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

Back to the top