Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » creating two different target elements from one source element based on its subtypes
creating two different target elements from one source element based on its subtypes [message #912506] Thu, 13 September 2012 17:25 Go to next message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Hey there!

i have a source metamodel with eclass as behavior and its subtypes are of state, event, selection and ....... external output.

Now i have to transform
1. behavior elements of type state to my target element named dlmethod invocation and
2. behavior elements of type event to my target element named btevent invocation.

i tried simple matched rule but if you put a guard to filter only behavior elements of type state then i cannot access behavior elements of type event.
if i dont put the guard and use helpers then the number of target elements generated are greater. Any help?

Also i dont know why i cant use if statement in my do imperative section of a matched rule. It gives me syntax error??

I also wanted to know about iterative target patterns, The ATL user guide tells me that the use of distinct foreach is deprecated. How can i work around it??

Thank you for your help in advance
Re: creating two different target elements from one source element based on its subtypes [message #912815 is a reply to message #912506] Fri, 14 September 2012 08:32 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

noi poi wrote on Thu, 13 September 2012 19:25

i tried simple matched rule but if you put a guard to filter only behavior elements of type state then i cannot access behavior elements of type event.
if i dont put the guard and use helpers then the number of target elements generated are greater. Any help?

As far as I understand, you could simply create two distinct matched rules respectively taking as input pattern State and Event.
Another option is two create two distinct matched rules taking as input pattern Behavior and then checking the actual type (i.e. State and Event, as inheriting from Behavior) in the respective guards.
In this second option, some generalization is possible by defining an abstract matched rule and then using rule inheritance: http://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language#Rule_inheritance

Quote:

Also i dont know why i cant use if statement in my do imperative section of a matched rule. It gives me syntax error??

You have to put a semicolon at the end of each instruction in a "do" section.
However, it is fundamental to understand that the use of imperative sections in ATL has to be restricted to very limited cases. By experience, in a (very) large majority of the cases, using only declarative constructs such as matched rules is possible, simpler and more efficient.

Quote:

I also wanted to know about iterative target patterns, The ATL user guide tells me that the use of distinct foreach is deprecated. How can i work around it??

As stated in the ATL documentation, the "distinct foreach" construct is deprecated as it can be systematically replaced by the use of lazy (matched) rules.
http://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language#Lazy_Rules

Best regards,

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: creating two different target elements from one source element based on its subtypes [message #914959 is a reply to message #912815] Sun, 16 September 2012 06:00 Go to previous messageGo to next message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo, Yes the rule inheritance did work. Except for one thing that the abstract class if there is no binding the target elements are still created which are empty union with the the bindings of the inherited rule.

Thank you once again.

Re: creating two different target elements from one source element based on its subtypes [message #914964 is a reply to message #912815] Sun, 16 September 2012 06:04 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo. The rule inheritance did work except one thing, The abstract class does not have any bindings even then target elements are generated without any binding union the bindindgs of the inherited rule.

Thank you once again
Re: creating two different target elements from one source element based on its subtypes [message #914979 is a reply to message #912815] Sun, 16 September 2012 06:00 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo, Yes the rule inheritance did work. Except for one thing that the abstract class if there is no binding the target elements are still created which are empty union with the the bindings of the inherited rule.

Thank you once again.
Re: creating two different target elements from one source element based on its subtypes [message #914986 is a reply to message #912815] Sun, 16 September 2012 06:00 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo, Yes the rule inheritance did work. Except for one thing that the abstract class if there is no binding the target elements are still created which are empty union with the the bindings of the inherited rule.

Thank you once again.
Re: creating two different target elements from one source element based on its subtypes [message #914987 is a reply to message #912815] Sun, 16 September 2012 06:04 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo. The rule inheritance did work except one thing, The abstract class does not have any bindings even then target elements are generated without any binding union the bindindgs of the inherited rule.

Thank you once again
Re: creating two different target elements from one source element based on its subtypes [message #914994 is a reply to message #912815] Sun, 16 September 2012 06:00 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo, Yes the rule inheritance did work. Except for one thing that the abstract class if there is no binding the target elements are still created which are empty union with the the bindings of the inherited rule.

Thank you once again.
Re: creating two different target elements from one source element based on its subtypes [message #914995 is a reply to message #912815] Sun, 16 September 2012 06:04 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo. The rule inheritance did work except one thing, The abstract class does not have any bindings even then target elements are generated without any binding union the bindindgs of the inherited rule.

Thank you once again
Re: creating two different target elements from one source element based on its subtypes [message #915001 is a reply to message #912815] Sun, 16 September 2012 06:00 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo, Yes the rule inheritance did work. Except for one thing that the abstract class if there is no binding the target elements are still created which are empty union with the the bindings of the inherited rule.

Thank you once again.
Re: creating two different target elements from one source element based on its subtypes [message #915002 is a reply to message #912815] Sun, 16 September 2012 06:04 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo. The rule inheritance did work except one thing, The abstract class does not have any bindings even then target elements are generated without any binding union the bindindgs of the inherited rule.

Thank you once again
Re: creating two different target elements from one source element based on its subtypes [message #915007 is a reply to message #912815] Sun, 16 September 2012 06:00 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo, Yes the rule inheritance did work. Except for one thing that the abstract class if there is no binding the target elements are still created which are empty union with the the bindings of the inherited rule.

Thank you once again.
Re: creating two different target elements from one source element based on its subtypes [message #915008 is a reply to message #912815] Sun, 16 September 2012 06:04 Go to previous message
noi poi is currently offline noi poiFriend
Messages: 29
Registered: June 2012
Junior Member
Thank you so much Hugo. The rule inheritance did work except one thing, The abstract class does not have any bindings even then target elements are generated without any binding union the bindindgs of the inherited rule.

Thank you once again
Previous Topic:ATL plugin with two IN metamodels
Next Topic:ATL Plugin Feature 'literal' not found error
Goto Forum:
  


Current Time: Thu Mar 28 11:00:34 GMT 2024

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

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

Back to the top