Home » Modeling » Papyrus » applied stereotype from SysML not returned
applied stereotype from SysML not returned [message #1164145] |
Thu, 31 October 2013 09:11  |
Eclipse User |
|
|
|
Hello!
I want to filter all elements which have applied stereotype Requirement.
I have a model which has applied profile SysML. In the model there are elements with applied stereotype Requirement from SysML::Requirements. I can see this in Papyrus Editor->Properties->Profile->Applied Stereotypes.
However, in code the stereotype doesn't show up. model.getAppliedProfiles() contains SysML, but element.getAppliedStereotypes() doesn't contain Requirement. Other stereotypes do get recognized however. For example stereotype Refine from StandardProfileL2 is recognized.
Please note that the model is not loaded within a plugin but from a standalone java application.
Why are SysML stereotype applications not recognized?
|
|
| | |
Re: applied stereotype from SysML not returned [message #1170323 is a reply to message #1170306] |
Mon, 04 November 2013 10:10   |
Eclipse User |
|
|
|
Hi,
Papyrus provides a "static" implementation of the SysML profile. "Static" means that it has been converted to Ecore, and Java code has been generated for all stereotypes.
So, registering the "SysML.profile.uml" is necessary, but not sufficient.
You should also register the EMF/Ecore EPackage in the Package registry. You can do it with:
EPackage.Registry.INSTANCE.put(SysmlPackage.eNS_URI, SysmlPackage.eINSTANCE);
EPackage.Registry.INSTANCE.put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE);
EPackage.Registry.INSTANCE.put(RequirementsPackage.eNS_URI, RequirementsPackage.eINSTANCE);
...
...
UML also provides a specific extension point for UML generated packages, which is different from the standard EMF one. So you may need to do something for that too... I'm not sure.
Regards,
Camille
|
|
|
Re: applied stereotype from SysML not returned [message #1170336 is a reply to message #1170323] |
Mon, 04 November 2013 10:20   |
Eclipse User |
|
|
|
Hi, Camille, jonas b,
Yes, indeed, UML has some extra registration steps for profiles. Have
a look at what the UMLResourceUtil API does in the
org.eclipse.uml2.uml.resources plug-in does for registration of the UML
standard profiles. You can do the same for your profiles.
http://git.eclipse.org/c/uml2/org.eclipse.uml2.git/tree/plugins/org.eclipse.uml2.uml.resources/src/org/eclipse/uml2/uml/resources/util/UMLResourcesUtil.java
HTH,
Christian
On 2013-11-04 15:10:15 +0000, Camille Letavernier said:
> Hi,
>
>
> Papyrus provides a "static" implementation of the SysML profile.
> "Static" means that it has been converted to Ecore, and Java code has
> been generated for all stereotypes.
>
> So, registering the "SysML.profile.uml" is necessary, but not sufficient.
>
> You should also register the EMF/Ecore EPackage in the Package
> registry. You can do it with:
>
> EPackage.Registry.INSTANCE.put(SysmlPackage.eNS_URI, SysmlPackage.eINSTANCE);
> EPackage.Registry.INSTANCE.put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE);
> EPackage.Registry.INSTANCE.put(RequirementsPackage.eNS_URI,
> RequirementsPackage.eINSTANCE);
> ..
> ..
>
> UML also provides a specific extension point for UML generated
> packages, which is different from the standard EMF one. So you may need
> to do something for that too... I'm not sure.
>
>
> Regards,
> Camille
|
|
|
Re: applied stereotype from SysML not returned [message #1173889 is a reply to message #1170336] |
Wed, 06 November 2013 15:32   |
Eclipse User |
|
|
|
Hi again,
Thank you for the hints. I rebuilt org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.initGlobalRegistries() but to no effect yet.
public static void registerSysmlProfile() {
initPackageRegistry(EPackage.Registry.INSTANCE);
initURIConverterURIMap(URIConverter.URI_MAP);
UMLPlugin.getEPackageNsURIToProfileLocationMap().put(SysmlPackage.eNS_URI, URI.createURI(SysmlResource.SYSML_PROFILE_URI));
}
private static void initURIConverterURIMap(final Map<URI, URI> uriMap) {
final URI baseUri = getResourceURI("model/SysML.profile.uml");
//baseUri == jar:file:/C:/Users/jb/momut/libraries/org.eclipse.papyrus.sysml_0.10.0.v201306121352.jar!/
uriMap.put(URI.createURI(SysmlResource.PROFILES_PATHMAP), baseUri.appendSegment("model").appendSegment(""));
uriMap.put(URI.createURI(SysmlResource.LIBRARIES_PATHMAP), baseUri.appendSegment("libraries").appendSegment(""));
}
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(ActivitiesPackage.eNS_URI, ActivitiesPackage.eINSTANCE);
packageRegistry.put(AllocationsPackage.eNS_URI, AllocationsPackage.eINSTANCE);
packageRegistry.put(ConstraintsPackage.eNS_URI, ConstraintsPackage.eINSTANCE);
packageRegistry.put(InteractionsPackage.eNS_URI, InteractionsPackage.eINSTANCE);
packageRegistry.put(ModelelementsPackage.eNS_URI, ModelelementsPackage.eINSTANCE);
packageRegistry.put(PortandflowsPackage.eNS_URI, PortandflowsPackage.eINSTANCE);
packageRegistry.put(StatemachinesPackage.eNS_URI, StatemachinesPackage.eINSTANCE);
packageRegistry.put(UsecasesPackage.eNS_URI, UsecasesPackage.eINSTANCE);
}
I did not reproduce the methods
public static Resource.Factory.Registry initResourceFactoryRegistry(Resource.Factory.Registry resourceFactoryRegistry)
and
public static ContentHandler.Registry initContentHandlerRegistry(ContentHandler.Registry contentHandlerRegistry)
because I can't find equivalent Objects for Sysml.
So after all these registrations, here are the contents of the various maps:
UMLPlugin.getEPackageNsURIToProfileLocationMap():
[http://www.eclipse.org/uml2/schemas/Ecore/5=pathmap://UML_PROFILES/Ecore.profile.uml#_0,
http://www.eclipse.org/papyrus/0.7.0/SysML=pathmap://SysML_PROFILES/SysML.profile.uml, //does that even belong in here?
http://www.eclipse.org/uml2/4.0.0/UML/Profile/L3=pathmap://UML_PROFILES/StandardL3.profile.uml#_0,
http://www.eclipse.org/uml2/4.0.0/UML/Profile/L2=pathmap://UML_PROFILES/StandardL2.profile.uml#_0]
URIConverter.URI_MAP
[pathmap://UML_LIBRARIES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.uml2.uml.resources_4.1.0.v20130610-0712.jar!/libraries/,
pathmap://UML_METAMODELS/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.uml2.uml.resources_4.1.0.v20130610-0712.jar!/metamodels/,
pathmap://UML_PROFILES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.uml2.uml.resources_4.1.0.v20130610-0712.jar!/profiles/,
http://www.eclipse.org/ocl/1.1.0/oclstdlib.uml->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.ocl.uml_4.0.100.v20130610-1317.jar!/model/oclstdlib.uml,
pathmap://SysML_PROFILES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.papyrus.sysml_0.10.0.v201306121352.jar!/model/,
pathmap://SysML_LIBRARIES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.papyrus.sysml_0.10.0.v201306121352.jar!/libraries/]
However, I still don't see the stereotypes applied.
|
|
|
Re: applied stereotype from SysML not returned [message #1176715 is a reply to message #1173889] |
Fri, 08 November 2013 09:03   |
Eclipse User |
|
|
|
Hi,
There is no SysML resource implementation; SysML is a profile of UML,
so it uses the UMLResource.
I would suggest at this point debugging the
ElementOperations::getAppliedStereotypes() method to see why you're not
getting the stereotypes that you expect.
cW
On 2013-11-06 20:32:10 +0000, jonas b said:
> Hi again,
>
> Thank you for the hints. I rebuilt
> org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.initGlobalRegistries()
> but to no effect yet.
>
> public static void registerSysmlProfile() {
> initPackageRegistry(EPackage.Registry.INSTANCE);
> initURIConverterURIMap(URIConverter.URI_MAP);
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(SysmlPackage.eNS_URI,
> URI.createURI(SysmlResource.SYSML_PROFILE_URI));
> }
>
> private static void initURIConverterURIMap(final Map<URI, URI> uriMap) {
> final URI baseUri = getResourceURI("model/SysML.profile.uml");
> //baseUri ==
> jar:file:/C:/Users/jb/momut/libraries/org.eclipse.papyrus.sysml_0.10.0.v201306121352.jar!/
>
> uriMap.put(URI.createURI(SysmlResource.PROFILES_PATHMAP),
> baseUri.appendSegment("model").appendSegment(""));
> uriMap.put(URI.createURI(SysmlResource.LIBRARIES_PATHMAP),
> baseUri.appendSegment("libraries").appendSegment(""));
> }
>
> 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(ActivitiesPackage.eNS_URI, ActivitiesPackage.eINSTANCE);
> packageRegistry.put(AllocationsPackage.eNS_URI,
> AllocationsPackage.eINSTANCE);
> packageRegistry.put(ConstraintsPackage.eNS_URI,
> ConstraintsPackage.eINSTANCE);
> packageRegistry.put(InteractionsPackage.eNS_URI,
> InteractionsPackage.eINSTANCE);
> packageRegistry.put(ModelelementsPackage.eNS_URI,
> ModelelementsPackage.eINSTANCE);
> packageRegistry.put(PortandflowsPackage.eNS_URI,
> PortandflowsPackage.eINSTANCE);
> packageRegistry.put(StatemachinesPackage.eNS_URI,
> StatemachinesPackage.eINSTANCE);
> packageRegistry.put(UsecasesPackage.eNS_URI, UsecasesPackage.eINSTANCE);
> }
> I did not reproduce the methods public static Resource.Factory.Registry
> initResourceFactoryRegistry(Resource.Factory.Registry
> resourceFactoryRegistry)
> and public static ContentHandler.Registry
> initContentHandlerRegistry(ContentHandler.Registry
> contentHandlerRegistry)
> because I can't find equivalent Objects for Sysml.
>
> So after all these registrations, here are the contents of the various maps:
> UMLPlugin.getEPackageNsURIToProfileLocationMap():
> [http://www.eclipse.org/uml2/schemas/Ecore/5=pathmap://UML_PROFILES/Ecore.profile.uml#_0,
>
> http://www.eclipse.org/papyrus/0.7.0/SysML=pathmap://SysML_PROFILES/SysML.profile.uml,
> //does that even belong in here?
> http://www.eclipse.org/uml2/4.0.0/UML/Profile/L3=pathmap://UML_PROFILES/StandardL3.profile.uml#_0,
>
> http://www.eclipse.org/uml2/4.0.0/UML/Profile/L2=pathmap://UML_PROFILES/StandardL2.profile.uml#_0]
>
>
> URIConverter.URI_MAP
>
> [pathmap://UML_LIBRARIES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.uml2.uml.resources_4.1.0.v20130610-0712.jar!/libraries/,
>
> pathmap://UML_METAMODELS/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.uml2.uml.resources_4.1.0.v20130610-0712.jar!/metamodels/,
> pathmap://UML_PROFILES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.uml2.uml.resources_4.1.0.v20130610-0712.jar!/profiles/,
> http://www.eclipse.org/ocl/1.1.0/oclstdlib.uml->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.ocl.uml_4.0.100.v20130610-1317.jar!/model/oclstdlib.uml,
> pathmap://SysML_PROFILES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.papyrus.sysml_0.10.0.v201306121352.jar!/model/,
> pathmap://SysML_LIBRARIES/->jar:file:/C:/Users/jb/momut/libraries/org.eclipse.papyrus.sysml_0.10.0.v201306121352.jar!/libraries/]
>
>
> However, I still don't see the stereotypes applied.
|
|
| | | | | |
Goto Forum:
Current Time: Mon Apr 14 19:19:58 EDT 2025
Powered by FUDForum. Page generated in 0.04724 seconds
|