[ATL] Need help with iterate() expression. [message #94998] |
Mon, 10 November 2008 19:23 |
Juan Pedro Silva 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 -> 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>
<b> from </b><br>
iO : UML2!Interface<br>
<b> using</b><br>
{<br>
seqInt : Sequence(UML2!Interface) =
iO.general.asSequence(); --Tryed "iO.redefinedInterface.asSequence();"
with the same result<br>
}<br>
<b> to</b><br>
iD : TargetMetamodel!Interface<br>
(<br>
name <- iO.name,<br>
operations <- seqInt->iterate<br>
( e ; res : Sequence(UML2!Operation) =
iO.ownedOperation.asSequence() |<br>
res->append(e.ownedOperation) <br>
) <br>
)<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>
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 |
Juan Pedro Silva 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
|
|
|
Powered by
FUDForum. Page generated in 0.03315 seconds