[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?
|
- From: urs zeidler <me@xxxxxxxxxxxxx>
- Date: Thu, 17 Jul 2008 23:56:54 +0200
- Newsgroups: eclipse.modeling.m2m
- Organization: EclipseCorner
- User-agent: Thunderbird 2.0.0.14 (X11/20080505)
You can't just copy a profile applied on a model, because it's an api
call in UML2. Same with stereotypes. The UML2 modelhandler will apply
them afterwards the transformation is done.
You will need to apply the profile and the stereotypes in the imperative
part of your transformation.
Note that it doesn't have the xmi tag as the input model. Thus, it
doesn't have the xsi:schemaLocation. As a consequence, the profile
schema can't be referenced as it is in the input model.
Notice that the serialisation of a simple uml model(without a profile
applied) is XML and the serialisation of a model with a profile applied
has to be XMI because the stereotypes are in fact dynamic EObjects just
added to the resourceSet.
Besides, regarding the UML2Copy transformation, someone can tell me why
the "references" child of "eAnnotations" wasn't copied? And why the
"appliedProfile" element wasn' copied too?
Same as the stereotypes.
here some examples :
"Copy" the applied profiles via applying them
rule ModelRule {
from s : UML2!"uml::Model" (thisModule.inElements->includes(s))
to t : UML2!"uml::Model" mapsTo s (
name <- s.name->debug('Model'),
visibility <- s.visibility,
.....
packageMerge <- s.packageMerge,
packagedElement <- s.packagedElement,
profileApplication <- s.profileApplication)
do {
t.debug('ModelRule');
for (p in s.getAllAppliedProfiles()){
t.applyProfile(p);
}
}
}
A called rule to "copy" the stereotypes of an element and copy the values :
rule copyStereoType(invar : UML2!"uml::Element",outvar :
UML2!"uml::Element"){
do{
for(st in invar.getAppliedStereotypes()){
outvar.applyStereotype(st);
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) );
}
}
}
}
}--do
}
In the imperative part of your transformation you can now "copy"
steretype by using the called rule :
thisModule.copyStereoType(invar,Classvar);
to avoid doubling of profile applications,one from the transformation
and one from the applying, you need to exclude the
UML2!ProfileApplication from the copy process.
greetings urs.