Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » invalid type with profile & stereotype
invalid type with profile & stereotype [message #1767246] Tue, 04 July 2017 07:29 Go to next message
samuel kallmeyer is currently offline samuel kallmeyerFriend
Messages: 47
Registered: March 2017
Member
Hi,
I created a profile to extend some stereotypes: I'm able to access to their specific values with r.getValue(getAppliedStereotype('MyProfile::MySterotype'),...
Unfortunately, when I tried to iterate through these specific Stereotype, and I got an invalid Type error.
I guess I'm using either a wrong syntax, or something else shall be imported. The syntax I'm using is [for (e:MyProfile::MySterotype |... ]

Is this correct, or shall I always use the uml::Class ?

Samuel
Re: invalid type with profile & stereotype [message #1767248 is a reply to message #1767246] Tue, 04 July 2017 07:38 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hello
2 possibilities :
- Instead of MyProfile you have to put the nsprefix of your stereotypes. You can find them at the end of the file of your uml model (right click on the uml model > open with text editor > go to the end of the file), you would find something aPrefix:yourStereotype). You will also find the technical name of your stereotype
so :
instead of myprofile::myStereotype you have to insert prefix::technical Name
- if you don't generate code it is possible that Acceleo / OCL does not recognize the stereotype so you have to used e:ecore::EObject but you will not be able to use attributes easily
To have a clearer view can you explain what is the collection you are iterating on ?




Re: invalid type with profile & stereotype [message #1767310 is a reply to message #1767248] Tue, 04 July 2017 14:53 Go to previous messageGo to next message
samuel kallmeyer is currently offline samuel kallmeyerFriend
Messages: 47
Registered: March 2017
Member
Thanks Tristan,
To clarify the collection I'm iterating on, MyStereotype is a generalization of a SysML Requirement type which is done in a profile project MyProfile.
I did create a new project which use this profile, and a diagram when I have 2 MyStereotype (one which is derived from the other, else if it's not compliant :-) )
The uml file reports:
<RootElement:MySteretotype xmi:id="_zSYf0GC-Eee6WO_ABP5n3A" base_Class="_y7lqEGC2Eee6WO_ABP5n3A"/>
<RootElement:MySteretotype xmi:id="_5V46p2C-Eee6WO_ABP5n3A" base_Class="_5V46YGC-Eee6WO_ABP5n3A"/>

[for (e:RootElement::MySteretotype ... gives an invalid type error
[for (e:ecore::EObject ... doesn't report an error
Re: invalid type with profile & stereotype [message #1767355 is a reply to message #1767310] Wed, 05 July 2017 07:34 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Okay thank you.

can you do :
[for (e:ecore::EObject ... )]
[e.eClass().name.clean()/]
[e.eClass().ePackage.nsPrefix.clean()/]
[/for]

with the value displayed you could try with the corresponding nsPrefix::eClassName




[Updated on: Wed, 05 July 2017 07:35]

Report message to a moderator

Re: invalid type with profile & stereotype [message #1767501 is a reply to message #1767355] Thu, 06 July 2017 14:00 Go to previous messageGo to next message
samuel kallmeyer is currently offline samuel kallmeyerFriend
Messages: 47
Registered: March 2017
Member
Hello Tristan,
I update a bit my profile, but still in the same issue....
Name :
Prefix: [e.eClass().ePackage.nsPrefix.clean()/]
reports:
Name : MyStereotype
Prefix: RootElement

by updating the for loop with: [for (e:RootElement::MyStereotype | ...

I still have the invalid type :-(

Re: invalid type with profile & stereotype [message #1767552 is a reply to message #1767501] Fri, 07 July 2017 06:33 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
I think it is because you use a profile not registered in your platform.

What you can do is
- using getValue on the uml element :
yourUmlElement.getValue('stereotypeQN','attributeName')
- using the parent class of your stereotype
yourRequirementForInstance.name
yourRequirementForInstance.eGet (yourRequirementForInstance.eClass().eAllAttributes()->select (name = 'yourattribute')) <-- not sure about the syntax please test it in acceleo evaluator

Regards




Re: invalid type with profile & stereotype [message #1767701 is a reply to message #1767552] Mon, 10 July 2017 06:49 Go to previous messageGo to next message
samuel kallmeyer is currently offline samuel kallmeyerFriend
Messages: 47
Registered: March 2017
Member
I'm currently able to display my attributes in case I filter directly in the diagram with the uml Class, with the getValue:
[t.getValue(getAppliedStereotype('RootElement::MyStereotype'),'text')/]
with t:uml::Class

I'm still blocked on how to retrieve this a uml::Class from a ecore::EObject or from a 'SysML::Requirements::Requirement' ...
Re: invalid type with profile & stereotype [message #1767734 is a reply to message #1767701] Mon, 10 July 2017 12:50 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
can you try from a SysML::Requirements::Requirement you can do requirement.base_Class ?

you should be able to get the associated class.

Generally there are references base_* type of the extension in each element




Re: invalid type with profile & stereotype [message #1767739 is a reply to message #1767734] Mon, 10 July 2017 13:27 Go to previous message
samuel kallmeyer is currently offline samuel kallmeyerFriend
Messages: 47
Registered: March 2017
Member
Ok, thanks for your input: works as expected now...
Previous Topic:Gendoc with Papyrus 3.0.0 (Oxygen)
Next Topic:possible side effect of getAppliedStereotype
Goto Forum:
  


Current Time: Thu Apr 25 05:36:02 GMT 2024

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

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

Back to the top