Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] UML2 to UM2 transformation
[ATL] UML2 to UM2 transformation [message #63965] Sat, 13 October 2007 07:44 Go to next message
Eclipse UserFriend
Originally posted by: mani2s.gmx.de

Hello,

I want to transform a UML2-model (created with Topcased) to a UML2-model
in ATL.
My source-model use an own created profil vofi_profil.uml (created with
Topcased). The stereotypes are used in classes and in associations.

Now I want to exclude classes with stereotype i.e. <<Komplex>>, and
exclude associations (also compositions) with stereotype i.e. <<Needed>>.
I also need the multiplicies at the association-ends.

Do anybody know a approach to get the necessary information from the model?

Or an example (tutorial) for UML2 to UML2 transformation ?
Re: [ATL] UML2 to UM2 transformation [message #63989 is a reply to message #63965] Sat, 13 October 2007 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mani2s.gmx.de

:-D
Thank you in advance...

lg Mani
Re: [ATL] UML2 to UM2 transformation [message #64011 is a reply to message #63965] Mon, 15 October 2007 08:30 Go to previous messageGo to next message
Alfons Laarman is currently offline Alfons LaarmanFriend
Messages: 35
Registered: July 2009
Member
Hello Mani,

Have you looked at the examples here:
http://www.eclipse.org/m2m/atl/atlTransformations/ ?
Especially the UML2MOF example.


Regards,

Alfons

mani2s a écrit :
> Hello,
>
> I want to transform a UML2-model (created with Topcased) to a UML2-model
> in ATL. My source-model use an own created profil vofi_profil.uml
> (created with Topcased). The stereotypes are used in classes and in
> associations.
>
> Now I want to exclude classes with stereotype i.e. <<Komplex>>, and
> exclude associations (also compositions) with stereotype i.e. <<Needed>>.
> I also need the multiplicies at the association-ends.
>
> Do anybody know a approach to get the necessary information from the model?
>
> Or an example (tutorial) for UML2 to UML2 transformation ?
>
>
>
Re: [ATL] UML2 to UM2 transformation [message #64031 is a reply to message #63965] Mon, 15 October 2007 10:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: freddy.allilaire.univ-nantes.fr

Hi,

I advised to use superimposition mechanism
(http://wiki.eclipse.org/ATL_Superimposition).

In a first time you need to have a transformation that made a simple
copy of a UML2 model. You can use the UML2Copy transformation made by
Dennis and available here:
http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml 2cs-transformations/UML2Copy.atl?rev=7250&view=markup

Then, you need to write a transformation that will do the "exclusion".
For example:
----------------------------------
module UML2Filter;
create OUT : UML2 from IN : UML2, PRO : UML2;

helper context UML2!Element def : hasStereotype(s : String) : Boolean =
if self.getAppliedStereotypes()->select(e | e.name = s)->notEmpty() then
true
else
false
endif;

rule Class {
from
s : UML2!Class (not s.hasStereotype('Komplex'))
to
t : UML2!Class(

)
}
----------------------------------

HTH.

Regards,
Freddy.

mani2s a écrit :
> Hello,
>
> I want to transform a UML2-model (created with Topcased) to a UML2-model
> in ATL. My source-model use an own created profil vofi_profil.uml
> (created with Topcased). The stereotypes are used in classes and in
> associations.
>
> Now I want to exclude classes with stereotype i.e. <<Komplex>>, and
> exclude associations (also compositions) with stereotype i.e. <<Needed>>.
> I also need the multiplicies at the association-ends.
>
> Do anybody know a approach to get the necessary information from the model?
>
> Or an example (tutorial) for UML2 to UML2 transformation ?
>
>
>


--
Freddy Allilaire - ATLAS Group (INRIA & LINA)
http://www.sciences.univ-nantes.fr/lina/atl/contrib/allilair e
Re: [ATL] UML2 to UM2 transformation [message #64353 is a reply to message #64031] Fri, 19 October 2007 20:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mani2s.gmx.de

Hi,

I advised to use superimposition mechanism
(http://wiki.eclipse.org/ATL_Superimposition).

In a first time you need to have a transformation that made a simple copy
of a UML2 model. You can use the UML2Copy transformation made by Dennis
and available here:
http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml 2cs-transformations/UML2Copy.atl?rev=7250&view=markup

Then, you need to write a transformation that will do the "exclusion". For
example:
----------------------------------
module UML2Filter;
create OUT : UML2 from IN : UML2, PRO : UML2;

helper context UML2!Element def : hasStereotype(s : String) : Boolean =
if self.getAppliedStereotypes()->select(e | e.name = s)->notEmpty() then
true
else
false
endif;

rule Class {
from
s : UML2!Class (not s.hasStereotype('Komplex'))
to
t : UML2!Class(


Hello,

first of all thank you for your advise!
I tried the superimposition mechanism. Copying the model was succesful,
but the exclusion failed!

I tried the 'exclusion' without Copying the model (UML2Copy.atl) and it
wokrs!

But when I try to Copy the model and superimpose the snippet code on top,
the target model is empty!

I do it like in http://wiki.eclipse.org/ATL_Superimposition !


I work with Eclipse 3.3 and ATL 2.0.0 .

I would be pleased for any advise, thank you in advance!
Re: [ATL] UML2 to UM2 transformation [message #64376 is a reply to message #64031] Sat, 20 October 2007 08:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mani2s.gmx.de

Hello again,

I don't solve the problem, but I had another question!
I want to exclude all Classes with stereotype 'Komplex' plus all related
Elements, like attributes,associations so on..
Is there a function for that, or had I do that by overriding the rules
(Property, association ...).

Thank you in advance!

best regards Mani
Re: [ATL] UML2 to UM2 transformation [message #64445 is a reply to message #64353] Tue, 23 October 2007 07:58 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 301
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020709000804010906020908
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

Could you look at the console and paste here the execution trace if
present ?

William

mani2s a
Re: [ATL] UML2 to UM2 transformation [message #64468 is a reply to message #64353] Tue, 23 October 2007 08:30 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
mani2s schreef:
> *snip*
> first of all thank you for your advise!
> I tried the superimposition mechanism. Copying the model was succesful,
> but the exclusion failed!
> I tried the 'exclusion' without Copying the model (UML2Copy.atl) and it
> wokrs!
>
> But when I try to Copy the model and superimpose the snippet code on
> top, the target model is empty!
> I do it like in http://wiki.eclipse.org/ATL_Superimposition !
>
>
> I work with Eclipse 3.3 and ATL 2.0.0 .
> I would be pleased for any advise, thank you in advance!

If both transformations work, but you cannot combine them with
superimposition, make sure the following things are ok:

- Both transformations are compiled by the same compiler (atl2004 or
atl2006). Check the compiler directive on the first line:
"-- @atlcompiler atl2006"

- The model/metamodel declarations are compatible. If there is a model
named "IN" in both transformations, it must have the same metamodel.

If you still have problems, please post the source code of the
transformation you're trying to superimpose.
--
Regards,
Dennis
Re: [ATL] UML2 to UM2 transformation [message #64490 is a reply to message #64376] Tue, 23 October 2007 09:50 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
mani2s schreef:
> Hello again,
>
> I don't solve the problem, but I had another question! I want to exclude
> all Classes with stereotype 'Komplex' plus all related Elements, like
> attributes,associations so on..
> Is there a function for that, or had I do that by overriding the rules
> (Property, association ...).
>
> Thank you in advance!
>
> best regards Mani

With superimposition, you have to override all affected rules.

Perhaps it's more efficient in your case to adapt the definition of the
"inElements" attribute helper in UML2Copy.atl.

You cannot redefine helper attributes in a superimposed module,
unfortunately. I've tried it briefly, but it doesn't seem to work.
Perhaps we'll be able to fix this in the future ;-)
--
Dennis
Re: [ATL] UML2 to UM2 transformation [message #64512 is a reply to message #64490] Tue, 23 October 2007 10:19 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
Dennis Wagelaar schreef:
> *snip*
>
> You cannot redefine helper attributes in a superimposed module,
> unfortunately. I've tried it briefly, but it doesn't seem to work.
> Perhaps we'll be able to fix this in the future ;-)

I just dug a bit deeper on this issue. It is definitely a bug, which can
trigger for *any* helper attribute that uses a "select" statement or
similar. Here's the bug report:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=207142


--
Dennis
Re: [ATL] UML2 to UM2 transformation [message #64627 is a reply to message #64468] Tue, 23 October 2007 21:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mani2s.gmx.de

Hello everybody,

I use atl Compiler 2006 Plug-in! At the Eclipse "Run dialog", I just had
Regular VM(with debugger) in my drop-down list, so I think both
transformations are compiled by the same compiler.
I specified one metamodel UML2: uri:http://www.eclipse.org/uml2/2.1.0/UML,
in both transformations I use this metamodel.

If I use the the Superimpose mechanism, my transformation will not go far!

/Test/transformations/Buildtime_Projekt_Einfach.atl executed in 0.282 s
(including model loading and saving).

and that's it! :-(

I superimpose the following snippet of code on top of Copy2Model.atl:

module SuperimposeEinfach; -- Module Template
create OUT : UML2 from IN : UML2;


helper context UML2!Element def : hasStereotype(s : String) : Boolean =
if self.getAppliedStereotypes()->select(e | e.name = s)->notEmpty() then
true
else
false
endif;

helper def : inElements : Set(UML2!"ecore::EObject") =
UML2!"ecore::EObject"->allInstancesFrom('IN') ;

rule Class {
from s : UML2!"uml::Class" (
if thisModule.inElements->includes(s) and not
s.hasStereotype('Buildtime-Project-Complex') then
s->oclIsTypeOf(UML2!"uml::Class")
else false endif)
to t : UML2!"uml::Class" mapsTo s (
name <- s.name,
visibility <- s.visibility,
.
. ... the same like in Copy2Model.atl
.
ownedReception <- s.ownedReception)
}

At the Eclipse "Run dialog ..." I append my own created
profile.uml"(Topcased),
enabled inter-models references and continue execution after errors in Run
mode.

---> @Dennis:
your idea, to modify the inElements helper is interesting, could you give
my a snippet code?

I appreciate your help!

Best Regards,
Mani
Re: [ATL] UML2 to UM2 transformation [message #64696 is a reply to message #64627] Wed, 24 October 2007 07:42 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
mani2s schreef:
> Hello everybody,
>
> I use atl Compiler 2006 Plug-in! At the Eclipse "Run dialog", I just had
> Regular VM(with debugger) in my drop-down list, so I think both
> transformations are compiled by the same compiler.
> I specified one metamodel UML2:
> uri:http://www.eclipse.org/uml2/2.1.0/UML, in both transformations I use
> this metamodel.
>

Even if you're using the latest ATL, the default compiler is still set
to "atl2004" (don't know why). If you want to use the new (faster)
compiler, you have to add the following line at the top of your
transformation module:

-- @atlcompiler atl2006

> If I use the the Superimpose mechanism, my transformation will not go far!
>
> /Test/transformations/Buildtime_Projekt_Einfach.atl executed in 0.282 s
> (including model loading and saving).
>
> and that's it! :-(
>
> I superimpose the following snippet of code on top of Copy2Model.atl:
>
> module SuperimposeEinfach; -- Module Template
> create OUT : UML2 from IN : UML2;
>
>
> helper context UML2!Element def : hasStereotype(s : String) : Boolean =
> if self.getAppliedStereotypes()->select(e | e.name = s)->notEmpty() then
> true
> else
> false
> endif;
>
> helper def : inElements : Set(UML2!"ecore::EObject") =
> UML2!"ecore::EObject"->allInstancesFrom('IN') ;
>
> rule Class {
> from s : UML2!"uml::Class" (
> if thisModule.inElements->includes(s) and not
> s.hasStereotype('Buildtime-Project-Complex') then
> s->oclIsTypeOf(UML2!"uml::Class")
> else false endif)
> to t : UML2!"uml::Class" mapsTo s (
> name <- s.name,
> visibility <- s.visibility,
> .
> . ... the same like in Copy2Model.atl .
> ownedReception <- s.ownedReception)
> }
>
> At the Eclipse "Run dialog ..." I append my own created
> profile.uml"(Topcased),
> enabled inter-models references and continue execution after errors in
> Run mode.

I don't have any "Copy2Model.atl". I used "UML2Copy.atl" instead. When I
superimpose your transformation, I get the following error:

SEVERE: Pattern not equal for execution environment and module in main
(getasm != load 0 @ 0)
org.eclipse.m2m.atl.engine.AtlSuperimposeModule$AtlSuperimpo seModuleException:
Pattern not equal for execution environment and module in main (getasm
!= load 0 @ 0)
at
org.eclipse.m2m.atl.engine.AtlSuperimposeModule.mainSanityCr ossCheck(AtlSuperimposeModule.java:103)
at
org.eclipse.m2m.atl.engine.AtlSuperimposeModule.adaptMain(At lSuperimposeModule.java:77)
at
org.eclipse.m2m.atl.engine.AtlSuperimposeModule.adaptModuleO perations(AtlSuperimposeModule.java:60)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:154)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
INFO: /uml2cs-transformations/UML2Copy.atl executed in 1.639 s
(including model loading and saving).

That means I need to add the "-- @atlcompiler atl2006" line to
SuperimposeEinfach.atl. After I did that, the transformation works.

>
> ---> @Dennis:
> your idea, to modify the inElements helper is interesting, could you
> give my a snippet code?

To do this, you need the latest ATL from CVS, or download ATL from the
following update site:

http://ssel.vub.ac.be/tools/atl/update/

An example transformation that superimposes a new "inElements" on top of
UML2Copy.atl can be found here:

http://ssel.vub.ac.be/viewvc/UML2CaseStudies/uml2cs-transfor mations/UML2FilteredCopy.atl?revision=7373&view=markup

It copies only instances of uml::Package. You'll probably need a more
elaborate OCL statement to exclude all stereotyped classes and all
elements directly or indirectly owned by those classes.

>
> I appreciate your help!
>
> Best Regards,
> Mani
>
>
>

You're welcome ;-)
--
Dennis
Re: [ATL] UML2 to UM2 transformation [message #64763 is a reply to message #64696] Wed, 24 October 2007 20:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mani2s.gmx.de

Hello,

thanks now it works!
I had think about your idea, to overwrite the inElements() helper. I had
do that in my Superimpose.atl (superimpose on UML2Copy.atl).

-- @atlcompiler atl2006
module SuperimposeEinfach; -- Module Template
create OUT : UML2 from IN : UML2;


helper context UML2!Element def : hasStereotype(s : String) : Boolean =
if self.getAppliedStereotypes()->select(e | e.name = s)->notEmpty() then
true
else
false
endif;

helper def : inElements : Set(UML2!"ecore::EObject") =
UML2!"ecore::EObject"->allInstancesFrom('IN');


I had run it, but it takes about 30min, and after that I get errors, but
they are don't specified!

Is there an syntactic error, or maybe I cannot overwirte the helper!

Do you know a more efficient idea than mine?

best Regards,
Mani
Re: [ATL] UML2 to UM2 transformation [message #64809 is a reply to message #64763] Thu, 25 October 2007 15:40 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
mani2s schreef:
> Hello,
>
> thanks now it works!
> I had think about your idea, to overwrite the inElements() helper. I had
> do that in my Superimpose.atl (superimpose on UML2Copy.atl).
>
> -- @atlcompiler atl2006
> module SuperimposeEinfach; -- Module Template
> create OUT : UML2 from IN : UML2;
>
>
> helper context UML2!Element def : hasStereotype(s : String) : Boolean =
> if self.getAppliedStereotypes()->select(e | e.name = s)->notEmpty() then
> true
> else
> false
> endif;
>
> helper def : inElements : Set(UML2!"ecore::EObject") =
> UML2!"ecore::EObject"->allInstancesFrom('IN');
>
> I had run it, but it takes about 30min, and after that I get errors, but
> they are don't specified!

Hmm, then how do you know you get errors? What kind of errors are they?

>
> Is there an syntactic error, or maybe I cannot overwirte the helper!

Helpers that already exist in the base ATL module don't need to be
specified again. In your case, you can just use the "inElements" from
UML2Copy.atl inside your own transformation module.

>
> Do you know a more efficient idea than mine?

Well, that would be to re-define "inElements" in your own
transformation. That requires the latest ATL from CVS, as indicated in
my previous post.

>
> best Regards,
> Mani
>

--
Dennis
Previous Topic:Using the QvtCompiler outside of an Eclipse runtime environment
Next Topic:[ATL] Java.lang.NullPointerException with XML.ecore metamodel
Goto Forum:
  


Current Time: Fri Mar 29 08:46:30 GMT 2024

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

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

Back to the top