Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Accessing stereotypes defined in SysML profiles with packages(ERROR: stereotype XXX::YYY::ZZZ is not applicable to element org.eclipse.uml2.uml.internal.impl.PortImpl@...)
Accessing stereotypes defined in SysML profiles with packages [message #1033773] Thu, 04 April 2013 16:20 Go to next message
Matteo M. is currently offline Matteo M.
Messages: 28
Registered: May 2012
Junior Member
Hello all,
I defined a SysML profile containing a number of stereotypes that I need for my application. I'm able to use it in QVTo and all works as expected, i.e, I can successfully apply the stereotypes to UML::Class(es) in my maps. I provide my transformation with the profile as input parameter as follows:
transformation ... ( ..., in fct:UML, ... );

Then I get the profile as a property as follows:
property fct_prf =  fct.rootObjects()![Profile];

I get a stereotype defined in the profile as a property as follows:
property zzz_stp = fct_prf.ownedStereotype![name = "ZZZ"];

and finally use applyStereotype(zzz_stp) on a generic UML::Class to successfully apply the stereotype.

The things stop working when I define a package in the profile and move all the stereotypes inside the package. I get the profile (as a property) as above. Then I get the package as a property in this way:
property fct_pkg =  fct_prf.ownedElement->select(e | e.oclIsKindOf(Package)).oclAsType(Package)![name = "YYY"];

and the stereotype in this way:
property zzz_stp : Stereotype = fct_pkg.ownedElement->select(e | e.oclIsKindOf(Stereotype)).oclAsType(Stereotype)![name = "ZZZ"];

I use applyStereotype(zzz_stp) as above, but now I'm no longer able to apply stereotypes in my maps and I get error messages like this one:
ERROR: stereotype XXX::YYY::ZZZ is not applicable to element org.eclipse.uml2.uml.internal.impl.DependencyImpl@850992 (name: UUU, visibility: <unset>)


Any ideas? How do I get and apply stereotypes when they are contained in a package defined in a SysML profile?

Thank you in advance for your time!

--
Matteo
Re: Accessing stereotypes defined in SysML profiles with packages [message #1036657 is a reply to message #1033773] Mon, 08 April 2013 17:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4098
Registered: July 2009
Senior Member
Hi

Sorry few ideas.

Probably you have made a scoping error. Perhaps QVTo has a scoping bug.

You have a version that works and one that doesn't. Use the debugger to
see why they're different.

Regards

Ed Willink


On 04/04/2013 17:20, Matteo M. wrote:
> Hello all,
> I defined a SysML profile containing a number of stereotypes that I
> need for my application. I'm able to use it in QVTo and all works as
> expected, i.e, I can successfully apply the stereotypes to
> UML::Class(es) in my maps. I provide my transformation with the
> profile as input parameter as follows:
> transformation ... ( ..., in fct:UML, ... );
> Then I get the profile as a property as follows:
> property fct_prf = fct.rootObjects()![Profile];
> I get a stereotype defined in the profile as a property as follows:
> property zzz_stp = fct_prf.ownedStereotype![name = "ZZZ"];
> and finally use applyStereotype(zzz_stp) on a generic UML::Class to
> successfully apply the stereotype.
>
> The things stop working when I define a package in the profile and
> move all the stereotypes inside the package. I get the profile (as a
> property) as above. Then I get the package as a property in this way:
> property fct_pkg = fct_prf.ownedElement->select(e |
> e.oclIsKindOf(Package)).oclAsType(Package)![name = "YYY"];
> and the stereotype in this way:
> property zzz_stp : Stereotype = fct_pkg.ownedElement->select(e |
> e.oclIsKindOf(Stereotype)).oclAsType(Stereotype)![name = "ZZZ"];
> I use applyStereotype(zzz_stp) as above, but now I'm no longer able to
> apply stereotypes in my maps and I get error messages like this one:
> ERROR: stereotype XXX::YYY::ZZZ is not applicable to element
> org.eclipse.uml2.uml.internal.impl.DependencyImpl@850992 (name: UUU,
> visibility: <unset>)
>
> Any ideas? How do I get and apply stereotypes when they are contained
> in a package defined in a SysML profile?
>
> Thank you in advance for your time!
>
> --
> Matteo
Re: Accessing stereotypes defined in SysML profiles with packages [message #1037251 is a reply to message #1033773] Tue, 09 April 2013 10:38 Go to previous messageGo to next message
Sergey Boyko is currently offline Sergey Boyko
Messages: 162
Registered: July 2009
Senior Member
Hi Matteo,

There should be something wrong in a way how you create profile with packages.

As an example I took MARTE profile. This profile consists of a number of packages each of which in turn contains profiles.
In my test I applied "FlowProperty" stereotype which resides in "GCM" profile which in turn is contained by "MARTE_Foundations" package from "MARTE" root profile.
Output model was created correctly.

modeltype UML uses uml('http://www.eclipse.org/uml2/4.0.0/UML');
modeltype Ecore uses ecore('http://www.eclipse.org/emf/2002/Ecore');

transformation NewTransformation1(in MarteProfile : UML, out model : UML);

main() {
	var prof : Profile := MarteProfile.objectsOfType(Profile)![name = "GCM"];
	var stereo : Stereotype = MarteProfile.objectsOfType(Stereotype)![name = "FlowProperty"];
	assert fatal (prof = stereo.profile);
	
	var model : Model := object Model {name := 'model'};
	var cls : Class := object Class {name := 'class'};
	model.ownedType += cls;
	var prop : Property := object Port {name := 'prop'};
	cls.ownedAttribute += prop;

	model.applyProfile(stereo.profile);
	prop.applyStereotype(stereo);
}


Could you please attach your version of UML profile with which QVTo shows error.

Regards,
Sergey
Re: Accessing stereotypes defined in SysML profiles with packages [message #1058849 is a reply to message #1037251] Wed, 15 May 2013 12:05 Go to previous message
Matteo M. is currently offline Matteo M.
Messages: 28
Registered: May 2012
Junior Member
Hi,

sorry for the late reply.

I wrongly defined my profile with packages. It indeed had to be defined as profile with subprofiles. It works now.

Thank you all

--
Matteo
Previous Topic:[Announce] Eclipse QVT Operational 3.3.0 (Kepler) M7 is available
Next Topic:QVT project organization
Goto Forum:
  


Current Time: Sun Oct 26 03:59:44 GMT 2014

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

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