Home » Archived » M2M (model-to-model transformation) » [ATL] UML2 to UM2 transformation
[ATL] UML2 to UM2 transformation [message #63965] |
Sat, 13 October 2007 03:44  |
Eclipse User |
|
|
|
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 #64490 is a reply to message #64376] |
Tue, 23 October 2007 05:50   |
Eclipse User |
|
|
|
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 #64627 is a reply to message #64468] |
Tue, 23 October 2007 17:08   |
Eclipse User |
|
|
|
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 03:42   |
Eclipse User |
|
|
|
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 #64809 is a reply to message #64763] |
Thu, 25 October 2007 11:40  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Thu May 01 10:33:18 EDT 2025
Powered by FUDForum. Page generated in 0.12114 seconds
|