Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Transformation between UML profiles(Is it possible to make transfromation between UML Profiles?)
Transformation between UML profiles [message #548002] Tue, 20 July 2010 11:33 Go to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
Hi, I have been trying to find a way to create transformation between two UML profiles (models defined in these two profiles) that I have created in Eclipse Modeling Framework. I tried with ATL and QVT, but it seems that these two transformation languages are only able to execute transformations between models for which their metamodels are defined in ecore. That's OK and I understand that this is because ATL and QVT are implemented as metamodels in ecore. However, if I try to make transformations between UML profiles, both these transformations aren't working. Since UML and UML profiles are defined in ecore metamodel I thought that this could be possible.
So my question is: Can I use ATL, QVT or some other transformation language to make transformations between UML profiles (that is models defined in my own UML profiles in eclipse)?

Any help will be so gratefully appreciated!
Re: Transformation between UML profiles [message #548005 is a reply to message #548002] Tue, 20 July 2010 11:41 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You want to transform UML Profiles or UML Models using your profiles ?
Re: Transformation between UML profiles [message #548156 is a reply to message #548005] Tue, 20 July 2010 20:23 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
UML models defined with my UML profiles...
Re: Transformation between UML profiles [message #548233 is a reply to message #548002] Wed, 21 July 2010 08:12 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
UML2 is defined in ecore so a UML2 Model is a model like the others and can be transformed using ATL. Concerning profiles, you can use the UML2 APIs in the transformation to gather informations about stereotypes, tagged values and so on.
Re: Transformation between UML profiles [message #548298 is a reply to message #548233] Wed, 21 July 2010 12:18 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
I tried with ATL but it seems that it can't read metamodels of UML profiles properly, I am not sure how and why, just the transformation doesn't work. On the other hand, if I use QVTO I can't provide UML profiles as metamodels of input and output models of transformation, i.e. files with extension *.profile.uml can't be accepted by QVTO as input metamodels for transformation (only *.ecore files are allowed). So I am confused, how is than possible, as you say, to make transformations between models of my own UML profiles?
And where can I find documentation on using UML2 API for authoring transformations?
Re: Transformation between UML profiles [message #548355 is a reply to message #548298] Wed, 21 July 2010 14:50 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
I started using static profiles. They are way simpler to handle, since you get a separate .ecore file.
http://nyssen.blogspot.com/2009/09/defining-static-profiles- with-eclipse.html
And you can generate Java code from that, so it is even possible to implement the logic for derived attributes.
Re: Transformation between UML profiles [message #548713 is a reply to message #548002] Thu, 22 July 2010 17:25 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
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 #548847 is a reply to message #548002] Fri, 23 July 2010 09:53 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
You have a wrong understanding of the UML profiling mechanism. Stereotypes do not specialize the UML meta model elements (in a sense of inheritance). That would be a heavyweight UML extension. Instead stereotypes are some kind of separate meta model elements that are instantiated and reference the stereotyped UML element. Therefore the stereotype has a base_XXX attribute, where XXX is the type of the UML meta model element, which should be stereotyped.
As an example I created this little QVTO transformation, which replaces an "Entity" stereotype (defined in the profile "entities") by the stereotype "Persistent" (defined in the profile "persistence"). Note that you need to pass the UML model that defines the "persistence" profile as an input to the transformation.

modeltype entities "strict" uses entities('http://example.com/entities');
modeltype persistence "strict" uses persistence('http://example.com/persistence');
modeltype uml "strict" uses uml('http://www.eclipse.org/uml2/3.0.0/UML');
	

transformation swichprofile(in umlIn:entities, in persistenceProf:uml, out umlOut:persistence);

main() {
	-- copy root model(s)
	var _result := umlIn.rootObjects()[uml::Model].deepclone();
	_result[uml::Model]->forEach(model) {
		-- is "entities" Profile applied?
		if(model.getAppliedProfile('entities') <> null) then {
			-- remove application of "entities" profile
			model.unapplyProfile(model.getAppliedProfiles()![name='entities']);
			-- apply "persistence" profile instead
			model.applyProfile(persistenceProf.objectsOfType(uml::Profile)![name='persistence']);
		} endif;
	};
	-- now transform "entity" stereotype applications
	umlIn.objectsOfType(entities::Entity).map toPersistent();
	_result;
}

mapping entities::Entity::toPersistent() : persistence::Persistent {
	persistent_name := self.table_name;
	-- figure out which class the stereotype should be applied to
	base_Class := umlOut.objectsOfType(uml::Class)![qualifiedName = self.base_Class.qualifiedName];
}
Re: Transformation between UML profiles [message #548877 is a reply to message #548002] Fri, 23 July 2010 11:12 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
I will try this. Thank you very much!
Re: Transformation between UML profiles [message #548882 is a reply to message #548002] Fri, 23 July 2010 11:35 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You can do the same in ATL using the profile as meta-model.
See here for example.
Re: Transformation between UML profiles [message #549586 is a reply to message #548002] Tue, 27 July 2010 09:44 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
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 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
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 #551006 is a reply to message #549663] Wed, 04 August 2010 19:50 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
I figured it out. Max Bureck, your transformation is good! Thank you again. I have been using wrong UML Metamodel version of input model for transformation.

Thanks again.
Cheers

[Updated on: Wed, 04 August 2010 19:51]

Report message to a moderator

Re: Transformation between UML profiles [message #551007 is a reply to message #549663] Wed, 04 August 2010 19:52 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
No Message Body

[Updated on: Wed, 04 August 2010 19: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 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
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!?
icon9.gif  Re: Transformation between UML profiles [message #553607 is a reply to message #548002] Wed, 18 August 2010 08:04 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
I found an example of applying profile to uml elements in qvto transformation, however it just doesn't work for me:

...
someClass.applyStereotype(Student.oclAsType(Stereotype));
...


In this case Student is stereotype defined in my uml profile.

Somebody please help, I need to get this working for my MSc, and time is running out...

I can't find any literature on QVTO, i found one book on Amazon and it is in German! And especially there is no book or online manual or tutorial on using uml profiles with QVTO...
I am loosing my patience bit by bit Sad...
Re: Transformation between UML profiles [message #558764 is a reply to message #548002] Tue, 14 September 2010 11:19 Go to previous message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
It seems that QVTO doesn't support UML profiles yet...

See here
Previous Topic:Typecast problem
Next Topic:[ATL] Getting rubbish except of element's attributes
Goto Forum:
  


Current Time: Fri Apr 19 20:00:13 GMT 2024

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

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

Back to the top