Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 05:56 Go to next message
Swami is currently offline SwamiFriend
Messages: 6
Registered: July 2009
Junior Member
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 06:56 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
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 12:36 Go to previous message
Swami is currently offline SwamiFriend
Messages: 6
Registered: July 2009
Junior Member
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 06:56 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
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 12:36 Go to previous message
Swami is currently offline SwamiFriend
Messages: 6
Registered: July 2009
Junior Member
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: Thu Apr 02 14:01:18 GMT 2020

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

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

Back to the top