Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » possible side effect of getAppliedStereotype
possible side effect of getAppliedStereotype [message #1767765] Mon, 10 July 2017 21:12 Go to next message
samuel kallmeyer is currently offline samuel kallmeyerFriend
Messages: 47
Registered: March 2017
Member
Hi again,
I went through a :Cannot find operation (getAppliedStereotype(String)) for the type (Requirement) error with the following code...

[for (re:uml::Class | r->select(c:uml::Class | getValue(getAppliedStereotype('SysML::Requirements::Requirement'),'derived')->flatten()->notEmpty()))] <drop/>
[for (e:Requirement | re.getValue(getAppliedStereotype('SysML::Requirements::Requirement'),'derived')->flatten())] <drop/>

[for (x:Element | re.getValue(getAppliedStereotype('SysML::Requirements::Requirement'),'verifiedBy')->flatten())] <drop/>
Found a verification item linked to a Requirement : [x.toString().clean()/]
[/for] <drop/>
[/for] <drop/>

[for (t:Element | re.getValue(getAppliedStereotype('SysML::Requirements::Requirement'),'verifiedBy')->flatten())] <drop/>
Found a verification item linked to a Requirement : [t.toString().clean()/]
[/for] <drop/>
[/for] <drop/>

By removing the

[for (x:Element | re.getValue(getAppliedStereotype('SysML::Requirements::Requirement'),'verifiedBy')->flatten())] <drop/>
Found a verification item linked to a Requirement : [x.toString().clean()/]
[/for] <drop/>

I don't have this issue, and the code is the same as in the second part : I don't understand from where comes this issue. Is this a possible side effect ?

Samuel

Re: possible side effect of getAppliedStereotype [message #1767781 is a reply to message #1767765] Tue, 11 July 2017 06:14 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
in my opinion the problem is maybe due to implicit variable
when you use re.getValue(getAppliedStereotype('SysML::Requirements::Requirement')) it is not clear on which object you are calling getAppliedStereotype

can you force the caller, for instance :
re.getValue(re.getAppliedStereotype('SysML::Requirements::Requirement')) ?




Re: possible side effect of getAppliedStereotype [message #1767783 is a reply to message #1767765] Tue, 11 July 2017 06:22 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 152
Registered: July 2014
Senior Member
Hi Samuel,

The point is that you attempt to call getAppliedStereotype on something (a SysML::Requirement) that is a stereotype. The operation getAppliedStereotype is not defined for stereotypes since it is not possible to apply a stereotype on a stereotype.

You should always make clear the element on which an operation call is made because the default one is not always obvious. ;-)


Yves
Re: possible side effect of getAppliedStereotype [message #1767786 is a reply to message #1767781] Tue, 11 July 2017 06:39 Go to previous messageGo to next message
samuel kallmeyer is currently offline samuel kallmeyerFriend
Messages: 47
Registered: March 2017
Member
Hi Tristan and Yves,
Your advice are good: probably missed when writing too much getValue & getAppliedStereotype :-)

Thanks
Re: possible side effect of getAppliedStereotype [message #1767815 is a reply to message #1767786] Tue, 11 July 2017 11:43 Go to previous messageGo to next message
Jiaan Che is currently offline Jiaan CheFriend
Messages: 6
Registered: July 2017
Junior Member
hi,
I have some trouble in getAppliedStereotype. I use papyrus neon and sysml1.4, the following code:
[c.getAppliedStereotype('SysML::Requirements::Requirement')/]
[c.getAppliedStereotypes()/]
returns nothing, c is the model. I search and add the following code in java but it still cannot work:
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();

// UML2 profiles
URI uri = URI.createURI("platform:/plugin/org.eclipse.uml2.uml.resources");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));

// SysML profiles
uri = URI.createURI("platform:/plugin/org.eclipse.papyrus.sysml14");
uriMap.put(URI.createURI(SysMLResource.LIBRARIES_PATHMAP), uri.appendSegment("librairies").appendSegment(""));
uriMap.put(URI.createURI("pathmap://SysML14_PROFILES/"), uri.appendSegment("profiles").appendSegment(""));

Also, the modules are:
[module generate('http://www.eclipse.org/uml2/5.0.0/UML',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Blocks',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Activities',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Requirements',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/ModelElements')]

I want to know why it cannot work??
Re: possible side effect of getAppliedStereotype [message #1767827 is a reply to message #1767815] Tue, 11 July 2017 12:41 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hello

in which case are you generating (using the GUI or through a java application or through an eclipse rcp application) the java code is normally not necessary




Re: possible side effect of getAppliedStereotype [message #1767857 is a reply to message #1767815] Tue, 11 July 2017 16:08 Go to previous messageGo to next message
BACH TOBJI Mohamed Ali is currently offline BACH TOBJI Mohamed AliFriend
Messages: 3
Registered: May 2017
Junior Member
Hi Jiaan,

Did you use Acceleo or Gendoc to generate ? If you used Acceleo, please could you try with Gendoc ?

Regards,

Mohamed Ali
Re: possible side effect of getAppliedStereotype [message #1767868 is a reply to message #1767857] Tue, 11 July 2017 18:46 Go to previous messageGo to next message
Jiaan Che is currently offline Jiaan CheFriend
Messages: 6
Registered: July 2017
Junior Member
yes, I use the Acceleo. I'll try it with gendoc, are there any other solutions of this if I just want to get the id and text of requirement?
Re: possible side effect of getAppliedStereotype [message #1767906 is a reply to message #1767868] Wed, 12 July 2017 06:09 Go to previous message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
If you want to have a docx or an odt, gendoc seems a good choice :) and it does not need to create plugins or to code.





Previous Topic:invalid type with profile & stereotype
Next Topic:Using data from imported package
Goto Forum:
  


Current Time: Fri Mar 29 06:37:54 GMT 2024

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

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

Back to the top