|The ID of a UML element [message #657583]
||Thu, 03 March 2011 11:13
Registered: November 2010
Does the UML metamodel provide any way to access the ID of an element? They often look like this in the XML:
<element xmi:type="uml:OpaqueAction" href="SomeModel.uml#_dmKHMDjwEeCH9LLYtylVBA"/>
The ID being the part after the '#'.
I'm trying to access the ID in a QVTo transformation, isn't it the metamodel that provides the methods for accessing data like this, rather than the transformation language itself?
[Updated on: Thu, 03 March 2011 11:16]
Report message to a moderator
|Re: The ID of a UML element [message #657907 is a reply to message #657817]
||Fri, 04 March 2011 14:45
| Ed Merks
Registered: July 2009
Rafael Chaves wrote:
> I think that may be true for cross resource references only, right?
The code eObject.eResource().getURIFragment(eObject) doesn't even care
whether anything references that object... Note however, that it will
return the ID if there's an ID but will always return a non-null result
> Doesn't this work for all cases?
> ((XMIResource) resource).getID(eObject)
This only works in cases where you're contained in an XMIResource. It
will return null if the eObject doesn't have an ID.
Powered by FUDForum
. Page generated in 0.01855 seconds