Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to access stereotypes of uml elements?
https://www.eclipse.org/forums/index.php/mv/msg/284460/789913/#msg_789913
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!/");
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]]>Andreas Burger2012-02-03T15:13:00-00:00Re: How to access stereotypes of uml elements?
https://www.eclipse.org/forums/index.php/mv/msg/284460/789950/#msg_789950
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]]>Ed Willink2012-02-03T16:00:50-00:00Re: How to access stereotypes of uml elements?
https://www.eclipse.org/forums/index.php/mv/msg/284460/791821/#msg_791821
thanks for fast respond. I tried these functions but they always return an empty list.
The stereotypes are present when viewing the uml model in the uml model editor. If the uml model is
traversed with the emf java possibilities the stereotypes cannot be accessed.
Does anybody know why the stereotypes are not present when using java emf uml parser?
Regards,
Andreas]]>Andreas Burger2012-02-06T09:50:50-00:00Re: How to access stereotypes of uml elements?
https://www.eclipse.org/forums/index.php/mv/msg/284460/791841/#msg_791841
If they exist in the model, and you can verify the XMI with a text
editor, then it is very very unlikely that they are not present in the
loaded Java. You just need to do some possibly hard work with the Java
debugger.
Regards
Ed Willink
On 06/02/2012 09:50, Andreas Burger wrote:
> Hi,
>
> thanks for fast respond. I tried these functions but they always
> return an empty list. The stereotypes are present when viewing the uml
> model in the uml model editor. If the uml model is traversed with the
> emf java possibilities the stereotypes cannot be accessed. Does
> anybody know why the stereotypes are not present when using java emf
> uml parser?
>
> Regards,
>
> Andreas]]>Ed Willink2012-02-06T10:16:19-00:00Re: How to access stereotypes of uml elements?
https://www.eclipse.org/forums/index.php/mv/msg/284460/791848/#msg_791848
just Debug the function...
I suppose that you hava a profile URI with pathmap and did not put that
in the URI_MAP. A Pathmap is only a placeholder for the real URI.
When you use a plugin like the UML Editor you must not care about these
things but when you use "standalone" Java you must consider it.
Greeting
Peter
Am 06.02.2012 10:50, schrieb Andreas Burger:
> Hi,
>
> thanks for fast respond. I tried these functions but they always return
> an empty list. The stereotypes are present when viewing the uml model in
> the uml model editor. If the uml model is traversed with the emf java
> possibilities the stereotypes cannot be accessed. Does anybody know why
> the stereotypes are not present when using java emf uml parser?
>
> Regards,
>
> Andreas]]>Peter Mising name2012-02-06T10:17:07-00:00Re: How to access stereotypes of uml elements?
https://www.eclipse.org/forums/index.php/mv/msg/284460/793633/#msg_793633
It seems profile were not loaded correctly. Probably the profiles are
referenced using the "platform:/plugin/" or "platform:/resource" URI. In
this case one has to add "platform:/plugin/" or "platform:/resource" to
the URI map.
The easiest way to check if the profile was loaded correctly is to see
if model.getAppliedProfiles() list contains your profile.
Regards,
--
Tatiana Fesenko
ModelSolv, Inc.
Model-Oriented Solutions for Service Integration]]>Tatiana Fesenko2012-02-08T11:22:15-00:00