unable get SysML stereotypes [message #1768125] |
Thu, 13 July 2017 18:45  |
Jiaan Che 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 #1768385 is a reply to message #1768181] |
Tue, 18 July 2017 08:33   |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02725 seconds