Skip to main content



      Home
Home » Modeling » UML2 » How to get stereotypes after loading XMI resource
How to get stereotypes after loading XMI resource [message #1863954] Thu, 07 March 2024 17:15 Go to next message
Eclipse UserFriend
Hi,

I am using the UML2 libraries and I can read in XMI resources.

I can traverse through the model and see all of the packages, classes, associations, connectors etc...

I know the classes have stereotypes applied. I can see it in the XMI as well.

But all of these methods return empty. I traversed the model and tried them on all model elements.
getApplicableStereotypes
getAppliedStereotypes
getRequiredStereotypes
getStereotypeApplications

After loading the resource, do I need to do something else to make this work?

Thank you for your time and patience.
Re: How to get stereotypes after loading XMI resource [message #1864084 is a reply to message #1863954] Thu, 14 March 2024 10:50 Go to previous messageGo to next message
Eclipse UserFriend
I was loading an XMI file which used all OMG references for namespaces and profile application.
To fix the missing SysML stereotypes, I added to the file the expected namespaces and profile application sections used by the EMF/UML/XMI libraries. I copied them from an export to XMI I had.
I get the expected results from the API method calls now.
I knew this but I guess I had forgotten.

I'll respond back once I've looked into the custom profiles.
I've loaded the profiles using the API but have other work before I will get back to this and try loading the XMI model again afterwards.
Re: How to get stereotypes after loading XMI resource [message #1864092 is a reply to message #1864084] Fri, 15 March 2024 05:40 Go to previous message
Eclipse UserFriend
The first time, and indeed other times when, I tried to use the Java API, I found nothing worked. It was only after using the debugger that I found out how to correctly spell the qualified stereotype name. If the name is even a bit wrong all bets are off. To make life a bit more fun, "Ecore" and "ecore" are different profiles, and sometimes modeling tools make the name more readable, so "ecore" is rendered as "Ecore".

You may find some examples of stereotype access that work in: https://git.eclipse.org/r/plugins/gitiles/ocl/org.eclipse.ocl/+/refs/heads/master/examples/org.eclipse.ocl.examples.build/src/org/eclipse/ocl/examples/build/qvto/UML2EcoreSynthesizer.qvto
Previous Topic:How to set multiple values for a property of a stereotype?
Next Topic:Reading SysML model from XMI
Goto Forum:
  


Current Time: Sun Jul 20 13:01:16 EDT 2025

Powered by FUDForum. Page generated in 0.04930 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top