Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Need help with iterate() expression.
[ATL] Need help with iterate() expression. [message #94998] Mon, 10 November 2008 19:23 Go to next message
Juan Pedro Silva is currently offline Juan Pedro SilvaFriend
Messages: 258
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020808080609080108080508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi everybody.
I'm new to ATL, and currently working on a UML2 -> TargetMetamodel
transformation.
I've been dealing with most problems by myself so far, thanks to your
documentation and posts in the newsgroup, but now I'm stuck and could
use some help.

The problem is the following: I'm trying to transform UML2!Interface
into TargetMetamodel !Interface, but as TargetMetamodel has no
generalization association, I need to somehow "flatten" the interface's
hierarchy, and add all inherited operations to the target Interface.

I took the approach of using a "iterate()" operation:

*rule* Interface
{
* from *
iO : UML2!Interface
* using*
{
seqInt : Sequence(UML2!Interface) =
iO.general.asSequence(); --Tryed "iO.redefinedInterface.asSequence();"
with the same result
}
* to*
iD : TargetMetamodel!Interface
(
name <- iO.name,
operations <- seqInt->iterate
( e ; res : Sequence(UML2!Operation) =
iO.ownedOperation.asSequence() |
res->append(e.ownedOperation)
)
)
}

The rule above seems right to me. However, I only get the operations
defined in the current Interface.
What am I doing wrong?.

Any suggestions, including other approaches, will be greatly appreciated.
Regards,
Juan Pedro

--------------020808080609080108080508
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi everybody.<br>
I'm new to ATL, and currently working on a UML2 -&gt; TargetMetamodel
transformation.<br>
I've been dealing with most problems by myself so far, thanks to your
documentation and posts in the newsgroup, but now I'm stuck and could
use some help.<br>
<br>
The problem is the following: I'm trying to transform UML2!Interface
into TargetMetamodel !Interface, but as TargetMetamodel has no
generalization association, I need to somehow "flatten" the interface's
hierarchy, and add all inherited operations to the target Interface.<br>
<br>
I took the approach of using a "iterate()" operation:<br>
<br>
<b>rule</b> Interface<br>
{<br>
&nbsp;<b>&nbsp;&nbsp; from </b><br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; iO&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; UML2!Interface<br>
<b>&nbsp;&nbsp;&nbsp; using</b><br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; seqInt&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; Sequence(UML2!Interface) = &nbsp;&nbsp;&nbsp;
iO.general.asSequence(); --Tryed "iO.redefinedInterface.asSequence();"
with the same result<br>
&nbsp;&nbsp;&nbsp; }<br>
<b>&nbsp;&nbsp;&nbsp; to</b><br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; iD&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; TargetMetamodel!Interface<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name &lt;- iO.name,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; operations &lt;- &nbsp;&nbsp;&nbsp; seqInt-&gt;iterate<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ( e ; res : Sequence(UML2!Operation) =
iO.ownedOperation.asSequence() |<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
res-&gt;append(e.ownedOperation) <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; )&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; )<br>
}<br>
<br>
The rule above seems right to me. However, I only get the operations
defined in the current Interface.<br>
What am I doing wrong?.<br>
<br>
Any suggestions, including other approaches, will be greatly
appreciated. <br>
Regards,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Juan Pedro<br>
</body>
</html>

--------------020808080609080108080508--
Re: [ATL] Need help with iterate() expression. [message #95071 is a reply to message #94998] Tue, 11 November 2008 12:21 Go to previous message
Juan Pedro Silva is currently offline Juan Pedro SilvaFriend
Messages: 258
Registered: July 2009
Senior Member
Solved it.
I used "distinct-foreach", and end up with a complicated thing that at
least does what I wanted.
Thank you anyhow.

Juan Pedro Silva escribió:
> Hi everybody.
> I'm new to ATL, and currently working on a UML2 -> TargetMetamodel
> transformation.
> I've been dealing with most problems by myself so far, thanks to your
> documentation and posts in the newsgroup, but now I'm stuck and could
> use some help.
>
> The problem is the following: I'm trying to transform UML2!Interface
> into TargetMetamodel !Interface, but as TargetMetamodel has no
> generalization association, I need to somehow "flatten" the
> interface's hierarchy, and add all inherited operations to the target
> Interface.
>
> I took the approach of using a "iterate()" operation:
>
> *rule* Interface
> {
> * from *
> iO : UML2!Interface
> * using*
> {
> seqInt : Sequence(UML2!Interface) =
> iO.general.asSequence(); --Tryed "iO.redefinedInterface.asSequence();"
> with the same result
> }
> * to*
> iD : TargetMetamodel!Interface
> (
> name <- iO.name,
> operations <- seqInt->iterate
> ( e ; res : Sequence(UML2!Operation) =
> iO.ownedOperation.asSequence() |
> res->append(e.ownedOperation)
> )
> )
> }
>
> The rule above seems right to me. However, I only get the operations
> defined in the current Interface.
> What am I doing wrong?.
>
> Any suggestions, including other approaches, will be greatly appreciated.
> Regards,
> Juan Pedro
Previous Topic:Thanks so much!
Next Topic:[ATL] Match Stereotypes
Goto Forum:
  


Current Time: Thu Apr 25 11:14:06 GMT 2024

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

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

Back to the top