Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » unable get SysML stereotypes(SysML; Acceleo; Papyrus)
unable get SysML stereotypes [message #1768125] Thu, 13 July 2017 18:45 Go to next message
Jiaan Che is currently offline Jiaan CheFriend
Messages: 6
Registered: July 2017
Junior Member
In Eclipse, Using Papyrus neon and Acceleo 3.7 for SysML 1.4 diagram, the getAppliedStereotype()returns null. 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 have added the following code in the generate.java but 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("model").appendSegment(""));  


The code like c.getAppliedStereotypes() returns null. I want to get the information of a requirement like the following code which returns nothing because of the getAppliedStereotype operation:
[for (re : uml::Class | uml::Class.allInstances()->select(cl : uml::Class | cl.getAppliedStereotype('SysML::Requirements::Requirement') <> null))] 
--[re.name/]
 Modellpfad : [re.qualifiedName/]
Id : [re.getValue(re.getAppliedStereotype('SysML::Requirements::Requirement'), 'id')/]
Text : [re.getValue(re.getAppliedStereotype('SysML::Requirements::Requirement'), 'text')/]
[/for]
Re: unable get SysML stereotypes [message #1768151 is a reply to message #1768125] Fri, 14 July 2017 07:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Do not attempt to recode UMLResourcesUtil.init use it and if necessary report any problems as a bug.

Similarly there should be a SysMLResourcesUtil.init. If there isn't raise a bug.

"librairies" looks smelly.

Regards

Ed Willink
Re: unable get SysML stereotypes [message #1768173 is a reply to message #1768151] Fri, 14 July 2017 10:29 Go to previous messageGo to next message
Jiaan Che is currently offline Jiaan CheFriend
Messages: 6
Registered: July 2017
Junior Member
Ed Willink wrote on Fri, 14 July 2017 07:42
Hi

Do not attempt to recode UMLResourcesUtil.init use it and if necessary report any problems as a bug.

Similarly there should be a SysMLResourcesUtil.init. If there isn't raise a bug.

"librairies" looks smelly.

Regards

Ed Willink



Hi
What else can I do to use the getappliedstereotypes operation? I delete the code in java file.
Re: unable get SysML stereotypes [message #1768175 is a reply to message #1768173] Fri, 14 July 2017 10:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

No idea. Your comment seems to make very little sense and to completely ignore my earlier reply.

Regards

Ed Willink
Re: unable get SysML stereotypes [message #1768179 is a reply to message #1768175] Fri, 14 July 2017 11:44 Go to previous messageGo to next message
Jiaan Che is currently offline Jiaan CheFriend
Messages: 6
Registered: July 2017
Junior Member
Ed Willink wrote on Fri, 14 July 2017 10:39
Hi

No idea. Your comment seems to make very little sense and to completely ignore my earlier reply.

Regards

Ed Willink


Hi
Thank you for your replying. Do you mean the following code is not necessary? I added this because some solutions said this like in https://www.eclipse.org/forums/index.php/t/1060450/

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("model").appendSegment(""));  

Re: unable get SysML stereotypes [message #1768181 is a reply to message #1768179] Fri, 14 July 2017 11:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your code is very undesirable since correct and complete initialization of UML (and presumably SysML) is really hard., which is why I promoted the use of UMLResourcesUtil.init() that does the job correctly and portably. So make sure that UMLResourcesUtil.init() is called.

I know very little about SysML, but any failure to provide a SysMLResourcesUtil.init() or equivalent for you to call is a SysML bug.

The message you quote perhaps predates the widespread availability of UMLResourcesUtil.init().

Regards

Ed Willink
Re: unable get SysML stereotypes [message #1768385 is a reply to message #1768181] Tue, 18 July 2017 08:33 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Jiaan,

If I am not mistaken, you should not be using the "http://www.eclipse.org/papyrus/sysml/1.4/SysML" & co urls in your module declaration since I'm pretty sure this declaration conflicts with how the model themselves refer to the SysML profiles (they likely use a "pathmap" url internally).

You should remove the code you're using for UML profiles and call UMLResourcesUtil.init(resourceSet) instead. This will remove the risk of bad registration from the UML side of things. As for SysML, Papyrus doesn't provide a proper setup API for it so you do need to implement it yourself, but you're probably better off asking on the papyrus forum for that. This question, though old, seem to correspond and it looks like there is quite a lot of things to register for the proper function of SysML...

As Ed mentions though, "librairies" is most likely false.

Laurent Goubet
Obeo

[Updated on: Tue, 18 July 2017 08:34]

Report message to a moderator

Re: unable get SysML stereotypes [message #1782859 is a reply to message #1768385] Fri, 02 March 2018 15:03 Go to previous message
Frank Poppen is currently offline Frank PoppenFriend
Messages: 21
Registered: February 2018
Junior Member
@Jiaan Che: Browsing the forum I noticed that this is basically the same problem I encountered (https://www.eclipse.org/forums/index.php/t/1091946/). Did you find a solution? Did you give up? (The latter is something getting louder and louder in my head right now.)
Previous Topic:External JAR works with Java Application, not Acceleo Plugin
Next Topic:Template returns "invalid" after switching from "Acceleo Plug-in Application" to
Goto Forum:
  


Current Time: Thu Apr 25 19:26:56 GMT 2024

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

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

Back to the top