Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » apply stereotype on element Problem!(I use applySereotype(),but there's no corresponding element.)
icon5.gif  apply stereotype on element Problem! [message #1115515] Tue, 24 September 2013 03:48 Go to next message
BaiChuan Nie is currently offline BaiChuan Nie
Messages: 3
Registered: September 2013
Junior Member
I wrote QVTo like this:

transformation CIM_To_PIM(in cim : UML,in profile : UML, out pim : UML);
property web_prof = profile.objectsOfType(UML::Profile)->asOrderedSet()->first();
property web_stereo = profile.objectsOfType(UML::Stereotype);
property web_model:UML::Model = null;
main() {
cim.rootObjects()[UML::Model]->map model2WebModel();
}
mapping UML::Model::model2WebModel() : UML::Model {
... ...
this.web_model := result;
packagedElement += self.nestedPackage->select(p|p.getAppliedStereotypes()->exists(name='CIM'))->asOrderedSet()->first().nestedPackage->map function2package();
}

mapping UML::Package::function2package() : UML::Package
when{self.getAppliedStereotypes()->exists(s|s.name='functionSet')}
{
... ...
packagedElement += self.map endFunction2Controller();
}
mapping UML::Package::endFunction2Controller() : UML::Class
when{
not self.nestedPackage->collect(p|p.getAppliedStereotypes())->exists(s|s.name='functionSet') and
not self.ownedElement[UML::Class]->isEmpty()
}
{
... ...
this.web_model.ownedType += result;
result.getApplicableStereotypes()-> forEach(stereotype){
log("applicable stereotype:", stereotype.name);
};
result.applyStereotype(web_stereo->any(name='controller'));
result.getAppliedStereotypes()-> forEach(stereotype){
log("applied stereotype:", stereotype.name);
};
}

Strange, the log output like below:
applicable stereotype:, data: validator
applicable stereotype:, data: controller
applicable stereotype:, data: logger
applicable stereotype:, data: exception
applied stereotype:, data: controller

but,in XMI,there is no element such as <controller:controller ... base_Class=""/>。
why the stereotype applied isn't sierialized into XMI???
Re: apply stereotype on element Problem! [message #1116692 is a reply to message #1115515] Wed, 25 September 2013 14:56 Go to previous messageGo to next message
Sergey Boyko is currently offline Sergey Boyko
Messages: 148
Registered: July 2009
Senior Member
Hi BaiChuan,

You have to apply profile to model first. For example you can place a call to "result.applyProfile(profile)" in 'model2WebModel()' mapping.

Regards,
Sergey.

Re: apply stereotype on element Problem! [message #1116705 is a reply to message #1116692] Wed, 25 September 2013 15:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3446
Registered: July 2009
Senior Member
Hi Sergey

Any change we can add this to a Wiki FAQ and/or a simple how to use UML
stereotypes example?

Regards

Ed Willink

On 25/09/2013 14:56, Sergey Boyko wrote:
> Hi BaiChuan,
>
> You have to apply profile to model first. For example you can place a
> call to "result.applyProfile(profile)" in 'model2WebModel()' mapping.
>
> Regards,
> Sergey.
>
>
Re: apply stereotype on element Problem! [message #1118075 is a reply to message #1116692] Thu, 26 September 2013 23:37 Go to previous message
BaiChuan Nie is currently offline BaiChuan Nie
Messages: 3
Registered: September 2013
Junior Member
I have apply the profile on the model, It is in the mapping model2WebModel,I forgot to paste:
mapping UML::Model::model2WebModel() : UML::Model {
name := self.name+'_Web_PIM';
result.applyProfile(web_prof);
this.web_model := result;
packagedElement += self.nestedPackage->any(p|p.isAppliedStereotype('CIM')).nestedPackage->map function2package();
}

But It is no use!


Now I want to use EAnnotation to replace Stereotype!
But there is still a little problem.

By the way,can I get your MSN or Email?Expecting for you help...
Previous Topic:Creating objects in secondary extents
Next Topic:metamodel declaration & UML profile
Goto Forum:
  


Current Time: Mon Oct 07 11:46:18 EDT 2013

Powered by FUDForum. Page generated in 0.01595 seconds