How to access stereotypes of uml elements? [message #789913] |
Fri, 03 February 2012 15:13 |
Andreas Burger Messages: 14 Registered: June 2011 |
Junior Member |
|
|
Hello,
how can i access stereotypes of uml elements? I load the uml model with the following java code:
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI("org.eclipse.uml2.uml.source_3.2.0.v201105231350.jar!/");
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(""));
URI modeluri = URI.createURI("mymodel.uml");
Resource resource = resourceSet.getResource(modeluri,true);
Now i can access all elements of the uml model. But it is not possible to get the stereotypes of some elements in the uml model. Does anybody know how i can access stereotypes which are defined by an uml profile which is linked with the loaded uml model?
Regards,
Andreas
[Updated on: Fri, 03 February 2012 15:35] Report message to a moderator
|
|
|
Re: How to access stereotypes of uml elements? [message #789950 is a reply to message #789913] |
Fri, 03 February 2012 16:00 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
I think there are some helper functions called something like
getAppliedStereotypes().
Regards
Ed Willink
On 03/02/2012 15:13, Andreas Burger wrote:
> Hello,
>
> how can i access stereotypes of uml elements? I load the uml model
> with the following java code:
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI("org.eclipse.uml2.uml.source_3.2.0.v201105231350.jar!/");
>
> 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(""));
>
> URI modeluri = URI.createURI("mymodel.uml");
> Resource resource = resourceSet.getResource(modeluri,true);
>
> Know i can access all elements of the uml model. But it is not
> possible to get the stereotypes of some elements in the uml model.
> Does anybody know how i can access stereotypes which are defined by an
> uml profile which is linked with the loaded uml model?
>
> Regards,
>
> Andreas
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07565 seconds