Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » xmi Id in Dependency
xmi Id in Dependency [message #477179] Thu, 03 April 2008 14:05 Go to next message
Richard Craddock is currently offline Richard CraddockFriend
Messages: 31
Registered: July 2009
Member
Hi,

I have a number of child projects that are dependant upon a common base.

What I really want to do is :
Export the common project into an XMI file.
Export each of the child projects into thier own XMI, each of which
referneces the common module.

However, each time I create a uml2 output from one of these child
projects, I appear to have to create a new copy of the common, because the
references to the common UML module are made using xmi:id values that get
recreated at each export. This in turn means the common UML is not common
at all because the references from the other "child" projects no longer
match.


So my question is :

a) Have I understood correctly how the xmi:id is created/used?
b) If I have, can the xmi:id be set by me to be something unique, yet
consistent across projects?
c) If so how can I do this?

Thanks in advance,

Richard
Re: xmi Id in Dependency [message #477224 is a reply to message #477179] Wed, 09 April 2008 15:33 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Richard,

a) Using the default UML2 resource implementation, UUIDs are used as XMI
identifiers and assigned dynamically as objects are attached to the
resource. If your common based model (and the resource that contains is) is
reconstructed each time it's updated, then yes, the identifiers will change.

b) Yes, the identifiers can be set explicitly (to something more stable) via
the XMLResource#setID(EObject, String) method. This is the approach we use
for the UML2 metamodels and libraries, for example.

c) For an example, see this code from the ConvertModelAction in the examples
plug-in:

protected String setID(EObject eObject) {
Resource eResource = eObject.eResource();

if (eResource instanceof XMIResource) {
XMIResource xmiResource = (XMIResource) eResource;
String id = xmiResource.getID(eObject);
xmiResource.setID(eObject, UML2Util
.getXMIIdentifier((InternalEObject) eObject));
return id;
}

return null;
}


Kenn

"Richard Craddock" <rcraddoc@cisco.com> wrote in message
news:78ea5f7f9f41e606eee19605cbf9284a$1@www.eclipse.org...
> Hi,
>
> I have a number of child projects that are dependant upon a common base.
>
> What I really want to do is :
> Export the common project into an XMI file.
> Export each of the child projects into thier own XMI, each of which
> referneces the common module.
>
> However, each time I create a uml2 output from one of these child
> projects, I appear to have to create a new copy of the common, because the
> references to the common UML module are made using xmi:id values that get
> recreated at each export. This in turn means the common UML is not common
> at all because the references from the other "child" projects no longer
> match.
>
>
> So my question is :
>
> a) Have I understood correctly how the xmi:id is created/used?
> b) If I have, can the xmi:id be set by me to be something unique, yet
> consistent across projects?
> c) If so how can I do this?
>
> Thanks in advance,
>
> Richard
>
>
>
Re: xmi Id in Dependency [message #626382 is a reply to message #477179] Wed, 09 April 2008 15:33 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Richard,

a) Using the default UML2 resource implementation, UUIDs are used as XMI
identifiers and assigned dynamically as objects are attached to the
resource. If your common based model (and the resource that contains is) is
reconstructed each time it's updated, then yes, the identifiers will change.

b) Yes, the identifiers can be set explicitly (to something more stable) via
the XMLResource#setID(EObject, String) method. This is the approach we use
for the UML2 metamodels and libraries, for example.

c) For an example, see this code from the ConvertModelAction in the examples
plug-in:

protected String setID(EObject eObject) {
Resource eResource = eObject.eResource();

if (eResource instanceof XMIResource) {
XMIResource xmiResource = (XMIResource) eResource;
String id = xmiResource.getID(eObject);
xmiResource.setID(eObject, UML2Util
.getXMIIdentifier((InternalEObject) eObject));
return id;
}

return null;
}


Kenn

"Richard Craddock" <rcraddoc@cisco.com> wrote in message
news:78ea5f7f9f41e606eee19605cbf9284a$1@www.eclipse.org...
> Hi,
>
> I have a number of child projects that are dependant upon a common base.
>
> What I really want to do is :
> Export the common project into an XMI file.
> Export each of the child projects into thier own XMI, each of which
> referneces the common module.
>
> However, each time I create a uml2 output from one of these child
> projects, I appear to have to create a new copy of the common, because the
> references to the common UML module are made using xmi:id values that get
> recreated at each export. This in turn means the common UML is not common
> at all because the references from the other "child" projects no longer
> match.
>
>
> So my question is :
>
> a) Have I understood correctly how the xmi:id is created/used?
> b) If I have, can the xmi:id be set by me to be something unique, yet
> consistent across projects?
> c) If so how can I do this?
>
> Thanks in advance,
>
> Richard
>
>
>
Previous Topic:Error after applying the stereotype EClass to a Class
Next Topic:Error in 17.5.7 Classifier
Goto Forum:
  


Current Time: Thu Apr 25 19:31:24 GMT 2024

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

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

Back to the top