Home » Modeling » Papyrus » issue with applicable and applied stereotypes?
issue with applicable and applied stereotypes? [message #1451011] |
Thu, 23 October 2014 03:43  |
Eclipse User |
|
|
|
Hi all,
I tried to list applied stereotypes on a SysML model just created with Papyrus and I'm surprised as I can see "applied profiles" but "applicable stereotypes" is an empty list. Same for appliedStereotypes whereas I explicitely put some stereotypes to my model element.
After investigation in debug, profiles loaded are almost empty. Is it something known? shall I open a bug?
Here is the code and console outputs below:
public Model loadModel (String modelPath) {
System.out.println("trying to load model from file " + modelPath);
final ResourceSet resourceSet = new ResourceSetImpl();
UMLResourcesUtil.init(resourceSet);
// Create the output resource and add our model package to it.
Resource resource = resourceSet.getResource(URI.createFileURI(modelPath), true);
// model is the main content of resource
final Model model = (Model) resource.getContents().get(0);
System.out.println("mode loaded has name = " + model.getName());
System.out.println("Profiles applied to the model :");
System.out.println("-> " + model.getAppliedProfiles());
System.out.println("stereotypes applicable to the model :");
System.out.println("-> " + model.getApplicableStereotypes());
System.out.println("stereotypes applied to the model :");
System.out.println("-> " + model.getAppliedStereotypes());
return model;
}
console outputs:
trying to load model from file model/test1.uml
mode loaded has name = SysMLmodel
Profiles applied to the model :
-> [org.eclipse.uml2.uml.internal.impl.ProfileImpl@33fba86 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@15ecd501 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@6d3c3df3 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@4bb25b81 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@436e5aed (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@5679f207 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@56dc688a (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@43f69b79 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@6a7859ef (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@2b780d7a (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@8c61644 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw), org.eclipse.uml2.uml.internal.impl.ProfileImpl@799bb43f (eProxyURI: model.profile.uml#_JA3QAFqGEeSZBdgQcmtAeQ)]
stereotypes applicable to the model :
-> []
stereotypes applied to the model :
-> []
|
|
| | | | | |
Re: issue with applicable and applied stereotypes? [message #1451342 is a reply to message #1451276] |
Thu, 23 October 2014 13:38   |
Eclipse User |
|
|
|
Thanks again.
I have looked at plugin.xml and translated each line into mappings:
For profile mapping I get following initialization code (I know, I should not address UUID directly but it is another task: I will do it when it works):
private static void initURI2ProfileMap() {
UMLPlugin.getEPackageNsURIToProfileLocationMap().put(SysmlPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_TZ_nULU5EduiKqCzJMWbGw"));
UMLPlugin.getEPackageNsURIToProfileLocationMap().put(BlocksPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_fSw28LX7EduFmqQsrNB9lw"));
UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ModelelementsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#Gx8MgLX7EduFmqQsrNB9lw"));
UMLPlugin.getEPackageNsURIToProfileLocationMap().put(PortandflowsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_rpx28LX7EduFmqQsrNB9lw"));
// and so on ...
System.out.println("UMLPlugin.getEPackageNsURIToProfileLocationMap() : "
+ UMLPlugin.getEPackageNsURIToProfileLocationMap());
}
For Ecore mapping I get this code:
Quote:private static void initPackageRegistry(final EPackage.Registry packageRegistry) {
packageRegistry.put(SysmlPackage.eNS_URI, SysmlPackage.eINSTANCE);
packageRegistry.put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE);
packageRegistry.put(RequirementsPackage.eNS_URI, RequirementsPackage.eINSTANCE);
packageRegistry.put(ModelelementsPackage.eNS_URI, ModelelementsPackage.eINSTANCE);
// and so on...
}
And for URI Mapping I get:
Quote:private static void initURIConverterURIMap( final Map<URI, URI> uriMap) {
RESOURCE_SET.getResourceFactoryRegistry().getExtensionToFactoryMap().
put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
URI uri1 = URI.createURI("jar:file:/applications/EclipseLMSR1/plugins/org.eclipse.uml2.uml.resources_5.0.0.v20140910-1354.jar!/");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri1.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri1.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri1.appendSegment("profiles").appendSegment(""));
String baseUri = "jar:file:/applications/EclipseLMSR1/plugins/org.eclipse.papyrus.sysml_1.0.1.v201409170932.jar!/";
URI uri = URI.createURI(baseUri+"model/SysML.profile.uml");
uriMap.put(URI.createURI(SysmlResource.SYSML_PROFILE_URI), uri);
URI uriPrimitivesTypes = URI.createURI(baseUri+"libraries/SysMLPrimitiveTypes.uml");
uriMap.put(URI.createURI(SysmlResource.SYSML_PRIMITIVE_TYPES_LIBRARY_URI), uriPrimitivesTypes);
URI uriSysMLPlugin = URI.createURI(baseUri);
uriMap.put(URI.createURI(SysmlResource.LIBRARIES_PATHMAP), uriSysMLPlugin.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(SysmlResource.PROFILES_PATHMAP), uriSysMLPlugin.appendSegment("model").appendSegment(""));
System.out.println("initURIConverterURIMap :: "+ uriMap);
}
Did I forget something?
I stil can not see applied stereotypes...
I have seen sysml.ecore in sysML plugin but no reference in plugin.xml. Should I map it too somewhere?
Thanks
Raphaël
|
|
|
Re: issue with applicable and applied stereotypes? [message #1451728 is a reply to message #1451342] |
Fri, 24 October 2014 03:46  |
Eclipse User |
|
|
|
sysml.ecore is transformed to SysMLPackage.eINSTANCE (and others) via the Genmodel, so it doesn't need to be registered.
Everything looks good now, so I can't really tell. I guess the Java Debugger can help you now, but I don't really know what you should check. If the resource is properly populated, then the resource.save() should work seamlessly. Well, this probably means that you should check the Resource's contents.
|
|
|
Goto Forum:
Current Time: Sun Jul 27 16:21:57 EDT 2025
Powered by FUDForum. Page generated in 0.03647 seconds
|