Skip to main content



      Home
Home » Modeling » UML2 » How to read the xmi:id attribute in a UML model?
How to read the xmi:id attribute in a UML model? [message #477678] Tue, 12 August 2008 01:56 Go to next message
Eclipse UserFriend
Hi, I am trying to parse a UML model created in RSA V7.x. I am using the
UML2 API to parse. Below is a snippet of the model -
...
<uml:Model xmi:id="_CZSzQCtuEd2YeLIXgEz5pg" name="Test Model">
...
<packagedElement xmi:type="uml:Interface"
xmi:id="_UbMKQCuhEd2ibIXNy_4Bag" name="Manage Test"/>
<packagedElement xmi:type="uml:Usage" xmi:id="_tAMUoCuiEd2mV4EVsZozLg"
supplier="_eBv_YCuiEd2mV4EVsZozLg" client="_ZshWcCugEd2ibIXNy_4Bag"/>
...

I am looking to read the 'id' attribute of elements within the model, for
instance the 'Model' element or the 'packagedElement' element above.
Looking through the UML2 API, there doesn't appear to be a way to do this.

Does someone know of a way to access these 'id' attributes?

Thanks & Cheers.
Re: How to read the xmi:id attribute in a UML model? [message #477679 is a reply to message #477678] Tue, 12 August 2008 02:56 Go to previous messageGo to next message
Eclipse UserFriend
XMLResource#getID (which UMLResource implements) is probably what you want:

http://help.eclipse.org/stable/topic/org.eclipse.emf.doc/ref erences/javadoc/org/eclipse/emf/ecore/xmi/XMLResource.html#g etID(org.eclipse.emf.ecore.EObject)

For example:

System.out.println("xmi:id=" + ((XMLResource)
element.eResource()).getID(clazz));

HTH,

Rafael

Swami wrote:
> Hi, I am trying to parse a UML model created in RSA V7.x. I am using the
> UML2 API to parse. Below is a snippet of the model -
> ..
> <uml:Model xmi:id="_CZSzQCtuEd2YeLIXgEz5pg" name="Test Model">
> ..
> <packagedElement xmi:type="uml:Interface"
> xmi:id="_UbMKQCuhEd2ibIXNy_4Bag" name="Manage Test"/>
> <packagedElement xmi:type="uml:Usage"
> xmi:id="_tAMUoCuiEd2mV4EVsZozLg" supplier="_eBv_YCuiEd2mV4EVsZozLg"
> client="_ZshWcCugEd2ibIXNy_4Bag"/>
> ..
>
> I am looking to read the 'id' attribute of elements within the model,
> for instance the 'Model' element or the 'packagedElement' element above.
> Looking through the UML2 API, there doesn't appear to be a way to do this.
> Does someone know of a way to access these 'id' attributes?
>
> Thanks & Cheers.
>
>
Re: How to read the xmi:id attribute in a UML model? [message #477680 is a reply to message #477679] Tue, 12 August 2008 08:36 Go to previous message
Eclipse UserFriend
Spot on!!! Thanks, appreciate it.

Cheers.
Re: How to read the xmi:id attribute in a UML model? [message #626871 is a reply to message #477678] Tue, 12 August 2008 02:56 Go to previous message
Eclipse UserFriend
XMLResource#getID (which UMLResource implements) is probably what you want:

http://help.eclipse.org/stable/topic/org.eclipse.emf.doc/ref erences/javadoc/org/eclipse/emf/ecore/xmi/XMLResource.html#g etID(org.eclipse.emf.ecore.EObject)

For example:

System.out.println("xmi:id=" + ((XMLResource)
element.eResource()).getID(clazz));

HTH,

Rafael

Swami wrote:
> Hi, I am trying to parse a UML model created in RSA V7.x. I am using the
> UML2 API to parse. Below is a snippet of the model -
> ..
> <uml:Model xmi:id="_CZSzQCtuEd2YeLIXgEz5pg" name="Test Model">
> ..
> <packagedElement xmi:type="uml:Interface"
> xmi:id="_UbMKQCuhEd2ibIXNy_4Bag" name="Manage Test"/>
> <packagedElement xmi:type="uml:Usage"
> xmi:id="_tAMUoCuiEd2mV4EVsZozLg" supplier="_eBv_YCuiEd2mV4EVsZozLg"
> client="_ZshWcCugEd2ibIXNy_4Bag"/>
> ..
>
> I am looking to read the 'id' attribute of elements within the model,
> for instance the 'Model' element or the 'packagedElement' element above.
> Looking through the UML2 API, there doesn't appear to be a way to do this.
> Does someone know of a way to access these 'id' attributes?
>
> Thanks & Cheers.
>
>
Re: How to read the xmi:id attribute in a UML model? [message #626872 is a reply to message #477679] Tue, 12 August 2008 08:36 Go to previous message
Eclipse UserFriend
Spot on!!! Thanks, appreciate it.

Cheers.
Previous Topic:How to read the xmi:id attribute in a UML model?
Next Topic:Setting Is Unique property - where is it implemented?
Goto Forum:
  


Current Time: Wed Jul 02 23:22:18 EDT 2025

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

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

Back to the top