|
|
|
|
|
|
Re: Transformation between UML profiles [message #548713 is a reply to message #548002] |
Thu, 22 July 2010 17:25 |
Stefan Mijatov Messages: 59 Registered: March 2010 Location: Vienna, Austria |
Member |
|
|
When I follow the above tutorial, I get *.ecore file of my profile, which is nice and good. However, it seems that the uml metamodel in ecore is referenced somehow by ecore metamodel of profile, thus I can not create dynamic instance of "package" or "model", for example, from the ecore metamodel of my profile. I only get the stereotypes in ecore file that I have defined in profile, and even if I make dynamic instance of those stereotypes it seems as if generalization of those stereotypes from uml concepts didn't work...
What I am trying to say is that if I make extension stereotype of uml:Class element, stereotype doesn't inherit attributes of uml:Class element...it has only the attributes and references and etc., that I have defined in profile...
Maybe I am doing something wrong, but I am kind a loosing my patience here...
Can someone provide example of making transformation between two models of UML profiles defined in Eclipse?
|
|
|
|
|
|
Re: Transformation between UML profiles [message #549586 is a reply to message #548002] |
Tue, 27 July 2010 09:44 |
Stefan Mijatov Messages: 59 Registered: March 2010 Location: Vienna, Austria |
Member |
|
|
I have been trying to execute this QVTO transformation that you posted, but I just can't get it working.
First of all, as I understood I have to make profile1.ecore and profile2.ecore files using the method described here. Then as input metamodels to transformation, I have to provide these two ecore files, as well as uml.ecore file that is metamodel of uml, to the transformation as input model types and than when I want to do the actual transformation I provide *.uml file that is model of first profile as input model and generate other *.uml file that is model of second uml profile. Is this correct?
Second, I am using Eclipse 3.4.2 and I am not sure which version of qvto does it have, but it seems there is no forEach() operation to use... I found only forAll() which could be the same thing?
[Updated on: Tue, 27 July 2010 09:47] Report message to a moderator
|
|
|
Re: Transformation between UML profiles [message #549663 is a reply to message #548002] |
Tue, 27 July 2010 13:51 |
Stefan Mijatov Messages: 59 Registered: March 2010 Location: Vienna, Austria |
Member |
|
|
I am unable to execute the above example transformation, since there is no implementation of forEach() operation in QVTO. However, I have defined this more simple QVTO operation but for some reason the only mapping that I have defined in it, is never called...
Here is the code:
modeltype jpa "strict" uses JPA('http:///JPA.ecore');
modeltype rel "strict" uses REL('http:///REL.ecore');
modeltype uml "strict" uses uml('http://www.eclipse.org/uml2/2.1.0/UML');
transformation jpa2rel(in jpaIn:jpa, in umlIn:uml, out relOut:rel);
main() {
-- copy root model(s)
log("main()...");
umlIn.rootObjects()[uml::Model] -> map toModel();
}
mapping uml::Model::toModel() : uml::Model{
name := self.name;
log("toModel()...");
}
I have defined two profiles, JPA (Hibernate) and REL(Relational) and created model of JPA profile called jpa.uml. I have provided it as input model, and also ecore metamodels of these two profiles as well as uml ecore metamodel as metamodels for transformation. However when I run this transformation mapping toModel() is never called...
jpaIn and umlIn are referencing to jpa.uml model...
What am I doing wrong?
[Updated on: Tue, 27 July 2010 13:52] Report message to a moderator
|
|
|
|
|
Re: Transformation between UML profiles [message #551950 is a reply to message #548002] |
Tue, 10 August 2010 09:25 |
Stefan Mijatov Messages: 59 Registered: March 2010 Location: Vienna, Austria |
Member |
|
|
So, I managed to generate, through qvto transformation, some UML elements in output model based on elements in input model. I managed to apply profile to output model by using next piece of code:
var models = umlIn.rootObjects()[uml::Model].clone();
models[uml::Model]->forEach(m){
m.profileApplication := profileIn.objects()[uml::ProfileApplication];
};
I tried to use "someClass.applyStereotype()" in transformation, in order to apply some stereotypes to certain elements, but I can not get it working. I can, however apply stereotypes to elements of output model, after transformation, using UML editor, so I guess output model is valid, and profile has been successfully applied upon transformation completition.
Please, can anyone provide valid piece of code for applying stereotypes in qvto transformation!?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04800 seconds