Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Serialize a UMLResource as OMG XMI
Serialize a UMLResource as OMG XMI [message #477629] Tue, 22 July 2008 21:37 Go to next message
Joachim is currently offline JoachimFriend
Messages: 16
Registered: July 2009
Junior Member
I have a UML model and its profiles available as UMLResource and can
serialize it easily with the UMLResource::save method into a fine XMI file.

The serialized file has the namespace
"http://www.eclipse.org/uml2/2.1.0/UML" for UML elements.
The namespace is from the constant field UMLPackage.eNS_URI.

I'd like to have a real OMG conform XMI file with the namespace
xmlns:uml="http://schema.omg.org/spec/UML/2.0/uml.xml" as it is supposed
in http://www.omg.org/docs/formal/07-11-04.pdf.

Is it possible to create such an XMI file from a Eclipse UML model?
I helped myself by writing a XSLT which transforms the Eclipse XMI file
into a OMG XMI file, but this seems tedious to me, as I thought that I am
not the first one who likes this. I found many articles for the other way
round, to import a OMG XMI into Ecore, but nothing in this direction.

Can someone please help me with a hint?
Re: Serialize a UMLResource as OMG XMI [message #477630 is a reply to message #477629] Wed, 23 July 2008 01:56 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Joachim,

Try simply saving your XXX.uml model as XXX.xmi.

From the UML editor:
1. Select your .uml model.
2. Select File > Save As ...
3. as the file name, use a .xmi extension.

You can save as .cmof as well.

The details are described in the "New and Noteworthy" article here
http://wiki.eclipse.org/MDT_1.1_New_and_Noteworthy (Section Release 2.2 M5)

Cheers,
- James.


"Joachim Back" <j.back@mid.de> wrote in message
news:dadcbbccb2a0f032754819f3b6b83a1c$1@www.eclipse.org...
>I have a UML model and its profiles available as UMLResource and can
>serialize it easily with the UMLResource::save method into a fine XMI file.
>
> The serialized file has the namespace
> "http://www.eclipse.org/uml2/2.1.0/UML" for UML elements.
> The namespace is from the constant field UMLPackage.eNS_URI.
>
> I'd like to have a real OMG conform XMI file with the namespace
> xmlns:uml="http://schema.omg.org/spec/UML/2.0/uml.xml" as it is supposed
> in http://www.omg.org/docs/formal/07-11-04.pdf.
>
> Is it possible to create such an XMI file from a Eclipse UML model?
> I helped myself by writing a XSLT which transforms the Eclipse XMI file
> into a OMG XMI file, but this seems tedious to me, as I thought that I am
> not the first one who likes this. I found many articles for the other way
> round, to import a OMG XMI into Ecore, but nothing in this direction.
>
> Can someone please help me with a hint?
>
>
>
>
>
>
>
Re: Serialize a UMLResource as OMG XMI [message #477631 is a reply to message #477630] Wed, 23 July 2008 02:02 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
.... the conversion to official .xmi will take place automatically behind the
scenes during the save process...


"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:g6634a$r8i$1@build.eclipse.org...
> Hi Joachim,
>
> Try simply saving your XXX.uml model as XXX.xmi.
>
> From the UML editor:
> 1. Select your .uml model.
> 2. Select File > Save As ...
> 3. as the file name, use a .xmi extension.
>
> You can save as .cmof as well.
>
> The details are described in the "New and Noteworthy" article here
> http://wiki.eclipse.org/MDT_1.1_New_and_Noteworthy (Section Release 2.2
> M5)
>
> Cheers,
> - James.
>
>
> "Joachim Back" <j.back@mid.de> wrote in message
> news:dadcbbccb2a0f032754819f3b6b83a1c$1@www.eclipse.org...
>>I have a UML model and its profiles available as UMLResource and can
>>serialize it easily with the UMLResource::save method into a fine XMI
>>file.
>>
>> The serialized file has the namespace
>> "http://www.eclipse.org/uml2/2.1.0/UML" for UML elements.
>> The namespace is from the constant field UMLPackage.eNS_URI.
>>
>> I'd like to have a real OMG conform XMI file with the namespace
>> xmlns:uml="http://schema.omg.org/spec/UML/2.0/uml.xml" as it is supposed
>> in http://www.omg.org/docs/formal/07-11-04.pdf.
>>
>> Is it possible to create such an XMI file from a Eclipse UML model?
>> I helped myself by writing a XSLT which transforms the Eclipse XMI file
>> into a OMG XMI file, but this seems tedious to me, as I thought that I am
>> not the first one who likes this. I found many articles for the other way
>> round, to import a OMG XMI into Ecore, but nothing in this direction.
>>
>> Can someone please help me with a hint?
>>
>>
>>
>>
>>
>>
>>
>
>
Re: Serialize a UMLResource as OMG XMI [message #477632 is a reply to message #477631] Wed, 23 July 2008 08:49 Go to previous messageGo to next message
Joachim is currently offline JoachimFriend
Messages: 16
Registered: July 2009
Junior Member
Hi James,

thanks for the quick answer.
I tried it and it really worked. Awesome.

How can I achieve this programmatically?
I tried with setting "xmi" as file extension and failed.
UMLResource umlTarget = ...
sUri = sUri.replace(".profile.uml", ".xmi");
sUri = sUri.replace(".uml", ".xmi");
URI xmiUri = URI.createFileURI(sUri);
umlTarget.setURI(xmiUri);
umlTarget.save(mapOption);
I assume that this is because, I have
RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
but I have not registered the file extension "xmi".

Regards,
Joachim
Re: Serialize a UMLResource as OMG XMI [message #477633 is a reply to message #477632] Wed, 23 July 2008 14:01 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Joachim,


You can have a look at this article
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
at the section entitled programmatic migration and use a similar technique
to save to the .xmi extension ( the registerExtensions() method would have
to be modified slightly in addition to other small changes .. but that
should do it for you ). In addition, the code there shows how to properly
update references.

Cheers,
- James.





"Joachim Back" <j.back@mid.de> wrote in message
news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
> Hi James,
>
> thanks for the quick answer.
> I tried it and it really worked. Awesome.
>
> How can I achieve this programmatically?
> I tried with setting "xmi" as file extension and failed.
> UMLResource umlTarget = ...
> sUri = sUri.replace(".profile.uml", ".xmi");
> sUri = sUri.replace(".uml", ".xmi");
> URI xmiUri = URI.createFileURI(sUri);
> umlTarget.setURI(xmiUri);
> umlTarget.save(mapOption);
> I assume that this is because, I have
> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
> but I have not registered the file extension "xmi".
>
> Regards,
> Joachim
>
Re: Serialize a UMLResource as OMG XMI [message #477776 is a reply to message #477633] Thu, 02 October 2008 13:30 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
James,

I think we need to add an article that explains, in detail, how to convert
from an Eclipse UML model to an OMG UML or CMOF model and back, both via the
editor and programmatically. I'll be providing better support for this kind
of thing in the soon-to-be-proposed MST project (see
http://wiki.eclipse.org/MDT/MST-Proposal), but an article would also help
(and I'd be willing to write it)...

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:g67djv$olq$1@build.eclipse.org...
> Hi Joachim,
>
>
> You can have a look at this article
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
> at the section entitled programmatic migration and use a similar technique
> to save to the .xmi extension ( the registerExtensions() method would have
> to be modified slightly in addition to other small changes .. but that
> should do it for you ). In addition, the code there shows how to properly
> update references.
>
> Cheers,
> - James.
>
>
>
>
>
> "Joachim Back" <j.back@mid.de> wrote in message
> news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
>> Hi James,
>>
>> thanks for the quick answer.
>> I tried it and it really worked. Awesome.
>>
>> How can I achieve this programmatically?
>> I tried with setting "xmi" as file extension and failed.
>> UMLResource umlTarget = ...
>> sUri = sUri.replace(".profile.uml", ".xmi");
>> sUri = sUri.replace(".uml", ".xmi");
>> URI xmiUri = URI.createFileURI(sUri);
>> umlTarget.setURI(xmiUri);
>> umlTarget.save(mapOption);
>> I assume that this is because, I have
>> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>> but I have not registered the file extension "xmi".
>>
>> Regards,
>> Joachim
>>
>
>
Re: Serialize a UMLResource as OMG XMI [message #477777 is a reply to message #477776] Thu, 02 October 2008 14:17 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Kenn,

Yes I agree, there should be some article explaining the ins and outs of
..cmof vs. .xmi vs .uml and how to convert back and forth.
Perhaps even explaining the differences between XMI and XML and the pros and
cons of both (inheritance etc.).

I also am a little uncertain about how to manage the overlap between
proposed features of the MST project and what is already supported in the
UML2 project.
Would moving existing xmi and cmof functionality from the UML2 project and
moving to the MST project make sense?

Cheers,
- James.


"Kenn Hussey" <Kenn.Hussey@embarcadero.com> wrote in message
news:gc2ie8$gv9$1@build.eclipse.org...
> James,
>
> I think we need to add an article that explains, in detail, how to convert
> from an Eclipse UML model to an OMG UML or CMOF model and back, both via
> the editor and programmatically. I'll be providing better support for this
> kind of thing in the soon-to-be-proposed MST project (see
> http://wiki.eclipse.org/MDT/MST-Proposal), but an article would also help
> (and I'd be willing to write it)...
>
> Kenn
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:g67djv$olq$1@build.eclipse.org...
>> Hi Joachim,
>>
>>
>> You can have a look at this article
>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>> at the section entitled programmatic migration and use a similar
>> technique to save to the .xmi extension ( the registerExtensions() method
>> would have to be modified slightly in addition to other small changes ..
>> but that should do it for you ). In addition, the code there shows how
>> to properly update references.
>>
>> Cheers,
>> - James.
>>
>>
>>
>>
>>
>> "Joachim Back" <j.back@mid.de> wrote in message
>> news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
>>> Hi James,
>>>
>>> thanks for the quick answer.
>>> I tried it and it really worked. Awesome.
>>>
>>> How can I achieve this programmatically?
>>> I tried with setting "xmi" as file extension and failed.
>>> UMLResource umlTarget = ...
>>> sUri = sUri.replace(".profile.uml", ".xmi");
>>> sUri = sUri.replace(".uml", ".xmi");
>>> URI xmiUri = URI.createFileURI(sUri);
>>> umlTarget.setURI(xmiUri);
>>> umlTarget.save(mapOption);
>>> I assume that this is because, I have
>>> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
>>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>> but I have not registered the file extension "xmi".
>>>
>>> Regards,
>>> Joachim
>>>
>>
>>
>
>
Re: Serialize a UMLResource as OMG XMI [message #477781 is a reply to message #477777] Fri, 03 October 2008 01:17 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Well, I already have some code that extends editors in EMF and UML2 to ease
the conversion. The support for XMI and CMOF is useful in UML2, but its
approach is from a UML2 perspective, e.g. things that don't belong in OMG
UML or CMOF are preserved in annotations. In MST, support would be from a
CMOF perspective, so stuff that isn't needed is simply discarded. Basically,
I think there's a need for this kind of support in both projects.

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:gc2l39$so7$1@build.eclipse.org...
> Hi Kenn,
>
> Yes I agree, there should be some article explaining the ins and outs of
> .cmof vs. .xmi vs .uml and how to convert back and forth.
> Perhaps even explaining the differences between XMI and XML and the pros
> and cons of both (inheritance etc.).
>
> I also am a little uncertain about how to manage the overlap between
> proposed features of the MST project and what is already supported in the
> UML2 project.
> Would moving existing xmi and cmof functionality from the UML2 project and
> moving to the MST project make sense?
>
> Cheers,
> - James.
>
>
> "Kenn Hussey" <Kenn.Hussey@embarcadero.com> wrote in message
> news:gc2ie8$gv9$1@build.eclipse.org...
>> James,
>>
>> I think we need to add an article that explains, in detail, how to
>> convert from an Eclipse UML model to an OMG UML or CMOF model and back,
>> both via the editor and programmatically. I'll be providing better
>> support for this kind of thing in the soon-to-be-proposed MST project
>> (see http://wiki.eclipse.org/MDT/MST-Proposal), but an article would also
>> help (and I'd be willing to write it)...
>>
>> Kenn
>>
>> "James Bruck" <jbruck@ca.ibm.com> wrote in message
>> news:g67djv$olq$1@build.eclipse.org...
>>> Hi Joachim,
>>>
>>>
>>> You can have a look at this article
>>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>> at the section entitled programmatic migration and use a similar
>>> technique to save to the .xmi extension ( the registerExtensions()
>>> method would have to be modified slightly in addition to other small
>>> changes .. but that should do it for you ). In addition, the code there
>>> shows how to properly update references.
>>>
>>> Cheers,
>>> - James.
>>>
>>>
>>>
>>>
>>>
>>> "Joachim Back" <j.back@mid.de> wrote in message
>>> news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
>>>> Hi James,
>>>>
>>>> thanks for the quick answer.
>>>> I tried it and it really worked. Awesome.
>>>>
>>>> How can I achieve this programmatically?
>>>> I tried with setting "xmi" as file extension and failed.
>>>> UMLResource umlTarget = ...
>>>> sUri = sUri.replace(".profile.uml", ".xmi");
>>>> sUri = sUri.replace(".uml", ".xmi");
>>>> URI xmiUri = URI.createFileURI(sUri);
>>>> umlTarget.setURI(xmiUri);
>>>> umlTarget.save(mapOption);
>>>> I assume that this is because, I have
>>>> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
>>>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>>> but I have not registered the file extension "xmi".
>>>>
>>>> Regards,
>>>> Joachim
>>>>
>>>
>>>
>>
>>
>
>
Re: Serialize a UMLResource as OMG XMI [message #626821 is a reply to message #477629] Wed, 23 July 2008 01:56 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Joachim,

Try simply saving your XXX.uml model as XXX.xmi.

From the UML editor:
1. Select your .uml model.
2. Select File > Save As ...
3. as the file name, use a .xmi extension.

You can save as .cmof as well.

The details are described in the "New and Noteworthy" article here
http://wiki.eclipse.org/MDT_1.1_New_and_Noteworthy (Section Release 2.2 M5)

Cheers,
- James.


"Joachim Back" <j.back@mid.de> wrote in message
news:dadcbbccb2a0f032754819f3b6b83a1c$1@www.eclipse.org...
>I have a UML model and its profiles available as UMLResource and can
>serialize it easily with the UMLResource::save method into a fine XMI file.
>
> The serialized file has the namespace
> "http://www.eclipse.org/uml2/2.1.0/UML" for UML elements.
> The namespace is from the constant field UMLPackage.eNS_URI.
>
> I'd like to have a real OMG conform XMI file with the namespace
> xmlns:uml="http://schema.omg.org/spec/UML/2.0/uml.xml" as it is supposed
> in http://www.omg.org/docs/formal/07-11-04.pdf
>
> Is it possible to create such an XMI file from a Eclipse UML model?
> I helped myself by writing a XSLT which transforms the Eclipse XMI file
> into a OMG XMI file, but this seems tedious to me, as I thought that I am
> not the first one who likes this. I found many articles for the other way
> round, to import a OMG XMI into Ecore, but nothing in this direction.
>
> Can someone please help me with a hint?
>
>
>
>
>
>
>
Re: Serialize a UMLResource as OMG XMI [message #626822 is a reply to message #477630] Wed, 23 July 2008 02:02 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
.... the conversion to official .xmi will take place automatically behind the
scenes during the save process...


"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:g6634a$r8i$1@build.eclipse.org...
> Hi Joachim,
>
> Try simply saving your XXX.uml model as XXX.xmi.
>
> From the UML editor:
> 1. Select your .uml model.
> 2. Select File > Save As ...
> 3. as the file name, use a .xmi extension.
>
> You can save as .cmof as well.
>
> The details are described in the "New and Noteworthy" article here
> http://wiki.eclipse.org/MDT_1.1_New_and_Noteworthy (Section Release 2.2
> M5)
>
> Cheers,
> - James.
>
>
> "Joachim Back" <j.back@mid.de> wrote in message
> news:dadcbbccb2a0f032754819f3b6b83a1c$1@www.eclipse.org...
>>I have a UML model and its profiles available as UMLResource and can
>>serialize it easily with the UMLResource::save method into a fine XMI
>>file.
>>
>> The serialized file has the namespace
>> "http://www.eclipse.org/uml2/2.1.0/UML" for UML elements.
>> The namespace is from the constant field UMLPackage.eNS_URI.
>>
>> I'd like to have a real OMG conform XMI file with the namespace
>> xmlns:uml="http://schema.omg.org/spec/UML/2.0/uml.xml" as it is supposed
>> in http://www.omg.org/docs/formal/07-11-04.pdf
>>
>> Is it possible to create such an XMI file from a Eclipse UML model?
>> I helped myself by writing a XSLT which transforms the Eclipse XMI file
>> into a OMG XMI file, but this seems tedious to me, as I thought that I am
>> not the first one who likes this. I found many articles for the other way
>> round, to import a OMG XMI into Ecore, but nothing in this direction.
>>
>> Can someone please help me with a hint?
>>
>>
>>
>>
>>
>>
>>
>
>
Re: Serialize a UMLResource as OMG XMI [message #626823 is a reply to message #477631] Wed, 23 July 2008 08:49 Go to previous message
Joachim is currently offline JoachimFriend
Messages: 16
Registered: July 2009
Junior Member
Hi James,

thanks for the quick answer.
I tried it and it really worked. Awesome.

How can I achieve this programmatically?
I tried with setting "xmi" as file extension and failed.
UMLResource umlTarget = ...
sUri = sUri.replace(".profile.uml", ".xmi");
sUri = sUri.replace(".uml", ".xmi");
URI xmiUri = URI.createFileURI(sUri);
umlTarget.setURI(xmiUri);
umlTarget.save(mapOption);
I assume that this is because, I have
RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
but I have not registered the file extension "xmi".

Regards,
Joachim
Re: Serialize a UMLResource as OMG XMI [message #626824 is a reply to message #477632] Wed, 23 July 2008 14:01 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Joachim,


You can have a look at this article
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
at the section entitled programmatic migration and use a similar technique
to save to the .xmi extension ( the registerExtensions() method would have
to be modified slightly in addition to other small changes .. but that
should do it for you ). In addition, the code there shows how to properly
update references.

Cheers,
- James.





"Joachim Back" <j.back@mid.de> wrote in message
news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
> Hi James,
>
> thanks for the quick answer.
> I tried it and it really worked. Awesome.
>
> How can I achieve this programmatically?
> I tried with setting "xmi" as file extension and failed.
> UMLResource umlTarget = ...
> sUri = sUri.replace(".profile.uml", ".xmi");
> sUri = sUri.replace(".uml", ".xmi");
> URI xmiUri = URI.createFileURI(sUri);
> umlTarget.setURI(xmiUri);
> umlTarget.save(mapOption);
> I assume that this is because, I have
> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
> but I have not registered the file extension "xmi".
>
> Regards,
> Joachim
>
Re: Serialize a UMLResource as OMG XMI [message #626974 is a reply to message #477633] Thu, 02 October 2008 13:30 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
James,

I think we need to add an article that explains, in detail, how to convert
from an Eclipse UML model to an OMG UML or CMOF model and back, both via the
editor and programmatically. I'll be providing better support for this kind
of thing in the soon-to-be-proposed MST project (see
http://wiki.eclipse.org/MDT/MST-Proposal), but an article would also help
(and I'd be willing to write it)...

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:g67djv$olq$1@build.eclipse.org...
> Hi Joachim,
>
>
> You can have a look at this article
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
> at the section entitled programmatic migration and use a similar technique
> to save to the .xmi extension ( the registerExtensions() method would have
> to be modified slightly in addition to other small changes .. but that
> should do it for you ). In addition, the code there shows how to properly
> update references.
>
> Cheers,
> - James.
>
>
>
>
>
> "Joachim Back" <j.back@mid.de> wrote in message
> news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
>> Hi James,
>>
>> thanks for the quick answer.
>> I tried it and it really worked. Awesome.
>>
>> How can I achieve this programmatically?
>> I tried with setting "xmi" as file extension and failed.
>> UMLResource umlTarget = ...
>> sUri = sUri.replace(".profile.uml", ".xmi");
>> sUri = sUri.replace(".uml", ".xmi");
>> URI xmiUri = URI.createFileURI(sUri);
>> umlTarget.setURI(xmiUri);
>> umlTarget.save(mapOption);
>> I assume that this is because, I have
>> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>> but I have not registered the file extension "xmi".
>>
>> Regards,
>> Joachim
>>
>
>
Re: Serialize a UMLResource as OMG XMI [message #626976 is a reply to message #477776] Thu, 02 October 2008 14:17 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Kenn,

Yes I agree, there should be some article explaining the ins and outs of
..cmof vs. .xmi vs .uml and how to convert back and forth.
Perhaps even explaining the differences between XMI and XML and the pros and
cons of both (inheritance etc.).

I also am a little uncertain about how to manage the overlap between
proposed features of the MST project and what is already supported in the
UML2 project.
Would moving existing xmi and cmof functionality from the UML2 project and
moving to the MST project make sense?

Cheers,
- James.


"Kenn Hussey" <Kenn.Hussey@embarcadero.com> wrote in message
news:gc2ie8$gv9$1@build.eclipse.org...
> James,
>
> I think we need to add an article that explains, in detail, how to convert
> from an Eclipse UML model to an OMG UML or CMOF model and back, both via
> the editor and programmatically. I'll be providing better support for this
> kind of thing in the soon-to-be-proposed MST project (see
> http://wiki.eclipse.org/MDT/MST-Proposal), but an article would also help
> (and I'd be willing to write it)...
>
> Kenn
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:g67djv$olq$1@build.eclipse.org...
>> Hi Joachim,
>>
>>
>> You can have a look at this article
>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>> at the section entitled programmatic migration and use a similar
>> technique to save to the .xmi extension ( the registerExtensions() method
>> would have to be modified slightly in addition to other small changes ..
>> but that should do it for you ). In addition, the code there shows how
>> to properly update references.
>>
>> Cheers,
>> - James.
>>
>>
>>
>>
>>
>> "Joachim Back" <j.back@mid.de> wrote in message
>> news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
>>> Hi James,
>>>
>>> thanks for the quick answer.
>>> I tried it and it really worked. Awesome.
>>>
>>> How can I achieve this programmatically?
>>> I tried with setting "xmi" as file extension and failed.
>>> UMLResource umlTarget = ...
>>> sUri = sUri.replace(".profile.uml", ".xmi");
>>> sUri = sUri.replace(".uml", ".xmi");
>>> URI xmiUri = URI.createFileURI(sUri);
>>> umlTarget.setURI(xmiUri);
>>> umlTarget.save(mapOption);
>>> I assume that this is because, I have
>>> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
>>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>> but I have not registered the file extension "xmi".
>>>
>>> Regards,
>>> Joachim
>>>
>>
>>
>
>
Re: Serialize a UMLResource as OMG XMI [message #626980 is a reply to message #477777] Fri, 03 October 2008 01:17 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Well, I already have some code that extends editors in EMF and UML2 to ease
the conversion. The support for XMI and CMOF is useful in UML2, but its
approach is from a UML2 perspective, e.g. things that don't belong in OMG
UML or CMOF are preserved in annotations. In MST, support would be from a
CMOF perspective, so stuff that isn't needed is simply discarded. Basically,
I think there's a need for this kind of support in both projects.

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:gc2l39$so7$1@build.eclipse.org...
> Hi Kenn,
>
> Yes I agree, there should be some article explaining the ins and outs of
> .cmof vs. .xmi vs .uml and how to convert back and forth.
> Perhaps even explaining the differences between XMI and XML and the pros
> and cons of both (inheritance etc.).
>
> I also am a little uncertain about how to manage the overlap between
> proposed features of the MST project and what is already supported in the
> UML2 project.
> Would moving existing xmi and cmof functionality from the UML2 project and
> moving to the MST project make sense?
>
> Cheers,
> - James.
>
>
> "Kenn Hussey" <Kenn.Hussey@embarcadero.com> wrote in message
> news:gc2ie8$gv9$1@build.eclipse.org...
>> James,
>>
>> I think we need to add an article that explains, in detail, how to
>> convert from an Eclipse UML model to an OMG UML or CMOF model and back,
>> both via the editor and programmatically. I'll be providing better
>> support for this kind of thing in the soon-to-be-proposed MST project
>> (see http://wiki.eclipse.org/MDT/MST-Proposal), but an article would also
>> help (and I'd be willing to write it)...
>>
>> Kenn
>>
>> "James Bruck" <jbruck@ca.ibm.com> wrote in message
>> news:g67djv$olq$1@build.eclipse.org...
>>> Hi Joachim,
>>>
>>>
>>> You can have a look at this article
>>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>> at the section entitled programmatic migration and use a similar
>>> technique to save to the .xmi extension ( the registerExtensions()
>>> method would have to be modified slightly in addition to other small
>>> changes .. but that should do it for you ). In addition, the code there
>>> shows how to properly update references.
>>>
>>> Cheers,
>>> - James.
>>>
>>>
>>>
>>>
>>>
>>> "Joachim Back" <j.back@mid.de> wrote in message
>>> news:700c7a70d8fbe41c969453714bfc9a96$1@www.eclipse.org...
>>>> Hi James,
>>>>
>>>> thanks for the quick answer.
>>>> I tried it and it really worked. Awesome.
>>>>
>>>> How can I achieve this programmatically?
>>>> I tried with setting "xmi" as file extension and failed.
>>>> UMLResource umlTarget = ...
>>>> sUri = sUri.replace(".profile.uml", ".xmi");
>>>> sUri = sUri.replace(".uml", ".xmi");
>>>> URI xmiUri = URI.createFileURI(sUri);
>>>> umlTarget.setURI(xmiUri);
>>>> umlTarget.save(mapOption);
>>>> I assume that this is because, I have
>>>> RESSET.getResourceFactoryRegistry().getExtensionToFactoryMap ().
>>>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>>> but I have not registered the file extension "xmi".
>>>>
>>>> Regards,
>>>> Joachim
>>>>
>>>
>>>
>>
>>
>
>
Previous Topic:UML Operation Object to EOperation
Next Topic:Private visibility of UML class attributes
Goto Forum:
  


Current Time: Thu Apr 18 23:54:30 GMT 2024

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

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

Back to the top