Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Programmatically generating XMI
Programmatically generating XMI [message #478091] Tue, 23 December 2008 11:00 Go to next message
Vikram Sjn is currently offline Vikram SjnFriend
Messages: 39
Registered: July 2009
Member
Hello All,

I am new to EMF, UML2, and XMI.

'Getting Started with UML2' article at Eclipse.org [1] was very helpful,
and now I am able to create the model, and the .uml file.

I have to save this model as xmi, so that it is compatible with file
generated and expected by tools like RSA and Visual Paradigm.

Please tell me how can I generate the compatible xmi programmatically. Or
if there is class in Eclipse, or article that describes this.

Thanks
Vikram


[1]
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
Re: Programmatically generating XMI [message #478092 is a reply to message #478091] Tue, 23 December 2008 13:01 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
Vikram,

EclipseUML2 model provides standard xmi export and is the only official
and usable OMG metamodel. UML tools should therefore provide an import or
use a native interface like EclipseUML from Omondo.

I don't see why EclipseUML2 should support over 100 UML tool vendors !!
This job should be done by each vendor.

Vlad
Omondo
Re: Programmatically generating XMI [message #478093 is a reply to message #478091] Tue, 23 December 2008 13:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Vikram,

Probably org.eclipse.uml2.uml.XMI2*Resource.Factory.INSTANCE can be used
to do XMI <-> UML2* mapping.


Vikram wrote:
> Hello All,
>
> I am new to EMF, UML2, and XMI.
>
> 'Getting Started with UML2' article at Eclipse.org [1] was very
> helpful, and now I am able to create the model, and the .uml file.
>
> I have to save this model as xmi, so that it is compatible with file
> generated and expected by tools like RSA and Visual Paradigm.
>
> Please tell me how can I generate the compatible xmi programmatically.
> Or if there is class in Eclipse, or article that describes this.
>
> Thanks
> Vikram
>
>
> [1]
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Programmatically generating XMI [message #478094 is a reply to message #478092] Tue, 23 December 2008 13:59 Go to previous messageGo to next message
Vikram Sjn is currently offline Vikram SjnFriend
Messages: 39
Registered: July 2009
Member
Vlad,

As I told I am new to EMF, UML2, XMI.

I read some posts, and saw the import interface of Visual Paradigm (VP)
that it expects XMI file to import UML model. Whereas RSA & RSM have
options to export 'UML2 Model' & 'UML2 XMI Interchange Model'.

This probably got me that .uml file is UML Model format, and XMI
interchange model (.xmi) file will be file importable in VP and such tools.

After your post I imported .uml file in VP and it imported fine.
Thanks a lot.

However I am still confused.
Opting 'Save As...' in Eclipse 3.4 and specifying .xmi extension, the
generated file is slightly in different format (with attributes like
xmi:type="uml:Property").

If .uml file is itself in XMI format, then why does specifying .xmi
extension changes file contents?

Vikram
Re: Programmatically generating XMI [message #478095 is a reply to message #478091] Tue, 23 December 2008 15:58 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Vikram,

The "native" .uml resources produced by the default resource implementation
in UML2 are actually XMI, but make use of some constructs/conventions
specific to Eclipse (EMF). All tools based on Eclipse UML2, which now
includes most of the major UML tool vendors, should directly support this
format. When you save a UML resource with an extension of .xmi (just a
convention, really), the serialization that is produced is also XMI, but all
of the constructs that are specific to the Eclipse implemenation are
embedded in XMI extension elements.

Producing the "compatible XMI" programmatically is just a matter of using a
different resource implementation (as Ed has implied) to save the resource.
One way to do this is to factory a new one using the .xmi extension,
copy/move the contents from your .uml resource, and save it. For more detail
on how to do this, take a look at the source for the UMLEditor class...

Kenn

"Vikram " <vikram.sjn@gmail.com> wrote in message
news:99c2cf5d4a7d23596d0cd12d7b2c8740$1@www.eclipse.org...
> Hello All,
>
> I am new to EMF, UML2, and XMI.
>
> 'Getting Started with UML2' article at Eclipse.org [1] was very helpful,
> and now I am able to create the model, and the .uml file.
>
> I have to save this model as xmi, so that it is compatible with file
> generated and expected by tools like RSA and Visual Paradigm.
>
> Please tell me how can I generate the compatible xmi programmatically. Or
> if there is class in Eclipse, or article that describes this.
>
> Thanks
> Vikram
>
>
> [1]
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
>
>
Re: Programmatically generating XMI [message #478096 is a reply to message #478094] Tue, 23 December 2008 16:02 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Vikram,

I've pointed out the difference between the two formats in my other reply.
RSx calls .uml resources "UML2 models" and .xmi resources (produced by UML2)
"UML2 XMI interchange models".

Use of a different file extension is just a way to tell the editor which
resource implementation to use; this convention was "borrowed" from the way
EMF provides support for EMOF serializations of Ecore models (i.e. with a
..emof extension). I agree that it's not all that intuitive... there should
probably be a separate save option or export/import wizard instead... but
then the UML editor is just a sample, so tool vendors are free to do what
makes (more) sense for their users...

Kenn

"Vikram " <vikram.sjn@gmail.com> wrote in message
news:894fd5700edba22bb24407965c0efa63$1@www.eclipse.org...
> Vlad,
>
> As I told I am new to EMF, UML2, XMI.
>
> I read some posts, and saw the import interface of Visual Paradigm (VP)
> that it expects XMI file to import UML model. Whereas RSA & RSM have
> options to export 'UML2 Model' & 'UML2 XMI Interchange Model'.
>
> This probably got me that .uml file is UML Model format, and XMI
> interchange model (.xmi) file will be file importable in VP and such
> tools.
>
> After your post I imported .uml file in VP and it imported fine.
> Thanks a lot.
>
> However I am still confused. Opting 'Save As...' in Eclipse 3.4 and
> specifying .xmi extension, the generated file is slightly in different
> format (with attributes like xmi:type="uml:Property").
> If .uml file is itself in XMI format, then why does specifying .xmi
> extension changes file contents?
>
> Vikram
>
Re: Programmatically generating XMI [message #478097 is a reply to message #478096] Wed, 24 December 2008 05:18 Go to previous message
Vikram Sjn is currently offline Vikram SjnFriend
Messages: 39
Registered: July 2009
Member
Thanks a lot for replying and resolving my doubts.

Vikram
Re: Programmatically generating XMI [message #627301 is a reply to message #478091] Tue, 23 December 2008 13:01 Go to previous message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
Vikram,

EclipseUML2 model provides standard xmi export and is the only official
and usable OMG metamodel. UML tools should therefore provide an import or
use a native interface like EclipseUML from Omondo.

I don't see why EclipseUML2 should support over 100 UML tool vendors !!
This job should be done by each vendor.

Vlad
Omondo
Re: Programmatically generating XMI [message #627302 is a reply to message #478091] Tue, 23 December 2008 13:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Vikram,

Probably org.eclipse.uml2.uml.XMI2*Resource.Factory.INSTANCE can be used
to do XMI <-> UML2* mapping.


Vikram wrote:
> Hello All,
>
> I am new to EMF, UML2, and XMI.
>
> 'Getting Started with UML2' article at Eclipse.org [1] was very
> helpful, and now I am able to create the model, and the .uml file.
>
> I have to save this model as xmi, so that it is compatible with file
> generated and expected by tools like RSA and Visual Paradigm.
>
> Please tell me how can I generate the compatible xmi programmatically.
> Or if there is class in Eclipse, or article that describes this.
>
> Thanks
> Vikram
>
>
> [1]
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Programmatically generating XMI [message #627303 is a reply to message #478092] Tue, 23 December 2008 13:59 Go to previous message
Vikram Sjn is currently offline Vikram SjnFriend
Messages: 39
Registered: July 2009
Member
Vlad,

As I told I am new to EMF, UML2, XMI.

I read some posts, and saw the import interface of Visual Paradigm (VP)
that it expects XMI file to import UML model. Whereas RSA & RSM have
options to export 'UML2 Model' & 'UML2 XMI Interchange Model'.

This probably got me that .uml file is UML Model format, and XMI
interchange model (.xmi) file will be file importable in VP and such tools.

After your post I imported .uml file in VP and it imported fine.
Thanks a lot.

However I am still confused.
Opting 'Save As...' in Eclipse 3.4 and specifying .xmi extension, the
generated file is slightly in different format (with attributes like
xmi:type="uml:Property").

If .uml file is itself in XMI format, then why does specifying .xmi
extension changes file contents?

Vikram
Re: Programmatically generating XMI [message #627304 is a reply to message #478091] Tue, 23 December 2008 15:58 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Vikram,

The "native" .uml resources produced by the default resource implementation
in UML2 are actually XMI, but make use of some constructs/conventions
specific to Eclipse (EMF). All tools based on Eclipse UML2, which now
includes most of the major UML tool vendors, should directly support this
format. When you save a UML resource with an extension of .xmi (just a
convention, really), the serialization that is produced is also XMI, but all
of the constructs that are specific to the Eclipse implemenation are
embedded in XMI extension elements.

Producing the "compatible XMI" programmatically is just a matter of using a
different resource implementation (as Ed has implied) to save the resource.
One way to do this is to factory a new one using the .xmi extension,
copy/move the contents from your .uml resource, and save it. For more detail
on how to do this, take a look at the source for the UMLEditor class...

Kenn

"Vikram " <vikram.sjn@gmail.com> wrote in message
news:99c2cf5d4a7d23596d0cd12d7b2c8740$1@www.eclipse.org...
> Hello All,
>
> I am new to EMF, UML2, and XMI.
>
> 'Getting Started with UML2' article at Eclipse.org [1] was very helpful,
> and now I am able to create the model, and the .uml file.
>
> I have to save this model as xmi, so that it is compatible with file
> generated and expected by tools like RSA and Visual Paradigm.
>
> Please tell me how can I generate the compatible xmi programmatically. Or
> if there is class in Eclipse, or article that describes this.
>
> Thanks
> Vikram
>
>
> [1]
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
>
>
Re: Programmatically generating XMI [message #627305 is a reply to message #478094] Tue, 23 December 2008 16:02 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Vikram,

I've pointed out the difference between the two formats in my other reply.
RSx calls .uml resources "UML2 models" and .xmi resources (produced by UML2)
"UML2 XMI interchange models".

Use of a different file extension is just a way to tell the editor which
resource implementation to use; this convention was "borrowed" from the way
EMF provides support for EMOF serializations of Ecore models (i.e. with a
..emof extension). I agree that it's not all that intuitive... there should
probably be a separate save option or export/import wizard instead... but
then the UML editor is just a sample, so tool vendors are free to do what
makes (more) sense for their users...

Kenn

"Vikram " <vikram.sjn@gmail.com> wrote in message
news:894fd5700edba22bb24407965c0efa63$1@www.eclipse.org...
> Vlad,
>
> As I told I am new to EMF, UML2, XMI.
>
> I read some posts, and saw the import interface of Visual Paradigm (VP)
> that it expects XMI file to import UML model. Whereas RSA & RSM have
> options to export 'UML2 Model' & 'UML2 XMI Interchange Model'.
>
> This probably got me that .uml file is UML Model format, and XMI
> interchange model (.xmi) file will be file importable in VP and such
> tools.
>
> After your post I imported .uml file in VP and it imported fine.
> Thanks a lot.
>
> However I am still confused. Opting 'Save As...' in Eclipse 3.4 and
> specifying .xmi extension, the generated file is slightly in different
> format (with attributes like xmi:type="uml:Property").
> If .uml file is itself in XMI format, then why does specifying .xmi
> extension changes file contents?
>
> Vikram
>
Re: Programmatically generating XMI [message #627306 is a reply to message #478096] Wed, 24 December 2008 05:18 Go to previous message
Vikram Sjn is currently offline Vikram SjnFriend
Messages: 39
Registered: July 2009
Member
Thanks a lot for replying and resolving my doubts.

Vikram
Previous Topic:Programmatically generating XMI
Next Topic:UML 0.8 gmfmap broken
Goto Forum:
  


Current Time: Fri Apr 19 19:08:24 GMT 2024

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

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

Back to the top