Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [ATL] UML2Copy
[ATL] UML2Copy [message #87348] Mon, 04 August 2008 13:57 Go to next message
Eclipse UserFriend
Originally posted by: martins.narciso.yahoo.com.br

Hello friends,

I'm trying to launch a transformation to copy an UML model which contains
a Class with a stereotype applied. I'm using the UML2Copy atl file to do
this transformation with a superimposed module. Its code is:

..
..
..
rule copyStereoType(invar : UML2!"uml::Class", outvar : UML2!"uml::Class"){
do{
for(st in invar.getAppliedStereotypes()){

outvar.applyStereotype(thisModule.findStereotype(st.getQuali fiedName()));

for (a in st.getAllAttributes()){
if(not invar.getValue(st,a.name).oclIsUndefined()){
if ( not a.name.startsWith('base_') ){
outvar.setValue(st,a.name,invar.getValue(st,a.name) );
}
}
}
}
}
}

rule Class {
from s : UML2!"uml::Class" (thisModule.inElements->includes(s))

to t : UML2!"uml::Class" mapsTo s (
name <- s.name + '_work',
visibility <- s.visibility,
isLeaf <- s.isLeaf,
isAbstract <- s.isAbstract,
isActive <- s.isActive,
eAnnotations <- s.eAnnotations,
ownedComment <- s.ownedComment,
clientDependency <- s.clientDependency,
nameExpression <- s.nameExpression,
elementImport <- s.elementImport,
packageImport <- s.packageImport,
ownedRule <- s.ownedRule,
templateParameter <- s.templateParameter,
templateBinding <- s.templateBinding,
ownedTemplateSignature <- s.ownedTemplateSignature,
generalization <- s.generalization,
powertypeExtent <- s.powertypeExtent,
redefinedClassifier <- s.redefinedClassifier,
substitution <- s.substitution,
representation <- s.representation,
collaborationUse <- s.collaborationUse,
ownedUseCase <- s.ownedUseCase,
useCase <- s.useCase,
ownedAttribute <- s.ownedAttribute,
ownedConnector <- s.ownedConnector,
ownedBehavior <- s.ownedBehavior,
classifierBehavior <- s.classifierBehavior,
interfaceRealization <- s.interfaceRealization,
ownedTrigger <- s.ownedTrigger,
nestedClassifier <- s.nestedClassifier,
ownedOperation <- s.ownedOperation,
ownedReception <- s.ownedReception)

do {
thisModule.copyStereoType(s,t);
}
}

This module just do a copy.

But I wanna create a new profile application or modify the existing to
apply to this Class.
How can I do this?

Thanks in advance for any replies,

Narciso
Re: [ATL] UML2Copy [message #87545 is a reply to message #87348] Wed, 06 August 2008 11:57 Go to previous message
Eclipse UserFriend
Hello,

ATL can't modify the profile in the same transformation, because at this
time, it only creates output models from a set of input models.

What you can do is to create another transformation which takes the
stereotype as input, modify it, and then in your first transfo apply the
newly created profile.

Best regards,

William

Narciso Martins a écrit :
> Hello friends,
>
> I'm trying to launch a transformation to copy an UML model which
> contains a Class with a stereotype applied. I'm using the UML2Copy atl
> file to do this transformation with a superimposed module. Its code is:
>
> .
> .
> .
> rule copyStereoType(invar : UML2!"uml::Class", outvar : UML2!"uml::Class"){
> do{
> for(st in invar.getAppliedStereotypes()){
>
> outvar.applyStereotype(thisModule.findStereotype(st.getQuali fiedName()));
>
> for (a in st.getAllAttributes()){
> if(not invar.getValue(st,a.name).oclIsUndefined()){
> if ( not a.name.startsWith('base_') ){
>
> outvar.setValue(st,a.name,invar.getValue(st,a.name) );
> }
> }
> } }
> }
> }
>
> rule Class {
> from s : UML2!"uml::Class" (thisModule.inElements->includes(s))
>
> to t : UML2!"uml::Class" mapsTo s (
> name <- s.name + '_work',
> visibility <- s.visibility,
> isLeaf <- s.isLeaf,
> isAbstract <- s.isAbstract,
> isActive <- s.isActive,
> eAnnotations <- s.eAnnotations,
> ownedComment <- s.ownedComment,
> clientDependency <- s.clientDependency,
> nameExpression <- s.nameExpression,
> elementImport <- s.elementImport,
> packageImport <- s.packageImport,
> ownedRule <- s.ownedRule,
> templateParameter <- s.templateParameter,
> templateBinding <- s.templateBinding,
> ownedTemplateSignature <- s.ownedTemplateSignature,
> generalization <- s.generalization,
> powertypeExtent <- s.powertypeExtent,
> redefinedClassifier <- s.redefinedClassifier,
> substitution <- s.substitution,
> representation <- s.representation,
> collaborationUse <- s.collaborationUse,
> ownedUseCase <- s.ownedUseCase,
> useCase <- s.useCase,
> ownedAttribute <- s.ownedAttribute,
> ownedConnector <- s.ownedConnector,
> ownedBehavior <- s.ownedBehavior,
> classifierBehavior <- s.classifierBehavior,
> interfaceRealization <- s.interfaceRealization,
> ownedTrigger <- s.ownedTrigger,
> nestedClassifier <- s.nestedClassifier,
> ownedOperation <- s.ownedOperation,
> ownedReception <- s.ownedReception)
>
> do {
> thisModule.copyStereoType(s,t);
> }
> }
>
> This module just do a copy.
>
> But I wanna create a new profile application or modify the existing to
> apply to this Class.
> How can I do this?
>
> Thanks in advance for any replies,
>
> Narciso
>
Previous Topic:QVT to ATL
Next Topic:[ATL] Run ATL Ant Script Programmatically
Goto Forum:
  


Current Time: Tue May 20 15:39:33 EDT 2025

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

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

Back to the top