Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Help with helpers needed -work-around for unsupported registration
[ATL] Help with helpers needed -work-around for unsupported registration [message #102925] Mon, 06 April 2009 14:39 Go to next message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
Hello,

I am trying to make a transformation that recursively splits a list using
helpers.

I tried to make a helper with a collection as context. I got an
"Unsupported registration..." warning. I read that it is impossible to use
a collection as context.
( http://www.sciences.univ-nantes.fr/lina/atl/www/atl_discussi on_archive/0324.html)

Therefore I rewrote my helper in such a way that it takes a collection as
a parameter. Now it looks like this:

helper def: getStatementsThroughFirstSend(s: Sequence(slco!Statement)):
Sequence(slco!Statement) =
let i: Integer = s.getIndexOfFirstSend()
in s->asSequence()->subSequence(0, i);

The problem is now that I want to call this helper from another helper as
follows:
helper context slco!Transition def: splitStatementList():
Sequence(Sequence(slco!Statement)) =
if self.hasEffectSendStatements()
then getStatementsThroughFirstSend(self.effect->asSequence())
else Sequence{}
endif;

This results in a syntax error at the point where I try to invoke the
function in the then clause.

In the slco metamodel, on the transition metaclass "effect" is an ordered
reference.
Re: [ATL] Help with helpers needed -work-around for unsupported registration [message #102947 is a reply to message #102925] Mon, 06 April 2009 20:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lwrage.sei.cmu.edu

Marcel,

When you use a helper that has no context you must prefix it with
"thisModule." In your example, write
thisModule.getStatementsThroughFirstSend(self.effect... in helper
splitStatementList.

Lutz


Marcel van Amstel wrote, on 4/6/2009 10:39 AM:
> Hello,
>
> I am trying to make a transformation that recursively splits a list
> using helpers.
>
> I tried to make a helper with a collection as context. I got an
> "Unsupported registration..." warning. I read that it is impossible to
> use a collection as context.
> ( http://www.sciences.univ-nantes.fr/lina/atl/www/atl_discussi on_archive/0324.html)
>
>
> Therefore I rewrote my helper in such a way that it takes a collection
> as a parameter. Now it looks like this:
>
> helper def: getStatementsThroughFirstSend(s: Sequence(slco!Statement)):
> Sequence(slco!Statement) =
> let i: Integer = s.getIndexOfFirstSend()
> in s->asSequence()->subSequence(0, i);
>
> The problem is now that I want to call this helper from another helper
> as follows:
> helper context slco!Transition def: splitStatementList():
> Sequence(Sequence(slco!Statement)) =
> if self.hasEffectSendStatements()
> then getStatementsThroughFirstSend(self.effect->asSequence())
> else Sequence{}
> endif;
>
> This results in a syntax error at the point where I try to invoke the
> function in the then clause.
>
> In the slco metamodel, on the transition metaclass "effect" is an
> ordered reference.
>
Re: [ATL] Help with helpers needed -work-around for unsupported registration [message #102992 is a reply to message #102947] Tue, 07 April 2009 11:38 Go to previous message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
Thank you, that worked just fine.
Previous Topic:M2M Workflow
Next Topic:[ATL] Where is the "Apply" profile or stereotype example
Goto Forum:
  


Current Time: Wed Apr 24 16:33:39 GMT 2024

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

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

Back to the top