Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » How to call a called rule.[ATL]
How to call a called rule.[ATL] [message #733627] Wed, 05 October 2011 08:49 Go to next message
lamiamati  is currently offline lamiamati
Messages: 4
Registered: October 2011
Junior Member
Hi;
I want to know how I can call a called rule; but I have not succeeded,an error always occurred;please hepl me it is obligatory to use a called rule. in the ALT Manual, there is no such syntax. I hope the author can add it later on. Thanks.
here is the excerpt:
rule Square2Circel {
from E : Square!Square
to c : Circle!Circle
(
--Color <- thisModule.transfs(E.Color),
Cle<-E.cle,
Rayon<-E.Length
)
do
{
c.Color <- thisModule.transfs(E.Color);
}

}

rule transfs(n:String){ -- a called rule
to
c : Circle!Circle(
Color<-n
)
}
Re: How to call a called rule.[ATL] [message #733650 is a reply to message #733627] Wed, 05 October 2011 09:54 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 523
Registered: July 2009
Senior Member
The way you call the called rule is correct but a called rule must explicitely specify what it returns.

There you'll have :

rule transfs(n:String){ -- a called rule
to
c : Circle!Circle(
Color<-n
)
do{
c;
}
}
Re: How to call a called rule.[ATL] [message #733688 is a reply to message #733650] Wed, 05 October 2011 12:37 Go to previous message
lamiamati  is currently offline lamiamati
Messages: 4
Registered: October 2011
Junior Member
ok;
thnks a lot Sylvain EVEILLARD but after several triad i found thant the problem is on the way that i call the called rule :
old code:
rule Square2Circel {
from E : Square!Square
to c : Circle!Circle
(
--Color <- thisModule.transfs(E.Color),
Cle<-E.cle,
Rayon<-E.Length
)
do
{
c.Color <- thisModule.transfs(E.Color);
}

}

rule transfs(n:String){ -- a called rule
to
c : Circle!Circle(
Color<-n
)
}
after correction:
rule transfs(n:String){ -- a called rule
to
c : Circle!Circle(
Color<-n
)
do{
c;
}
}
rule Square2Circel {
from E : Square!Square
to c : Circle!Circle
(
-- <- thisModule.transfs(E.Color),
Cle<-E.cle,
Rayon<-E.Length
)
do
{
--thisModule.transfs('red');
thisModule.transfs(E.Color);
}

}
Previous Topic:[ATL] Iterating over collections
Next Topic:index from sequence
Goto Forum:
  


Current Time: Wed Oct 22 01:46:02 GMT 2014

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

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