Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] Weird thing about Stereotypes application
[QVTo] Weird thing about Stereotypes application [message #653396] Wed, 09 February 2011 16:15 Go to next message
Davide Cannone is currently offline Davide CannoneFriend
Messages: 2
Registered: December 2010
Junior Member
Hi,
i have a weird problem, and i don't have any explanation.

I'm writing a trasformation from Ecore to UML, based on the example
http:// dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.m2m/org.eclip se.m2m.qvt.oml/examples/org.eclipse.m2m.qvt.oml.econ2009.tut orial/projects/qvto.ecore2uml/transforms/Ecore2UML.qvto?revi sion=1.4&root=Modeling_Project

In the INIT section i load a not-static profile that includes a stereotype (named 'cpp_pointer') that extends the Parameter metaclass

In the mapping EClass:toClass(), i have added a part of code to add a new operation for each reference with multiplicity greater than one.

self.eReferences->forEach(i|i.upperBound <> 1){
		var name_string:String = 'add'+i.name.firstToUpper();
		var pointer:Stereotype = uml2cpp.objectsOfType(Stereotype)->any(name = 'cpp_pointer');
		ownedOperation += object uml::Operation {
			visibility := VisibilityKind::public;
			type := umlModel.objectsOfType(UML::DataType)->any(temp:UML::DataType | temp.name = 'EInt');
			name := name_string;
			var param = object uml::Parameter {
				name := 'value';
				type := umlModel.objectsOfType(UML::Class)->any(temp:UML::Class | temp.name = i.eType.name);
			};
			param.applyStereotype(pointer);
			ownedParameter += param;
		};


As you can see, in the last part of the code section, i apply the stereotype. But when i look at the uml file, the profile is correctly applied to the model but there isn't any reference to the stereotype application to the parameters above.

Weird thing is that, when I apply the stereotype in the END section of EPackage:toPackage() (basically the last function to be called back)
var s:Set(Parameter) = umlModel.objectsOfType(Parameter)[not oclIsInvalid() and getApplicableStereotypes()->notEmpty()];
		s->forEach(i) {
			var o:Operation = i.operation;
			var pointer:Stereotype = i.getApplicableStereotypes()->any(name = 'cpp_pointer');
			if(o.name.startsWith('add') and i.name = 'value') then i.applyStereotype(pointer) endif;
		}

then everything it's ok.

I hope to have been clear and i hope that someone can give me an explanation.
Thanks in advance
Re: [QVTo] Weird thing about Stereotypes application [message #660836 is a reply to message #653396] Mon, 21 March 2011 21:26 Go to previous message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Hi,

have you tried changing the order of

param.applyStereotype(pointer);
ownedParameter += param;


I had problems applying stereotypes when the containment wasn't set correctly before.

Regards,

Andreas
Previous Topic:[ATL] Replace strange symbols
Next Topic:[ATL] Problem running a basic example
Goto Forum:
  


Current Time: Wed Mar 03 04:57:10 GMT 2021

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

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

Back to the top