Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] PackageMerge + couple of questions
[ATL] PackageMerge + couple of questions [message #12970] Sat, 27 January 2007 17:27 Go to next message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hey,

I am trying my hand at ATL and finding it a bit tricky. How does anyone
learn this language - I have been trying for hours to understand it but
anything other than simple expressions and transformations seem very
complicated to me. I've read all the material on the ATL eclipse site. I
tried the tutorial and messed around with the expression calculator and
it helped a lot. Does anyone have any recommendations for other material
on the subject to learn from?

I am using UML2. I am trying to merge two packages when I find a
PackageMerge association by just taking a union of the mergedPackage and
the receivingPackage.

The rules below show what I did. I am not sure why assigning to the
packagedElement in Package won't work. I tried the same assignment and
concat'ed to the end of the name (just to debug it) and it does work.

Also my source uml file has the following format.

Model
--->Package
------>Package1
---------->Class1
------>Package2
---------->Class2

but when the model is transformed the model and merged package seem to
be on the same level - I have lost the nesting. How does one preserve
the nesting of elements?

Is there a FAQ on how to use the debugger for ATL in eclipse? I switch
to debug perspective and run it in debug but it won't allow me to step
through and I'm not sure what exactly I should be looking at/for.

Thanks much,
Andrew

module UMLTestl;
create OUT : UML from IN : UML;

uses Strings;
uses MergeHelpers;

rule Model
{
from s : UML!Model
to d : UML!Model mapsTo s
(
name <- s.name
)
}

rule PackageMerge
{
from s : UML!PackageMerge
to d : UML!Package
(
name <- 'MergedPackage ' +
s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)- >collect(e
| e.name).toString(),
packagedElement <-
s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)
)
}
Re: [ATL] PackageMerge + couple of questions [message #12999 is a reply to message #12970] Sun, 28 January 2007 12:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jairson.gmail.com

Hi Andrew:

To use the debug tool in the ATL 2006 make sure that the package
org.atl.eclipse.adt.debug is ADTDebugForEclipse3_1 . When in ATL2006
CVS, change to the package explorer view, right click on the
org.atl.adt.debug package and choose Team, Switch to another branch or
version. Then click on Refresh to be able to navigate through the
Branches, you should on open the Branch tree click on
ADTDebugForEclipse3_1 and choose the button Finish.

Back to the debug view, you click on the small bug and wait till it
connects. Then it should perform the step operation.

Regarding ATL tutorials, I think the ATL Manual is a valuable resource,
but you won´t find "advanced" topics there. You should search the former
yahoo atl groups or post questions on this list.

Good Luck,

Jairson Vitorino

Andrew Carton wrote:
> Hey,
>
> I am trying my hand at ATL and finding it a bit tricky. How does anyone
> learn this language - I have been trying for hours to understand it but
> anything other than simple expressions and transformations seem very
> complicated to me. I've read all the material on the ATL eclipse site. I
> tried the tutorial and messed around with the expression calculator and
> it helped a lot. Does anyone have any recommendations for other material
> on the subject to learn from?
>
> I am using UML2. I am trying to merge two packages when I find a
> PackageMerge association by just taking a union of the mergedPackage and
> the receivingPackage.
>
> The rules below show what I did. I am not sure why assigning to the
> packagedElement in Package won't work. I tried the same assignment and
> concat'ed to the end of the name (just to debug it) and it does work.
>
> Also my source uml file has the following format.
>
> Model
> --->Package
> ------>Package1
> ---------->Class1
> ------>Package2
> ---------->Class2
>
> but when the model is transformed the model and merged package seem to
> be on the same level - I have lost the nesting. How does one preserve
> the nesting of elements?
>
> Is there a FAQ on how to use the debugger for ATL in eclipse? I switch
> to debug perspective and run it in debug but it won't allow me to step
> through and I'm not sure what exactly I should be looking at/for.
>
> Thanks much,
> Andrew
>
> module UMLTestl;
> create OUT : UML from IN : UML;
>
> uses Strings;
> uses MergeHelpers;
>
> rule Model
> {
> from s : UML!Model
> to d : UML!Model mapsTo s
> (
> name <- s.name
> )
> }
>
> rule PackageMerge
> {
> from s : UML!PackageMerge
> to d : UML!Package
> (
> name <- 'MergedPackage ' +
> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)- >collect(e
> | e.name).toString(),
> packagedElement <-
> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)
> )
> }
Re: [ATL] PackageMerge + couple of questions [message #13028 is a reply to message #12999] Sun, 28 January 2007 15:38 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi,

Jairson, thank you for providing this information.

Let me add a couple of points:

- The ATL transformation library contains more than 140 transformations
in more than 70 scenarios. Studying these transformations will teach you
how to solve common (or less common) problems in ATL. It is available at
the following address:
http://www.eclipse.org/m2m/atl/atlTransformations/

- About "assigning to the packagedElement in Package".
When transforming models, it is very helpful to have metamodels
uncluttered with such hardwired constraints. This means that simple EMF
metamodels (such as generated from KM3) will be very easy to use,
whereas plugins like UML2 can prove more complex to learn.

Not only is UML2 larger than most metamodels, but its Eclipse plugin
implementation adds many constraints, that are often not useful for
model transformation. I wished they provided two modes: UML2 data model
for UML2 case tools (with all the constraints checking), and UML2
*metamodel* (with close to no constraint) for transformation purposes.

Of course, the constraints would need to be checked once the
transformation has been totally executed. But enforcing them at every
step proves very inconvenient.


Regards,

Frédéric Jouault


Jairson wrote:
> Hi Andrew:
>
> To use the debug tool in the ATL 2006 make sure that the package
> org.atl.eclipse.adt.debug is ADTDebugForEclipse3_1 . When in ATL2006
> CVS, change to the package explorer view, right click on the
> org.atl.adt.debug package and choose Team, Switch to another branch or
> version. Then click on Refresh to be able to navigate through the
> Branches, you should on open the Branch tree click on
> ADTDebugForEclipse3_1 and choose the button Finish.
>
> Back to the debug view, you click on the small bug and wait till it
> connects. Then it should perform the step operation.
>
> Regarding ATL tutorials, I think the ATL Manual is a valuable resource,
> but you won´t find "advanced" topics there. You should search the former
> yahoo atl groups or post questions on this list.
>
> Good Luck,
>
> Jairson Vitorino
>
> Andrew Carton wrote:
>> Hey,
>>
>> I am trying my hand at ATL and finding it a bit tricky. How does
>> anyone learn this language - I have been trying for hours to
>> understand it but anything other than simple expressions and
>> transformations seem very complicated to me. I've read all the
>> material on the ATL eclipse site. I tried the tutorial and messed
>> around with the expression calculator and it helped a lot. Does anyone
>> have any recommendations for other material on the subject to learn from?
>>
>> I am using UML2. I am trying to merge two packages when I find a
>> PackageMerge association by just taking a union of the mergedPackage
>> and the receivingPackage.
>>
>> The rules below show what I did. I am not sure why assigning to the
>> packagedElement in Package won't work. I tried the same assignment and
>> concat'ed to the end of the name (just to debug it) and it does work.
>>
>> Also my source uml file has the following format.
>>
>> Model
>> --->Package
>> ------>Package1
>> ---------->Class1
>> ------>Package2
>> ---------->Class2
>>
>> but when the model is transformed the model and merged package seem to
>> be on the same level - I have lost the nesting. How does one preserve
>> the nesting of elements?
>>
>> Is there a FAQ on how to use the debugger for ATL in eclipse? I switch
>> to debug perspective and run it in debug but it won't allow me to step
>> through and I'm not sure what exactly I should be looking at/for.
>>
>> Thanks much,
>> Andrew
>>
>> module UMLTestl;
>> create OUT : UML from IN : UML;
>>
>> uses Strings;
>> uses MergeHelpers;
>>
>> rule Model
>> {
>> from s : UML!Model
>> to d : UML!Model mapsTo s
>> (
>> name <- s.name
>> )
>> }
>>
>> rule PackageMerge
>> {
>> from s : UML!PackageMerge
>> to d : UML!Package
>> (
>> name <- 'MergedPackage ' +
>> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)- >collect(e
>> | e.name).toString(),
>> packagedElement <-
>> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)
>>
>> )
>> }
Re: [ATL] PackageMerge + couple of questions [message #13057 is a reply to message #12970] Sun, 28 January 2007 17:04 Go to previous messageGo to next message
Jean Bezivin is currently offline Jean BezivinFriend
Messages: 38
Registered: July 2009
Member
Dear Andrew,

In addition to the other answers to your question,
the pedagogical material on ATL should clearly be improved.

This will happen with time and with the collaboration of the
whole community. One problem we have is that some
courses are not presently available in English but only in German
or French for example. I do believe that some of these courses
are nevertheless useful, and could help newcomers to
learn more rapidly the language. Below for example there
is a pointer on the work of the ENSEEIHT guys in Toulouse, France
who are using ATL for their students and in the context
of the well-known TOPCASED project:

http://combemale.perso.enseeiht.fr/teaching/metamodeling/sli des/IDM-ATL.pdf

There are several universities and engineer schools that are
currently illustrating the principles of MDA with ATL hands on exercises.
If we could share some of the corresponding pedagogical material
on this newsgroup, that could be useful to all,

Best regards,

Jean

"Andrew Carton" <cartona@cs.tcd.ie> a
Re: [ATL] PackageMerge + couple of questions [message #13172 is a reply to message #13028] Mon, 29 January 2007 15:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khussey.ca.ibm.com

Fr
Re: [ATL] PackageMerge + couple of questions [message #13200 is a reply to message #13172] Mon, 29 January 2007 16:43 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Kenn,

Thank you for your answer.

However, I am a bit surprised by your statement. I must admit that I am
not an expert in the UML2 plugin, but we have had numerous users
reporting problems with constraints.

Here is an example:
- ATL creates a UML2 model using the standard EMF API (ATL is not
UML2-specific and works with every EMF metamodel)
- ATL loads a UML2 Profile P containing Stereotype S
- a transformation creates a Model M and a Class C
- S is applied to C
=> this triggers an error

Whereas, if we proceed as follows:
- apply P to M
- put C into M
- apply S to C

then there is no error.

There is obviously a constraint stating that you cannot apply a
stereotype to a class unless this class is contained in a model on which
the corresponding profile is applied. And this constraint is checked
before the all transformation has been executed.


We obtain this behavior when dealing with UML2 the same way as we do
with every other EMF metamodel. Is there some kind of transaction mode,
which would delay constraint checking? How can we select this mode?


Regards,

Frédéric Jouault


Kenn Hussey wrote:
> Frédéric,
>
> The UML2 component of MDT does not enforce the execution of the constraints
> that it defines - this is typically done on-demand... so perhaps it's the
> transformation engine that is "enforcing them at every step"?
>
> Kenn
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:epig1f$71s$1@utils.eclipse.org...
>> Hi,
>>
>> Jairson, thank you for providing this information.
>>
>> Let me add a couple of points:
>>
>> - The ATL transformation library contains more than 140 transformations in
>> more than 70 scenarios. Studying these transformations will teach you how
>> to solve common (or less common) problems in ATL. It is available at the
>> following address:
>> http://www.eclipse.org/m2m/atl/atlTransformations/
>>
>> - About "assigning to the packagedElement in Package".
>> When transforming models, it is very helpful to have metamodels
>> uncluttered with such hardwired constraints. This means that simple EMF
>> metamodels (such as generated from KM3) will be very easy to use, whereas
>> plugins like UML2 can prove more complex to learn.
>>
>> Not only is UML2 larger than most metamodels, but its Eclipse plugin
>> implementation adds many constraints, that are often not useful for model
>> transformation. I wished they provided two modes: UML2 data model for UML2
>> case tools (with all the constraints checking), and UML2 *metamodel* (with
>> close to no constraint) for transformation purposes.
>>
>> Of course, the constraints would need to be checked once the
>> transformation has been totally executed. But enforcing them at every step
>> proves very inconvenient.
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Jairson wrote:
>>> Hi Andrew:
>>>
>>> To use the debug tool in the ATL 2006 make sure that the package
>>> org.atl.eclipse.adt.debug is ADTDebugForEclipse3_1 . When in ATL2006 CVS,
>>> change to the package explorer view, right click on the org.atl.adt.debug
>>> package and choose Team, Switch to another branch or version. Then click
>>> on Refresh to be able to navigate through the Branches, you should on
>>> open the Branch tree click on ADTDebugForEclipse3_1 and choose the button
>>> Finish.
>>>
>>> Back to the debug view, you click on the small bug and wait till it
>>> connects. Then it should perform the step operation.
>>>
>>> Regarding ATL tutorials, I think the ATL Manual is a valuable resource,
>>> but you won´t find "advanced" topics there. You should search the former
>>> yahoo atl groups or post questions on this list.
>>>
>>> Good Luck,
>>>
>>> Jairson Vitorino
>>>
>>> Andrew Carton wrote:
>>>> Hey,
>>>>
>>>> I am trying my hand at ATL and finding it a bit tricky. How does anyone
>>>> learn this language - I have been trying for hours to understand it but
>>>> anything other than simple expressions and transformations seem very
>>>> complicated to me. I've read all the material on the ATL eclipse site. I
>>>> tried the tutorial and messed around with the expression calculator and
>>>> it helped a lot. Does anyone have any recommendations for other material
>>>> on the subject to learn from?
>>>>
>>>> I am using UML2. I am trying to merge two packages when I find a
>>>> PackageMerge association by just taking a union of the mergedPackage and
>>>> the receivingPackage.
>>>>
>>>> The rules below show what I did. I am not sure why assigning to the
>>>> packagedElement in Package won't work. I tried the same assignment and
>>>> concat'ed to the end of the name (just to debug it) and it does work.
>>>>
>>>> Also my source uml file has the following format.
>>>>
>>>> Model
>>>> --->Package
>>>> ------>Package1
>>>> ---------->Class1
>>>> ------>Package2
>>>> ---------->Class2
>>>>
>>>> but when the model is transformed the model and merged package seem to
>>>> be on the same level - I have lost the nesting. How does one preserve
>>>> the nesting of elements?
>>>>
>>>> Is there a FAQ on how to use the debugger for ATL in eclipse? I switch
>>>> to debug perspective and run it in debug but it won't allow me to step
>>>> through and I'm not sure what exactly I should be looking at/for.
>>>>
>>>> Thanks much,
>>>> Andrew
>>>>
>>>> module UMLTestl;
>>>> create OUT : UML from IN : UML;
>>>>
>>>> uses Strings;
>>>> uses MergeHelpers;
>>>>
>>>> rule Model
>>>> {
>>>> from s : UML!Model
>>>> to d : UML!Model mapsTo s
>>>> (
>>>> name <- s.name
>>>> )
>>>> }
>>>>
>>>> rule PackageMerge
>>>> {
>>>> from s : UML!PackageMerge
>>>> to d : UML!Package
>>>> (
>>>> name <- 'MergedPackage ' +
>>>> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)- >collect(e
>>>> | e.name).toString(),
>>>> packagedElement <-
>>>> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)
>>>> )
>>>> }
>
>
Re: [ATL] PackageMerge + couple of questions [message #13227 is a reply to message #13200] Mon, 29 January 2007 19:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khussey.ca.ibm.com

Fr
Re: [ATL] PackageMerge + couple of questions [message #13255 is a reply to message #13227] Mon, 29 January 2007 20:21 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Kenn,

I agree that it is very nice for the UML2 API to check these conditions.
This is what I called the "UML2 data model for UML2 case tools" mode.

However, in the context of model transformation, a model is only
required to be valid at the end. Enforcing its validity at every step
makes writing transformations unnecessarily complex.

EMF is very well adapted to model transformation. The EMF driver of ATL
can normally handle any EMF metamodel. Because the UML2 plugin adds so
many constraints at every step, it is not so well adapted. Although the
EMF driver of ATL can handle UML2 models, the constraints are still
imposed on transformation developers.



I wish the UML2 plugin provided a "UML2 metamodel" interface that
behaved like most EMF metamodels with respect to constraints. Do you
believe this is likely to happen?


The solution we are currently working on (see one of the previous posts
by Christophe le Camus on this newsgroup) involves a UML2-specific
driver for ATL. Its main additional task, when compared to the EMF
driver, is to delay profiles and stereotypes applications until the end
of the transformation and to ensure proper reordering. This way, a
transformation developer does not even need to know about the constraints.

I personally do not feel comfortable having to support any metamodel
individually: it does not feel like MDE. We only considered working on
this solution because the UML2 plugin is widely used.


Regards,

Frédéric Jouault


Kenn Hussey wrote:
> Frédéric,
>
> Sorry, I thought you were referring to the OCL constraints that define what
> constitutes a 'valid" model (as defined in the specification). You're right,
> may of the custom operations defined on the API have preconditions that must
> be satisfied in order to be executed - as is common practice with APIs. I'm
> not sure it makes sense to relax these preconditions, however, since they
> are generally needed to preserve the integrity of the model (often in the
> absence of explicit rules to do so)...
>
> Kenn
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:epl87u$78k$1@utils.eclipse.org...
>> Kenn,
>>
>> Thank you for your answer.
>>
>> However, I am a bit surprised by your statement. I must admit that I am
>> not an expert in the UML2 plugin, but we have had numerous users reporting
>> problems with constraints.
>>
>> Here is an example:
>> - ATL creates a UML2 model using the standard EMF API (ATL is not
>> UML2-specific and works with every EMF metamodel)
>> - ATL loads a UML2 Profile P containing Stereotype S
>> - a transformation creates a Model M and a Class C
>> - S is applied to C
>> => this triggers an error
>>
>> Whereas, if we proceed as follows:
>> - apply P to M
>> - put C into M
>> - apply S to C
>>
>> then there is no error.
>>
>> There is obviously a constraint stating that you cannot apply a stereotype
>> to a class unless this class is contained in a model on which the
>> corresponding profile is applied. And this constraint is checked before
>> the all transformation has been executed.
>>
>>
>> We obtain this behavior when dealing with UML2 the same way as we do with
>> every other EMF metamodel. Is there some kind of transaction mode, which
>> would delay constraint checking? How can we select this mode?
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Kenn Hussey wrote:
>>> Frédéric,
>>>
>>> The UML2 component of MDT does not enforce the execution of the
>>> constraints that it defines - this is typically done on-demand... so
>>> perhaps it's the transformation engine that is "enforcing them at every
>>> step"?
>>>
>>> Kenn
>>>
>>> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
>>> news:epig1f$71s$1@utils.eclipse.org...
>>>> Hi,
>>>>
>>>> Jairson, thank you for providing this information.
>>>>
>>>> Let me add a couple of points:
>>>>
>>>> - The ATL transformation library contains more than 140 transformations
>>>> in more than 70 scenarios. Studying these transformations will teach you
>>>> how to solve common (or less common) problems in ATL. It is available at
>>>> the following address:
>>>> http://www.eclipse.org/m2m/atl/atlTransformations/
>>>>
>>>> - About "assigning to the packagedElement in Package".
>>>> When transforming models, it is very helpful to have metamodels
>>>> uncluttered with such hardwired constraints. This means that simple EMF
>>>> metamodels (such as generated from KM3) will be very easy to use,
>>>> whereas plugins like UML2 can prove more complex to learn.
>>>>
>>>> Not only is UML2 larger than most metamodels, but its Eclipse plugin
>>>> implementation adds many constraints, that are often not useful for
>>>> model transformation. I wished they provided two modes: UML2 data model
>>>> for UML2 case tools (with all the constraints checking), and UML2
>>>> *metamodel* (with close to no constraint) for transformation purposes.
>>>>
>>>> Of course, the constraints would need to be checked once the
>>>> transformation has been totally executed. But enforcing them at every
>>>> step proves very inconvenient.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Frédéric Jouault
>>>>
>>>>
>>>> Jairson wrote:
>>>>> Hi Andrew:
>>>>>
>>>>> To use the debug tool in the ATL 2006 make sure that the package
>>>>> org.atl.eclipse.adt.debug is ADTDebugForEclipse3_1 . When in ATL2006
>>>>> CVS, change to the package explorer view, right click on the
>>>>> org.atl.adt.debug package and choose Team, Switch to another branch or
>>>>> version. Then click on Refresh to be able to navigate through the
>>>>> Branches, you should on open the Branch tree click on
>>>>> ADTDebugForEclipse3_1 and choose the button Finish.
>>>>>
>>>>> Back to the debug view, you click on the small bug and wait till it
>>>>> connects. Then it should perform the step operation.
>>>>>
>>>>> Regarding ATL tutorials, I think the ATL Manual is a valuable resource,
>>>>> but you won´t find "advanced" topics there. You should search the
>>>>> former yahoo atl groups or post questions on this list.
>>>>>
>>>>> Good Luck,
>>>>>
>>>>> Jairson Vitorino
>>>>>
>>>>> Andrew Carton wrote:
>>>>>> Hey,
>>>>>>
>>>>>> I am trying my hand at ATL and finding it a bit tricky. How does
>>>>>> anyone learn this language - I have been trying for hours to
>>>>>> understand it but anything other than simple expressions and
>>>>>> transformations seem very complicated to me. I've read all the
>>>>>> material on the ATL eclipse site. I tried the tutorial and messed
>>>>>> around with the expression calculator and it helped a lot. Does anyone
>>>>>> have any recommendations for other material on the subject to learn
>>>>>> from?
>>>>>>
>>>>>> I am using UML2. I am trying to merge two packages when I find a
>>>>>> PackageMerge association by just taking a union of the mergedPackage
>>>>>> and the receivingPackage.
>>>>>>
>>>>>> The rules below show what I did. I am not sure why assigning to the
>>>>>> packagedElement in Package won't work. I tried the same assignment and
>>>>>> concat'ed to the end of the name (just to debug it) and it does work.
>>>>>>
>>>>>> Also my source uml file has the following format.
>>>>>>
>>>>>> Model
>>>>>> --->Package
>>>>>> ------>Package1
>>>>>> ---------->Class1
>>>>>> ------>Package2
>>>>>> ---------->Class2
>>>>>>
>>>>>> but when the model is transformed the model and merged package seem to
>>>>>> be on the same level - I have lost the nesting. How does one preserve
>>>>>> the nesting of elements?
>>>>>>
>>>>>> Is there a FAQ on how to use the debugger for ATL in eclipse? I switch
>>>>>> to debug perspective and run it in debug but it won't allow me to step
>>>>>> through and I'm not sure what exactly I should be looking at/for.
>>>>>>
>>>>>> Thanks much,
>>>>>> Andrew
>>>>>>
>>>>>> module UMLTestl;
>>>>>> create OUT : UML from IN : UML;
>>>>>>
>>>>>> uses Strings;
>>>>>> uses MergeHelpers;
>>>>>>
>>>>>> rule Model
>>>>>> {
>>>>>> from s : UML!Model
>>>>>> to d : UML!Model mapsTo s
>>>>>> (
>>>>>> name <- s.name
>>>>>> )
>>>>>> }
>>>>>>
>>>>>> rule PackageMerge
>>>>>> {
>>>>>> from s : UML!PackageMerge
>>>>>> to d : UML!Package
>>>>>> (
>>>>>> name <- 'MergedPackage ' +
>>>>>> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)- >collect(e
>>>>>> | e.name).toString(),
>>>>>> packagedElement <-
>>>>>> s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)
>>>>>> )
>>>>>> }
>
Re: [ATL] PackageMerge + couple of questions [message #13283 is a reply to message #13255] Mon, 29 January 2007 21:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khussey.ca.ibm.com

Fr
Re: [ATL] PackageMerge + couple of questions [message #13311 is a reply to message #13283] Tue, 30 January 2007 01:26 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Kenn,

> It doesn't seem unreasonable to me that if your transformation uses
> domain-specific (i.e. metamodel-specific) operations, it needs to satisfy
> the preconditions of those operations;

I fully agree with you.

However, model transformation is about transforming a source model given
in a specific state into a target model also in a specific state. The
models are not supposed to evolve as they do in a CASE tool. Therefore,
operations rarely matter in this context.


> structurally (i.e. with respect to
> features only), UML2 is like any other EMF-based metamodel.

Well, profiles and stereotypes do not feel like behavioral features to
me. However, because there are implemented as such, they cannot be
handled structurally. Since most UML2 user use profiles, they are
unfortunately in the case where UML2 is not like any other EMF-based
metamodel.

My personal belief is that:
1- Structural elements should be implemented using StructuralFeatures only.
2- Structural elements that are nonetheless implemented as operations
(i.e., when rule 1 has to be broken) should behave like
StructuralFeatures as much as possible, which includes not enforcing
conditions at every step.


> Note that it is
> likely possible to use alternative (but more verbose) APIs to work around
> the preconditions required by some of the operations (although doing so is
> at your own risk since you may inadvertantly violate the model integrity
> that the preconditions are there to preserve)...

This is something that I remember trying, with success, but spending
much time on it :-).

What about an alternative API with the same level of verbosity working
around the preconditions?

Ideally, the same API should be used in a kind of transaction mode,
where all conditions are checked in the end.


Regards,

Frédéric Jouault
Re: [ATL] PackageMerge + couple of questions [message #13338 is a reply to message #13311] Tue, 30 January 2007 14:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khussey.ca.ibm.com

Fr
Re: [ATL] PackageMerge + couple of questions [message #14029 is a reply to message #13338] Tue, 30 January 2007 18:06 Go to previous messageGo to next message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Thanks for all the info.

On the constraint thing - I am using a km3 of the uml 2 that I got from
one of the transformations on the website. How exactly do you specify
your model to use the UML2 API in eclipse ? (I didn't think this was
possible). Also I still don't understand why assigning to
"packagedElement" won't work. Is there some constraint explicitly
forbidding me from doing so?

Regards,
Andrew

Kenn Hussey wrote:
> Frédéric,
>
> To apply a stereotype, you already have two realtively non-verbose
> alternatives.
>
> 1) Use UMLUtil#safeApplyStereotype(Element, Stereotype) to ensure that the
> condition regarding profile application is satisfied for you.
>
> 2) Use code similar to the following (being sure to apply the profile at
> some point, possibly later, during the transformation):
>
> UMLUtil.setBaseElement(EcoreUtil.create(profile.getDefinitio n(stereotype)),
> element);
>
> Note that many of the operations in the API assume that the preconditions
> guaranteed by other (related) operations in the API have been met, so you'll
> need to be careful when doing things like #2.
>
> What are some of the other "constraints" that are giving you trouble?
>
> Kenn
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:epm6sq$7sl$1@utils.eclipse.org...
>> Kenn,
>>
>>> It doesn't seem unreasonable to me that if your transformation uses
>>> domain-specific (i.e. metamodel-specific) operations, it needs to satisfy
>>> the preconditions of those operations;
>> I fully agree with you.
>>
>> However, model transformation is about transforming a source model given
>> in a specific state into a target model also in a specific state. The
>> models are not supposed to evolve as they do in a CASE tool. Therefore,
>> operations rarely matter in this context.
>>
>>
>>> structurally (i.e. with respect to features only), UML2 is like any other
>>> EMF-based metamodel.
>> Well, profiles and stereotypes do not feel like behavioral features to
>> me. However, because there are implemented as such, they cannot be
>> handled structurally. Since most UML2 user use profiles, they are
>> unfortunately in the case where UML2 is not like any other EMF-based
>> metamodel.
>>
>> My personal belief is that:
>> 1- Structural elements should be implemented using StructuralFeatures
>> only.
>> 2- Structural elements that are nonetheless implemented as operations
>> (i.e., when rule 1 has to be broken) should behave like
>> StructuralFeatures as much as possible, which includes not enforcing
>> conditions at every step.
>>
>>
>>> Note that it is likely possible to use alternative (but more verbose)
>>> APIs to work around the preconditions required by some of the operations
>>> (although doing so is at your own risk since you may inadvertantly
>>> violate the model integrity that the preconditions are there to
>>> preserve)...
>> This is something that I remember trying, with success, but spending
>> much time on it :-).
>>
>> What about an alternative API with the same level of verbosity working
>> around the preconditions?
>>
>> Ideally, the same API should be used in a kind of transaction mode,
>> where all conditions are checked in the end.
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>
>
Re: [ATL] PackageMerge + couple of questions [message #14080 is a reply to message #14029] Tue, 30 January 2007 19:53 Go to previous message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
I figured out the solution! I tried an imperative solution.
I tried many variations to do this declaratively but I was unsuccessful.
I'd love to know how to do it declaratively for future reference though
if anyone has the time to figure it out. It seems you need to assign to
the packagedElement one at a time, you can't assign a set.

I tried some variations of this but it didn't work

packagedElement <-
s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement)- >iterate(e;
acc : String = '' | d.packagedElement.append(e))


Here is the imperative solution :)

rule PackageMerge
{
from s : UML!PackageMerge
to d : UML!Package mapsTo s
(
name <- 'MergedPackage ' + s.receivingPackage.name + ' '+
s.mergedPackage.name
)
do {
for (e in
s.receivingPackage.packagedElement->union(s.mergedPackage.packagedElement))
{
d.packagedElement <- e;
}
}
}

BTW what exactly does mapsTo mean in the rule - i believe you can leave
it out without any effect.


Thanks all,
Andrew
Previous Topic:Model format
Next Topic:[ATL] Are lazy rules 'evaluated' first than other rules?
Goto Forum:
  


Current Time: Fri Apr 26 06:45:26 GMT 2024

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

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

Back to the top