[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] Re: [ATL] How to define the xsi:schemaLocation with the transformation rules?

Bruno wrote:

Am I missing something?

No it's my fault, I have looked in the wrong file.

The problem is the profile to apply,
My solution is the following, there might be a lot other solutions, more elegant.
Who knows, might tell us :)


In the imperative part of the model rule just select the profile by a helper,

invar.debug('ModelRule');
for (p in invar.getAllAppliedProfiles()){
Modelvar.applyProfile(thisModule.findProfile(p.getQualifiedName()));
}

and the helper should select the profile from the profile model (PRO)

which should be included in the transformation file

helper def : findProfile(qname : String) : UML2!Profile =
UML2!Profile.allInstancesFrom('PRO')-> select(st| st.getQualifiedName() = qname)->first()
;


same for the stereotypes :

outvar.applyStereotype( thisModule.findStereotyp(st.getQualifiedName()));	

with

helper def : findStereotyp(qname : String) : UML2!Stereotype =
UML2!Stereotype.allInstancesFrom('PRO')-> select(st| st.getQualifiedName() = qname)->first()
;



I have played around a bit. You could also change the helpers to select from allInstance() instead of From(''), but your profile need to be included in your transformation, for example by state them in the from model list
create OUT : UML2 from IN : UML2,PRO:UML2;


But it's only importance is that the profile model is loaded by the handler(allowInterModelReferences is not enough). If you use AM3 or ATLflow you do not need to state the profile in the transformation.

create OUT : UML2  from IN : UML2;

hope this will help.

greetings, urs.

PNG image