Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Model-to-Model Transformation » QVTO applyStereotype() issue ! is it a bug?!!(applyStereotype() does not really apply stereotype to the output xmi file even getAppliedStereotypes() return correct result)
QVTO applyStereotype() issue ! is it a bug?!! [message #1245968] Fri, 14 February 2014 14:30 Go to next message
Naif Mokhayesh is currently offline Naif MokhayeshFriend
Messages: 31
Registered: November 2011
Member
Hi,

In a simple transformation example I need to refactor one model by copying stereotyped element from second input model. I'm using recent update 3.5 (25 Jan, 2014) it was successfully applying Stereotype using applyStereotype() and I verify it using getAppliedStereotypes() during transformation execution.

In fact, when I check the output xmi file the stereotype is added but not linked/referenced (applied) to the copied model element. Moreover, when I run getAppliedStereotypes() from another transformation on the refactored model I found no applied stereotype!

I do not why this behaviour.!!

Note that : this question also posted in QVTO forum but no response yet!

http://www.eclipse.org/forums/index.php/t/642760/

the following is my example code !

modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';

transformation ApplyingStereotype(inout src : UML , in stereotypedModel : UML);
/**
This transformation will take two input models. 
First one (src) is the model that we need to refactor it. 
The second model has stereotyped states that we need just 
copy it with its applied stereotypes to the scr model (refactored model - inout model)
**/

main() {
	
	src.rootObjects()[Model]->toModel();
	

	// according to  http://www.eclipse.org/forums/index.php/t/530322/
	// apply stereotypes after adding new state from stereotypedModel
	src.objectsOfType(State)->copyStereotypes();
	
	
	//after adding new state we list all applied stereotypes for the recent added state
	src.objectsOfType(State)[name = "TestState"]->listAllAppliedStereoyes();
	
	/**
	It seems running since we will get the correct results, 
	but when we check the output xmi file there is no stereotype applied 
	to that state ! but the  stereotype it self is added but not linked/referenced to the 
	corresponding state (the state copied from the second input model)
	
	You can execute ListAllAppliedStereotype.qvto for verification
	**/
}

mapping inout Model::toModel(){
	-- note that the profile is already applied	!
	// for nesting models
	src.objectsOfType(Model)->toModel();
	
	src.objectsOfType(StateMachine)->toStateMachine();
}

mapping inout StateMachine::toStateMachine(){
	src.objectsOfType(Region)->toRegion();
}

mapping inout Region::toRegion(){
		
	// add new state to src model (refactored model --inout)
	self.subvertex += stereotypedModel.objectsOfType(State)->selectOne(S : State | S.name = "TestState");
	
	
}

// in the context of src model
mapping inout State::copyStereotypes() when {self.name = "TestState"}
{	
	// select matching stereotyped state from stereotypedModel
	var stereotypedState : State;
	stereotypedState := stereotypedModel.objectsOfType(State)->selectOne(S : State | S.name = self.name);
	
	var stereotypSet : Set(Stereotype);
	stereotypSet := stereotypedState.getAppliedStereotypes();
	
	// applyStereotype to the recent added state in the src model.
	stereotypSet->forEach(stereotyp){
		self.applyStereotype(stereotyp);
	}

}

query State::listAllAppliedStereoyes() : Void{
	var value : String ;
	
	self.getAppliedStereotypes()->forEach(appliedStereoType){
		log("New added State Name is : " + self.name);
		log("Applied Stereotype is : " + appliedStereoType.name);
		
		appliedStereoType.attribute->forEach(attr){
			
			value := self.getValue(appliedStereoType, attr.name).toString();
			log("attribute name is : " + attr.name + " and value is : " + value); 
		}
	}
}

Re: QVTO applyStereotype() issue ! is it a bug?!! [message #1245987 is a reply to message #1245968] Fri, 14 February 2014 14:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4187
Registered: July 2009
Senior Member
Hi

You are asking for free advice.
> Note that : this question also posted in QVTO forum but no response yet!
You should not even think about re-asking for 2 days.

Regards

Ed Willink
Re: QVTO applyStereotype() issue ! is it a bug?!! [message #1245990 is a reply to message #1245987] Fri, 14 February 2014 15:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4187
Registered: July 2009
Senior Member
Hi

I beg your pardon. I was looking at the wrong message.

Sorry, it looks like no one can help. UML stereotypes are certainly
difficult; occasionally I try to encourage someone to write a decent
cookbook example.

You might get on better if you provided a zipped project rather than a
cut and paste that may require 15 minutes work to try to turn back into
your project.

Regards

Ed Willik


On 14/02/2014 14:58, Ed Willink wrote:
> Hi
>
> You are asking for free advice.
>> Note that : this question also posted in QVTO forum but no response yet!
> You should not even think about re-asking for 2 days.
>
> Regards
>
> Ed Willink
Re: QVTO applyStereotype() issue ! is it a bug?!! [message #1246031 is a reply to message #1245990] Fri, 14 February 2014 16:22 Go to previous messageGo to next message
Naif Mokhayesh is currently offline Naif MokhayeshFriend
Messages: 31
Registered: November 2011
Member
Hi,

it is OK Ed. really I appreciate your reply and cooperation. In fact, originally this question was posted before 2 weeks and around 14185 views with no response. That is why I decided to posted here again with example.

the Zip file of simple project is ready since I ask this question but I can not upload it since the icon of upload file is not shown!. I do not know my account is blocked ! I tried from different browser even from different PC and that is why I cut/past the code.

please advice

Thanks
Re: QVTO applyStereotype() issue ! is it a bug?!! [message #1246247 is a reply to message #1246031] Fri, 14 February 2014 22:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4187
Registered: July 2009
Senior Member
HI

I think you are blocked till you post 5 times.

If necessary post a DropBox link, perhaps adjusting to fool the forum
into not noticing the link

Or just raise a QVTo Bugzilla and attach it there.

Regards

Ed

On 14/02/2014 16:23, Naif Mokhayesh wrote:
> Hi,
>
> it is OK Ed. really I appreciate your reply and cooperation. In fact,
> originally this question was posted before 2 weeks and around 14185
> views with no response. That is why I decided to posted here again
> with example.
>
> the Zip file of simple project is ready since I ask this question but
> I can not upload it since the icon of upload file is not shown!. I do
> not know my account is blocked ! I tried from different browser even
> from different PC and that is why I cut/past the code.
>
> please advice
> Thanks
Re: QVTO applyStereotype() issue ! is it a bug?!! [message #1248131 is a reply to message #1246247] Mon, 17 February 2014 01:09 Go to previous message
Naif Mokhayesh is currently offline Naif MokhayeshFriend
Messages: 31
Registered: November 2011
Member
Hi,

qvto Bugzilla is raised

https://bugs.eclipse.org/bugs/show_bug.cgi?id=428309

Thanks.

[Updated on: Mon, 17 February 2014 02:44]

Report message to a moderator

Previous Topic:XML to XMI transformation with mapping between Ecore and XSD
Next Topic:Data structures in QVTO
Goto Forum:
  


Current Time: Fri Dec 19 14:28:58 GMT 2014

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

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