Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Question about imperative do blocks in ATL(Effect of using a specific command in imperative do blocks of ATL rules)
Question about imperative do blocks in ATL [message #1794106] Thu, 23 August 2018 15:26 Go to next message
Gehan Mustafa Kamel Selim is currently offline Gehan Mustafa Kamel SelimFriend
Messages: 7
Registered: August 2018
Junior Member
I am performing a study to understand how the different ATL features are used in the ATL Zoo (http://www.eclipse.org/atl/atlTransformations/).
I noticed in many transformations in the ATL zoo, an imperative do block would contain only a variable name followed by a semi colon (where this variable could be a target pattern element).

For example:
"rule Category(name : String, desc : String) {
to
cat : Measure!Category (
name <- name,
desc <- desc
)
do { cat; }}".

I cannot seem to find in the ATL documentation what would be the effect of such a command ? Is this only for debugging purposes (i.e., to show the value of the variable"cat" in the above example in the console) ? or would this result in returning the value of "cat" as the return value of the rule ?

Thanks a lot in advance...
Re: Question about imperative do blocks in ATL [message #1794189 is a reply to message #1794106] Mon, 27 August 2018 07:37 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 555
Registered: July 2009
Senior Member
the latter, this is used for called lazy rule
Re: Question about imperative do blocks in ATL [message #1794197 is a reply to message #1794189] Mon, 27 August 2018 11:10 Go to previous messageGo to next message
Gehan Mustafa Kamel Selim is currently offline Gehan Mustafa Kamel SelimFriend
Messages: 7
Registered: August 2018
Junior Member
Thank you veryy much !
Re: Question about imperative do blocks in ATL [message #1794309 is a reply to message #1794197] Tue, 28 August 2018 18:01 Go to previous messageGo to next message
Gehan Mustafa Kamel Selim is currently offline Gehan Mustafa Kamel SelimFriend
Messages: 7
Registered: August 2018
Junior Member
Just to follow up on my previous question, I found a transformation with the following called rule:
rule MeasureSet2ValueRow(ms : Measure!MeasureSet) {
to
retval : Table!Row (
cells <- blabla,
cells <- blabla)
do {
retval; }
}

Then, in the same transformation, another called rule invoked the above called rule as follows:
rows <- allMeasSet->
collect(ms|thisModule.MeasureSet2ValueRow(ms))

Thus, in the latter rule invocation, the return value of the called rule was not assigned to a specific value (they were only accumulated using the collect operation, but without assigning the return value to variables).
My question is, since the return value of MeasureSet2ValueRow in the invocation wasn't assigned to a variable, would this rule invocation have still worked if the rule MeasureSet2ValueRow didnot have a do block? If not, why not ? If yes, then what''s the need for "retval;" in the do block of the rule MeasureSet2ValueRow ?
Thanks a lot !
Re: Question about imperative do blocks in ATL [message #1794310 is a reply to message #1794197] Tue, 28 August 2018 18:02 Go to previous messageGo to next message
Gehan Mustafa Kamel Selim is currently offline Gehan Mustafa Kamel SelimFriend
Messages: 7
Registered: August 2018
Junior Member
Just to follow up on my previous question, I found a transformation with the following called rule:
rule MeasureSet2ValueRow(ms : Measure!MeasureSet) {
to
retval : Table!Row (
cells <- blabla,
cells <- blabla)
do {
retval; }
}

Then, in the same transformation, another called rule invoked the above called rule as follows:
rows <- allMeasSet->
collect(ms|thisModule.MeasureSet2ValueRow(ms))

Thus, in the latter rule invocation, the return value of the called rule was not assigned to a specific value (they were only accumulated using the collect operation, but without assigning the return value to variables).
My question is, since the return value of MeasureSet2ValueRow in the invocation wasn't assigned to a variable, would this rule invocation have still worked if the rule MeasureSet2ValueRow didnot have a do block? If not, why not ? If yes, then what''s the need for "retval;" in the do block of the rule MeasureSet2ValueRow ?
Thanks a lot !
Re: Question about imperative do blocks in ATL [message #1794353 is a reply to message #1794310] Wed, 29 August 2018 12:48 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 555
Registered: July 2009
Senior Member
No this is mandatory if I recall correctly.
Indeed when there's only one element created it seems a bit useless since it can only be this one...
I believe it works by grabbing the elements on the top of the stack which is what it does when you add the elements at the end of the do block. The syntax leads you to believe there is a return value but that's not the case, a rule has no return value.
Re: Question about imperative do blocks in ATL [message #1794372 is a reply to message #1794353] Wed, 29 August 2018 16:23 Go to previous messageGo to next message
Gehan Mustafa Kamel Selim is currently offline Gehan Mustafa Kamel SelimFriend
Messages: 7
Registered: August 2018
Junior Member
Thanks a lot !
One thing that still confuses me, is that you mention that the called rule shouldn't work if that do block wasn't there since it's mandatory. However I do not recall anywhere in the ATL documentation that it is stated that a called rule must have a do block with at least one variable name followed by a semi colon so that it can function properly, or am I missing something ?

Besides, based on my limited experience with ATL, I've used called rules several times without adding a "var;" in the do block of these called rules and they still gave the expected output. I'd be grateful if you can give me a more detailed explanation of how is this possible..

Also, if we do not call this a return value, what would be an appropriate name to use when referring to such cases ? I'm asking because since I'm doing a study on these features, I want to make sure that I refer to them with their correct names.

Thanks a lot in advance and apologies for the long post :)
Re: Question about imperative do blocks in ATL [message #1794424 is a reply to message #1794372] Thu, 30 August 2018 13:09 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 555
Registered: July 2009
Senior Member
Ok I refreshed my memory a bit.
I think this pattern was mandatory but isn't now.

Still you can use it to specify what should be returned from a lazy rule if you create multiple elements there.
E.g. you create a container element in a lazy rule and a sub-element for it but you just want to manipulate the container element and not the second one since it's embedded in the container element.

Some topics on this forum talk about that (https://www.eclipse.org/forums/index.php/t/529803/ for example)
Previous Topic:Writing to a specific LOG file
Next Topic:Couldn`t get access to some documentation of ATL transformation
Goto Forum:
  


Current Time: Thu Sep 20 18:01:27 GMT 2018

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

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

Back to the top