Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] how to define multiples guards in from clause of a rule ?
[ATL] how to define multiples guards in from clause of a rule ? [message #38220] Tue, 15 May 2007 16:45 Go to next message
Eclipse UserFriend
Originally posted by: sylvain.maillard.univ-nantes.fr

Hi again,

I have a little problem: I can do this:

rule elements {
from
e1 : MMa!Element,
e2 : MMA!Element (
e1.elements->includes(e2)
)
to etc.....

but not this

rule elements {
from
e2 : MMA!Element (
e1.elements->includes(e2)
),
e1 : MMa!Element
to etc.....

The file can't be compiled in the second case. It is also impossible to
add another condition on the second element. It says that the ',' is
not expected.
Is there a raison for that ?

Sylvain

--
Sylvain
Re: [ATL] how to define multiples guards in from clause of a rule ? [message #38291 is a reply to message #38220] Tue, 15 May 2007 16:55 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

> I have a little problem: I can do this:
>
> rule elements {
> from
> e1 : MMa!Element,
> e2 : MMA!Element (
> e1.elements->includes(e2)
> )
> to etc.....
>
> but not this
>
> rule elements {
> from
> e2 : MMA!Element (
> e1.elements->includes(e2)
> ),
> e1 : MMa!Element
> to etc.....
>
> The file can't be compiled in the second case. It is also impossible to
> add another condition on the second element. It says that the ',' is not
> expected.

As Marcos pointed out in the following post:
http://www.eclipse.org/newsportal/article.php?id=429&gro up=eclipse.modeling.m2m#429
there should be only one guard, which comes after all the source elements.

> Is there a raison for that ?

http://en.wikipedia.org/wiki/K.I.S.S.

You may add as many conditions using the Boolean "and" operator,
therefore it is not necessary to have a distinct guard per element ;-).

Moreover, in your case you use e1 and e2 in your condition. Therefore,
it does not even apply to e2 only, and it makes sense to write it after
having defined both e1 and e2.


Best regards,

Frédéric Jouault
Previous Topic:[ATL] Metamodel für XPDL 2.0 and / or AML
Next Topic:Re: [ATL] problems to reference remote rules
Goto Forum:
  


Current Time: Thu Jan 21 16:01:23 GMT 2021

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

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

Back to the top