Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Empty Stack Exception
Empty Stack Exception [message #9003] Thu, 18 January 2007 07:12 Go to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

I have a very simple transformation (that does nothing at all):

-- @atlcompiler atl2006
module TestTransform; -- Module Template
create output : metamodel from My : ecore;
rule Example {
from s : ecore!EObject
to t : metamodel!Node (
name <- s.toString()
)
do {
t.edges <- thisModule.getCross(s);
}
}


rule getCross (s : ecore!EObject) {
to rel: metamodel!Relationship (
)
}

but when I use the called rule I get an empty stack exception.

Is this the proper way to use a called rule?
Do lazy rules still exist (I didn't see them in the ATL User Manual)?

What is the difference between a lazy rule and a called rule?

cheers,
ian
Re: Empty Stack Exception [message #9092 is a reply to message #9003] Thu, 18 January 2007 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi Ian,

Here are answers to your questions:

> I have a very simple transformation (that does nothing at all):
>
> -- @atlcompiler atl2006
> module TestTransform; -- Module Template
> create output : metamodel from My : ecore;
> rule Example {
> from s : ecore!EObject
> to t : metamodel!Node (
> name <- s.toString()
> )
> do {
> t.edges <- thisModule.getCross(s);
> }
> }
>
>
> rule getCross (s : ecore!EObject) {
> to rel: metamodel!Relationship (
> )
> }
>
> but when I use the called rule I get an empty stack exception.

Called rule doesn't return anything, then when you are doing t.edges <-
thisModule.getCross(s), something goes wrong.
I suggest you to change getCross to:

rule getCross (s : ecore!EObject) {
to rel: metamodel!Relationship (
)
do {
rel;
}
}

to return a value.

>
> Is this the proper way to use a called rule?
> Do lazy rules still exist (I didn't see them in the ATL User Manual)?

Yes lazy rules still exist.

>
> What is the difference between a lazy rule and a called rule?


The main difference between a called rule and a lazy rule is that a lazy
rule is a matched rule that is matched when it is called. This seems to
be tricky, but much more useful and powerful than called rules.
First, lazy rules allow defining multiple rules for input model elements
(whereas matched does'nt). Second, they allow filtering as a classical
matched rule. Finally, as declarative programming style is the preferred
one for ATL transformation, lazy rules best fit this recommendation.

>
> cheers,
> ian


Hope this helps.
Best regards,
Mikaël

--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: Empty Stack Exception [message #9239 is a reply to message #9092] Thu, 18 January 2007 21:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

Thank you so much Mikael!

Works like a charm.

Cheers,
ian

Mikaël Barbero wrote:
> Hi Ian,
>
> Here are answers to your questions:
>
> > I have a very simple transformation (that does nothing at all):
> >
> > -- @atlcompiler atl2006
> > module TestTransform; -- Module Template
> > create output : metamodel from My : ecore;
> > rule Example {
> > from s : ecore!EObject
> > to t : metamodel!Node (
> > name <- s.toString()
> > )
> > do {
> > t.edges <- thisModule.getCross(s);
> > }
> > }
> >
> >
> > rule getCross (s : ecore!EObject) {
> > to rel: metamodel!Relationship (
> > )
> > }
> >
> > but when I use the called rule I get an empty stack exception.
>
> Called rule doesn't return anything, then when you are doing t.edges <-
> thisModule.getCross(s), something goes wrong.
> I suggest you to change getCross to:
>
> rule getCross (s : ecore!EObject) {
> to rel: metamodel!Relationship (
> )
> do {
> rel;
> }
> }
>
> to return a value.
>
> >
> > Is this the proper way to use a called rule?
> > Do lazy rules still exist (I didn't see them in the ATL User Manual)?
>
> Yes lazy rules still exist.
>
> >
> > What is the difference between a lazy rule and a called rule?
>
>
> The main difference between a called rule and a lazy rule is that a lazy
> rule is a matched rule that is matched when it is called. This seems to
> be tricky, but much more useful and powerful than called rules.
> First, lazy rules allow defining multiple rules for input model elements
> (whereas matched does'nt). Second, they allow filtering as a classical
> matched rule. Finally, as declarative programming style is the preferred
> one for ATL transformation, lazy rules best fit this recommendation.
>
>>
>> cheers,
>> ian
>
>
> Hope this helps.
> Best regards,
> Mikaël
>
Re: Empty Stack Exception PLUS question about lazy rules [message #10530 is a reply to message #9092] Fri, 19 January 2007 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jairson.gmail.com

Hi Mikaël,

You said "> The main difference between a called rule and a lazy rule is
that a lazy rule is a matched rule that is matched when it is called. "

So in the case of Ian example

(...)
do {
t.edges <- thisModule.getCross(s);
}

rule getCross (s : ecore!EObject)
{ to rel: metamodel!Relationship (
)
do {
rel;
}
}

How could that be done using a lazy rule? I cannot see in the case of
lazy rules how the matching works. How does ATL know which object is to
be matched? Can you give us a very short example?

Does version of 1.0.7 of the ATL engine and version 1.0.5 of the ATL
builder understand lazy rules?

Thank you

Jairson Vitorino

Mikaël Barbero wrote:
> Hi Ian,
>
> Here are answers to your questions:
>
> > I have a very simple transformation (that does nothing at all):
> >
> > -- @atlcompiler atl2006
> > module TestTransform; -- Module Template
> > create output : metamodel from My : ecore;
> > rule Example {
> > from s : ecore!EObject
> > to t : metamodel!Node (
> > name <- s.toString()
> > )
> > do {
> > t.edges <- thisModule.getCross(s);
> > }
> > }
> >
> >
> > rule getCross (s : ecore!EObject) {
> > to rel: metamodel!Relationship (
> > )
> > }
> >
> > but when I use the called rule I get an empty stack exception.
>
> Called rule doesn't return anything, then when you are doing t.edges <-
> thisModule.getCross(s), something goes wrong.
> I suggest you to change getCross to:
>
> rule getCross (s : ecore!EObject) {
> to rel: metamodel!Relationship (
> )
> do {
> rel;
> }
> }
>
> to return a value.
>
> >
> > Is this the proper way to use a called rule?
> > Do lazy rules still exist (I didn't see them in the ATL User Manual)?
>
> Yes lazy rules still exist.
>
> >
> > What is the difference between a lazy rule and a called rule?
>
>
> The main difference between a called rule and a lazy rule is that a lazy
> rule is a matched rule that is matched when it is called. This seems to
> be tricky, but much more useful and powerful than called rules.
> First, lazy rules allow defining multiple rules for input model elements
> (whereas matched does'nt). Second, they allow filtering as a classical
> matched rule. Finally, as declarative programming style is the preferred
> one for ATL transformation, lazy rules best fit this recommendation.
>
>>
>> cheers,
>> ian
>
>
> Hope this helps.
> Best regards,
> Mikaël
>
Re: Empty Stack Exception PLUS question about lazy rules [message #10562 is a reply to message #9092] Fri, 19 January 2007 10:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jairson.gmail.com

Hi Mikaël,

You said "> The main difference between a called rule and a lazy rule is
that a lazy rule is a matched rule that is matched when it is called. "

So in the case of Ian example

(...)
do {
t.edges <- thisModule.getCross(s);
}

rule getCross (s : ecore!EObject)
{ to rel: metamodel!Relationship (
)
do {
rel;
}
}

How could that be done using a lazy rule? I cannot see in the case of
lazy rules how the matching works. How does ATL know which object is to
be matched? Can you give us a very short example?

Does version of 1.0.7 of the ATL engine and version 1.0.5 of the ATL
builder understand lazy rules?

Thank you

Jairson Vitorino

Mikaël Barbero wrote:
> Hi Ian,
>
> Here are answers to your questions:
>
> > I have a very simple transformation (that does nothing at all):
> >
> > -- @atlcompiler atl2006
> > module TestTransform; -- Module Template
> > create output : metamodel from My : ecore;
> > rule Example {
> > from s : ecore!EObject
> > to t : metamodel!Node (
> > name <- s.toString()
> > )
> > do {
> > t.edges <- thisModule.getCross(s);
> > }
> > }
> >
> >
> > rule getCross (s : ecore!EObject) {
> > to rel: metamodel!Relationship (
> > )
> > }
> >
> > but when I use the called rule I get an empty stack exception.
>
> Called rule doesn't return anything, then when you are doing t.edges <-
> thisModule.getCross(s), something goes wrong.
> I suggest you to change getCross to:
>
> rule getCross (s : ecore!EObject) {
> to rel: metamodel!Relationship (
> )
> do {
> rel;
> }
> }
>
> to return a value.
>
> >
> > Is this the proper way to use a called rule?
> > Do lazy rules still exist (I didn't see them in the ATL User Manual)?
>
> Yes lazy rules still exist.
>
> >
> > What is the difference between a lazy rule and a called rule?
>
>
> The main difference between a called rule and a lazy rule is that a lazy
> rule is a matched rule that is matched when it is called. This seems to
> be tricky, but much more useful and powerful than called rules.
> First, lazy rules allow defining multiple rules for input model elements
> (whereas matched does'nt). Second, they allow filtering as a classical
> matched rule. Finally, as declarative programming style is the preferred
> one for ATL transformation, lazy rules best fit this recommendation.
>
>>
>> cheers,
>> ian
>
>
> Hope this helps.
> Best regards,
> Mikaël
>
Re: Empty Stack Exception PLUS question about lazy rules [message #10595 is a reply to message #9092] Fri, 19 January 2007 10:47 Go to previous message
Eclipse UserFriend
Originally posted by: jairson.gmail.com

Hi Mikaël,

You said "> The main difference between a called rule and a lazy rule is
that a lazy rule is a matched rule that is matched when it is called. "

So in the case of Ian example

(...)
do {
t.edges <- thisModule.getCross(s);
}

rule getCross (s : ecore!EObject)
{ to rel: metamodel!Relationship (
)
do {
rel;
}
}

How could that be done using a lazy rule? I cannot see in the case of
lazy rules how the matching works. How does ATL know which object is to
be matched? Can you give us a very short example?

Does version of 1.0.7 of the ATL engine and version 1.0.5 of the ATL
builder understand lazy rules?

Thank you

Jairson Vitorino

Mikaël Barbero wrote:
> Hi Ian,
>
> Here are answers to your questions:
>
> > I have a very simple transformation (that does nothing at all):
> >
> > -- @atlcompiler atl2006
> > module TestTransform; -- Module Template
> > create output : metamodel from My : ecore;
> > rule Example {
> > from s : ecore!EObject
> > to t : metamodel!Node (
> > name <- s.toString()
> > )
> > do {
> > t.edges <- thisModule.getCross(s);
> > }
> > }
> >
> >
> > rule getCross (s : ecore!EObject) {
> > to rel: metamodel!Relationship (
> > )
> > }
> >
> > but when I use the called rule I get an empty stack exception.
>
> Called rule doesn't return anything, then when you are doing t.edges <-
> thisModule.getCross(s), something goes wrong.
> I suggest you to change getCross to:
>
> rule getCross (s : ecore!EObject) {
> to rel: metamodel!Relationship (
> )
> do {
> rel;
> }
> }
>
> to return a value.
>
> >
> > Is this the proper way to use a called rule?
> > Do lazy rules still exist (I didn't see them in the ATL User Manual)?
>
> Yes lazy rules still exist.
>
> >
> > What is the difference between a lazy rule and a called rule?
>
>
> The main difference between a called rule and a lazy rule is that a lazy
> rule is a matched rule that is matched when it is called. This seems to
> be tricky, but much more useful and powerful than called rules.
> First, lazy rules allow defining multiple rules for input model elements
> (whereas matched does'nt). Second, they allow filtering as a classical
> matched rule. Finally, as declarative programming style is the preferred
> one for ATL transformation, lazy rules best fit this recommendation.
>
>>
>> cheers,
>> ian
>
>
> Hope this helps.
> Best regards,
> Mikaël
>
Re: [ATL] Empty Stack Exception PLUS question about lazy rules [message #10627 is a reply to message #10562] Fri, 19 January 2007 10:32 Go to previous message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi Jairson,

I wrote a piece of doc in the wiki:
http://wiki.eclipse.org/index.php/ATL_Language_Troubleshoote r

Regards,
Mikael

Jairson wrote:
> Hi Mikaël,
>
> You said "> The main difference between a called rule and a lazy rule is
> that a lazy rule is a matched rule that is matched when it is called. "
>
> So in the case of Ian example
>
> (...)
> do {
> t.edges <- thisModule.getCross(s);
> }
>
> rule getCross (s : ecore!EObject)
> { to rel: metamodel!Relationship (
> )
> do {
> rel;
> }
> }
>
> How could that be done using a lazy rule? I cannot see in the case of
> lazy rules how the matching works. How does ATL know which object is to
> be matched? Can you give us a very short example?
>
> Does version of 1.0.7 of the ATL engine and version 1.0.5 of the ATL
> builder understand lazy rules?
>
> Thank you
>
> Jairson Vitorino
>
> Mikaël Barbero wrote:
>> Hi Ian,
>>
>> Here are answers to your questions:
>>
>> > I have a very simple transformation (that does nothing at all):
>> >
>> > -- @atlcompiler atl2006
>> > module TestTransform; -- Module Template
>> > create output : metamodel from My : ecore;
>> > rule Example {
>> > from s : ecore!EObject
>> > to t : metamodel!Node (
>> > name <- s.toString()
>> > )
>> > do {
>> > t.edges <- thisModule.getCross(s);
>> > }
>> > }
>> >
>> >
>> > rule getCross (s : ecore!EObject) {
>> > to rel: metamodel!Relationship (
>> > )
>> > }
>> >
>> > but when I use the called rule I get an empty stack exception.
>>
>> Called rule doesn't return anything, then when you are doing t.edges
>> <- thisModule.getCross(s), something goes wrong.
>> I suggest you to change getCross to:
>>
>> rule getCross (s : ecore!EObject) {
>> to rel: metamodel!Relationship (
>> )
>> do {
>> rel;
>> }
>> }
>>
>> to return a value.
>>
>> >
>> > Is this the proper way to use a called rule?
>> > Do lazy rules still exist (I didn't see them in the ATL User Manual)?
>>
>> Yes lazy rules still exist.
>>
>> >
>> > What is the difference between a lazy rule and a called rule?
>>
>>
>> The main difference between a called rule and a lazy rule is that a
>> lazy rule is a matched rule that is matched when it is called. This
>> seems to be tricky, but much more useful and powerful than called rules.
>> First, lazy rules allow defining multiple rules for input model
>> elements (whereas matched does'nt). Second, they allow filtering as a
>> classical matched rule. Finally, as declarative programming style is
>> the preferred one for ATL transformation, lazy rules best fit this
>> recommendation.
>>
>>>
>>> cheers,
>>> ian
>>
>>
>> Hope this helps.
>> Best regards,
>> Mikaël
>>
>



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Previous Topic:[ATL] Problems with Contexts and ATL 2006
Next Topic:[ATL] Does ATL handle long number type ?
Goto Forum:
  


Current Time: Fri Apr 19 21:11:37 GMT 2024

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

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

Back to the top