Home » Modeling » UML2 » Reading general XMI file
|
Re: Reading general XMI file [message #478617 is a reply to message #478613] |
Tue, 21 July 2009 15:07 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Tom,
I think this may be more of an EMF question regarding how to work with
ResourceSets you may want to try to post there for a more complete response.
One issue you will face will be to properly register packages with your
resource set.
Something like:
Map packageRegistry = resourceSet.getPackageRegistry();
packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
You will also probably need to register extensions:
Map extensionFactoryMap =
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
extensionFactoryMap.put(UMLResource.FILE_EXTENION,
UMLResource.Factory.INSTANCE);
The UML project also makes uses of pathmaps so you will need something like:
URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
I would recommend downloading the UML2 examples and plugins and see how it
makes use of extensions.
There is also some example code here (scroll toward the bottom):
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
The EMF newsgroup also has many Q/A regarding ResourceSets.
Cheers,
- James.
"Tom" <tom@collibra.com> wrote in message
news:h3no08$7pr$1@build.eclipse.org...
> Hi,
>
> I'm new the subject of parsing an XMI file with the eclipse libraries.
> I've read the "EMF Framework Programmer's Guide" and "Getting Started with
> UML2" in the UML2 wiki. I also googled a lot, but I could not find the
> right information on how my problem is solved or even an indication if it
> can be solved.
>
> I have a XMI file that has nothing to do with EMF/Ecore. The file contains
> a metamodel, unlike most guides (which seem only to work with concrete
> datamodels in their xmi files). This metamodel can for instance be a class
> diagram exported from IBM's Rational Rose or Visual Paradigm. I want to
> write an application that reads the classifiers and their associations
> from this XMI file. I believe it has to be possible to transform the
> metamodel to some Ecore object-set that can be browsed in Java. Am I
> correct?
>
> If so, how should I configure a ResourceSet to load the XMI file in this
> way? I tried using the UMLPackage.eINSTANCE in my code but with no succes,
> because I don't seem to understand the core concepts of ResourceSets and
> how I might configure them to load any XMI file. There seem to be an
> overwhelming amount of settings for Resouces that are to my knowledge not
> covered in some tutorial.
>
> Ideas? Sample source code would be highly appreciated :-)
>
> Regards,
> Tom
|
|
|
Re: Reading general XMI file [message #478623 is a reply to message #478617] |
Tue, 21 July 2009 17:20 |
Tom A Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Thanks James. I will try your code suggestions and maybe also look at
the other newsgroup you suggested.
James Bruck schreef:
> Hi Tom,
>
> I think this may be more of an EMF question regarding how to work with
> ResourceSets you may want to try to post there for a more complete response.
>
> One issue you will face will be to properly register packages with your
> resource set.
> Something like:
> Map packageRegistry = resourceSet.getPackageRegistry();
> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>
> You will also probably need to register extensions:
> Map extensionFactoryMap =
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
> UMLResource.Factory.INSTANCE);
>
> The UML project also makes uses of pathmaps so you will need something like:
> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>
> I would recommend downloading the UML2 examples and plugins and see how it
> makes use of extensions.
> There is also some example code here (scroll toward the bottom):
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>
> The EMF newsgroup also has many Q/A regarding ResourceSets.
>
> Cheers,
> - James.
>
> "Tom" <tom@collibra.com> wrote in message
> news:h3no08$7pr$1@build.eclipse.org...
>> Hi,
>>
>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>> I've read the "EMF Framework Programmer's Guide" and "Getting Started with
>> UML2" in the UML2 wiki. I also googled a lot, but I could not find the
>> right information on how my problem is solved or even an indication if it
>> can be solved.
>>
>> I have a XMI file that has nothing to do with EMF/Ecore. The file contains
>> a metamodel, unlike most guides (which seem only to work with concrete
>> datamodels in their xmi files). This metamodel can for instance be a class
>> diagram exported from IBM's Rational Rose or Visual Paradigm. I want to
>> write an application that reads the classifiers and their associations
>> from this XMI file. I believe it has to be possible to transform the
>> metamodel to some Ecore object-set that can be browsed in Java. Am I
>> correct?
>>
>> If so, how should I configure a ResourceSet to load the XMI file in this
>> way? I tried using the UMLPackage.eINSTANCE in my code but with no succes,
>> because I don't seem to understand the core concepts of ResourceSets and
>> how I might configure them to load any XMI file. There seem to be an
>> overwhelming amount of settings for Resouces that are to my knowledge not
>> covered in some tutorial.
>>
>> Ideas? Sample source code would be highly appreciated :-)
>>
>> Regards,
>> Tom
>
>
|
|
|
Re: Reading general XMI file [message #478625 is a reply to message #478617] |
Wed, 22 July 2009 10:22 |
Tom A Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Hi,
I'm having trouble finding the source code of the examples (for UML2
3.0.0). I googled for org.eclipse.uml2.examples.source, but I don't seem
to find the source code of the examples. Where have you placed the
source code ? :)
Thank you.
Regards,
Tom
James Bruck wrote:
> Hi Tom,
>
> I think this may be more of an EMF question regarding how to work with
> ResourceSets you may want to try to post there for a more complete response.
>
> One issue you will face will be to properly register packages with your
> resource set.
> Something like:
> Map packageRegistry = resourceSet.getPackageRegistry();
> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>
> You will also probably need to register extensions:
> Map extensionFactoryMap =
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
> UMLResource.Factory.INSTANCE);
>
> The UML project also makes uses of pathmaps so you will need something like:
> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>
> I would recommend downloading the UML2 examples and plugins and see how it
> makes use of extensions.
> There is also some example code here (scroll toward the bottom):
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>
> The EMF newsgroup also has many Q/A regarding ResourceSets.
>
> Cheers,
> - James.
>
> "Tom" <tom@collibra.com> wrote in message
> news:h3no08$7pr$1@build.eclipse.org...
>> Hi,
>>
>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>> I've read the "EMF Framework Programmer's Guide" and "Getting Started with
>> UML2" in the UML2 wiki. I also googled a lot, but I could not find the
>> right information on how my problem is solved or even an indication if it
>> can be solved.
>>
>> I have a XMI file that has nothing to do with EMF/Ecore. The file contains
>> a metamodel, unlike most guides (which seem only to work with concrete
>> datamodels in their xmi files). This metamodel can for instance be a class
>> diagram exported from IBM's Rational Rose or Visual Paradigm. I want to
>> write an application that reads the classifiers and their associations
>> from this XMI file. I believe it has to be possible to transform the
>> metamodel to some Ecore object-set that can be browsed in Java. Am I
>> correct?
>>
>> If so, how should I configure a ResourceSet to load the XMI file in this
>> way? I tried using the UMLPackage.eINSTANCE in my code but with no succes,
>> because I don't seem to understand the core concepts of ResourceSets and
>> how I might configure them to load any XMI file. There seem to be an
>> overwhelming amount of settings for Resouces that are to my knowledge not
>> covered in some tutorial.
>>
>> Ideas? Sample source code would be highly appreciated :-)
>>
>> Regards,
>> Tom
>
>
|
|
|
Re: Reading general XMI file [message #478626 is a reply to message #478625] |
Wed, 22 July 2009 15:38 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
The source code is now jar'd up.
Download the UML2 SDK and then look for those .jars with a .source prefix
(ie. org.eclipse.uml2.examples.uml.ui.source_3.0.0xxx)
Cheers,
- James.
"tom" <tom@collibra.com> wrote in message
news:h46p8h$ect$1@build.eclipse.org...
> Hi,
>
> I'm having trouble finding the source code of the examples (for UML2
> 3.0.0). I googled for org.eclipse.uml2.examples.source, but I don't seem
> to find the source code of the examples. Where have you placed the source
> code ? :)
>
> Thank you.
>
> Regards,
> Tom
>
> James Bruck wrote:
>> Hi Tom,
>>
>> I think this may be more of an EMF question regarding how to work with
>> ResourceSets you may want to try to post there for a more complete
>> response.
>>
>> One issue you will face will be to properly register packages with your
>> resource set.
>> Something like:
>> Map packageRegistry = resourceSet.getPackageRegistry();
>> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>>
>> You will also probably need to register extensions:
>> Map extensionFactoryMap =
>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
>> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
>> UMLResource.Factory.INSTANCE);
>>
>> The UML project also makes uses of pathmaps so you will need something
>> like:
>> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
>> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>>
>> I would recommend downloading the UML2 examples and plugins and see how
>> it makes use of extensions.
>> There is also some example code here (scroll toward the bottom):
>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>
>> The EMF newsgroup also has many Q/A regarding ResourceSets.
>>
>> Cheers,
>> - James.
>>
>> "Tom" <tom@collibra.com> wrote in message
>> news:h3no08$7pr$1@build.eclipse.org...
>>> Hi,
>>>
>>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>>> I've read the "EMF Framework Programmer's Guide" and "Getting Started
>>> with UML2" in the UML2 wiki. I also googled a lot, but I could not find
>>> the right information on how my problem is solved or even an indication
>>> if it can be solved.
>>>
>>> I have a XMI file that has nothing to do with EMF/Ecore. The file
>>> contains a metamodel, unlike most guides (which seem only to work with
>>> concrete datamodels in their xmi files). This metamodel can for instance
>>> be a class diagram exported from IBM's Rational Rose or Visual Paradigm.
>>> I want to write an application that reads the classifiers and their
>>> associations from this XMI file. I believe it has to be possible to
>>> transform the metamodel to some Ecore object-set that can be browsed in
>>> Java. Am I correct?
>>>
>>> If so, how should I configure a ResourceSet to load the XMI file in this
>>> way? I tried using the UMLPackage.eINSTANCE in my code but with no
>>> succes, because I don't seem to understand the core concepts of
>>> ResourceSets and how I might configure them to load any XMI file. There
>>> seem to be an overwhelming amount of settings for Resouces that are to
>>> my knowledge not covered in some tutorial.
>>>
>>> Ideas? Sample source code would be highly appreciated :-)
>>>
>>> Regards,
>>> Tom
>>
|
|
|
Re: Reading general XMI file [message #478631 is a reply to message #478626] |
Thu, 23 July 2009 18:25 |
Tom A Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Thanks James. The file
org.eclipse.uml2.examples.uml.ui.source_3.0.0.v200905041045. jar contains
Java files, but org.eclipse.uml2.examples.source_3.0.0.v200905041045.jar
doesn't. Maybe the first one will contain enough information on how to
set up the ResourceSet.
James Bruck schreef:
> The source code is now jar'd up.
> Download the UML2 SDK and then look for those .jars with a .source prefix
> (ie. org.eclipse.uml2.examples.uml.ui.source_3.0.0xxx)
> Cheers,
> - James.
>
> "tom" <tom@collibra.com> wrote in message
> news:h46p8h$ect$1@build.eclipse.org...
>> Hi,
>>
>> I'm having trouble finding the source code of the examples (for UML2
>> 3.0.0). I googled for org.eclipse.uml2.examples.source, but I don't seem
>> to find the source code of the examples. Where have you placed the source
>> code ? :)
>>
>> Thank you.
>>
>> Regards,
>> Tom
>>
>> James Bruck wrote:
>>> Hi Tom,
>>>
>>> I think this may be more of an EMF question regarding how to work with
>>> ResourceSets you may want to try to post there for a more complete
>>> response.
>>>
>>> One issue you will face will be to properly register packages with your
>>> resource set.
>>> Something like:
>>> Map packageRegistry = resourceSet.getPackageRegistry();
>>> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>>>
>>> You will also probably need to register extensions:
>>> Map extensionFactoryMap =
>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
>>> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
>>> UMLResource.Factory.INSTANCE);
>>>
>>> The UML project also makes uses of pathmaps so you will need something
>>> like:
>>> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
>>> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>>>
>>> I would recommend downloading the UML2 examples and plugins and see how
>>> it makes use of extensions.
>>> There is also some example code here (scroll toward the bottom):
>>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>>
>>> The EMF newsgroup also has many Q/A regarding ResourceSets.
>>>
>>> Cheers,
>>> - James.
>>>
>>> "Tom" <tom@collibra.com> wrote in message
>>> news:h3no08$7pr$1@build.eclipse.org...
>>>> Hi,
>>>>
>>>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>>>> I've read the "EMF Framework Programmer's Guide" and "Getting Started
>>>> with UML2" in the UML2 wiki. I also googled a lot, but I could not find
>>>> the right information on how my problem is solved or even an indication
>>>> if it can be solved.
>>>>
>>>> I have a XMI file that has nothing to do with EMF/Ecore. The file
>>>> contains a metamodel, unlike most guides (which seem only to work with
>>>> concrete datamodels in their xmi files). This metamodel can for instance
>>>> be a class diagram exported from IBM's Rational Rose or Visual Paradigm.
>>>> I want to write an application that reads the classifiers and their
>>>> associations from this XMI file. I believe it has to be possible to
>>>> transform the metamodel to some Ecore object-set that can be browsed in
>>>> Java. Am I correct?
>>>>
>>>> If so, how should I configure a ResourceSet to load the XMI file in this
>>>> way? I tried using the UMLPackage.eINSTANCE in my code but with no
>>>> succes, because I don't seem to understand the core concepts of
>>>> ResourceSets and how I might configure them to load any XMI file. There
>>>> seem to be an overwhelming amount of settings for Resouces that are to
>>>> my knowledge not covered in some tutorial.
>>>>
>>>> Ideas? Sample source code would be highly appreciated :-)
>>>>
>>>> Regards,
>>>> Tom
>
|
|
|
Re: Reading general XMI file [message #627796 is a reply to message #478613] |
Tue, 21 July 2009 15:07 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Tom,
I think this may be more of an EMF question regarding how to work with
ResourceSets you may want to try to post there for a more complete response.
One issue you will face will be to properly register packages with your
resource set.
Something like:
Map packageRegistry = resourceSet.getPackageRegistry();
packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
You will also probably need to register extensions:
Map extensionFactoryMap =
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
extensionFactoryMap.put(UMLResource.FILE_EXTENION,
UMLResource.Factory.INSTANCE);
The UML project also makes uses of pathmaps so you will need something like:
URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
I would recommend downloading the UML2 examples and plugins and see how it
makes use of extensions.
There is also some example code here (scroll toward the bottom):
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
The EMF newsgroup also has many Q/A regarding ResourceSets.
Cheers,
- James.
"Tom" <tom@collibra.com> wrote in message
news:h3no08$7pr$1@build.eclipse.org...
> Hi,
>
> I'm new the subject of parsing an XMI file with the eclipse libraries.
> I've read the "EMF Framework Programmer's Guide" and "Getting Started with
> UML2" in the UML2 wiki. I also googled a lot, but I could not find the
> right information on how my problem is solved or even an indication if it
> can be solved.
>
> I have a XMI file that has nothing to do with EMF/Ecore. The file contains
> a metamodel, unlike most guides (which seem only to work with concrete
> datamodels in their xmi files). This metamodel can for instance be a class
> diagram exported from IBM's Rational Rose or Visual Paradigm. I want to
> write an application that reads the classifiers and their associations
> from this XMI file. I believe it has to be possible to transform the
> metamodel to some Ecore object-set that can be browsed in Java. Am I
> correct?
>
> If so, how should I configure a ResourceSet to load the XMI file in this
> way? I tried using the UMLPackage.eINSTANCE in my code but with no succes,
> because I don't seem to understand the core concepts of ResourceSets and
> how I might configure them to load any XMI file. There seem to be an
> overwhelming amount of settings for Resouces that are to my knowledge not
> covered in some tutorial.
>
> Ideas? Sample source code would be highly appreciated :-)
>
> Regards,
> Tom
|
|
|
Re: Reading general XMI file [message #627802 is a reply to message #478617] |
Tue, 21 July 2009 17:20 |
Tom A Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Thanks James. I will try your code suggestions and maybe also look at
the other newsgroup you suggested.
James Bruck schreef:
> Hi Tom,
>
> I think this may be more of an EMF question regarding how to work with
> ResourceSets you may want to try to post there for a more complete response.
>
> One issue you will face will be to properly register packages with your
> resource set.
> Something like:
> Map packageRegistry = resourceSet.getPackageRegistry();
> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>
> You will also probably need to register extensions:
> Map extensionFactoryMap =
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
> UMLResource.Factory.INSTANCE);
>
> The UML project also makes uses of pathmaps so you will need something like:
> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>
> I would recommend downloading the UML2 examples and plugins and see how it
> makes use of extensions.
> There is also some example code here (scroll toward the bottom):
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>
> The EMF newsgroup also has many Q/A regarding ResourceSets.
>
> Cheers,
> - James.
>
> "Tom" <tom@collibra.com> wrote in message
> news:h3no08$7pr$1@build.eclipse.org...
>> Hi,
>>
>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>> I've read the "EMF Framework Programmer's Guide" and "Getting Started with
>> UML2" in the UML2 wiki. I also googled a lot, but I could not find the
>> right information on how my problem is solved or even an indication if it
>> can be solved.
>>
>> I have a XMI file that has nothing to do with EMF/Ecore. The file contains
>> a metamodel, unlike most guides (which seem only to work with concrete
>> datamodels in their xmi files). This metamodel can for instance be a class
>> diagram exported from IBM's Rational Rose or Visual Paradigm. I want to
>> write an application that reads the classifiers and their associations
>> from this XMI file. I believe it has to be possible to transform the
>> metamodel to some Ecore object-set that can be browsed in Java. Am I
>> correct?
>>
>> If so, how should I configure a ResourceSet to load the XMI file in this
>> way? I tried using the UMLPackage.eINSTANCE in my code but with no succes,
>> because I don't seem to understand the core concepts of ResourceSets and
>> how I might configure them to load any XMI file. There seem to be an
>> overwhelming amount of settings for Resouces that are to my knowledge not
>> covered in some tutorial.
>>
>> Ideas? Sample source code would be highly appreciated :-)
>>
>> Regards,
>> Tom
>
>
|
|
|
Re: Reading general XMI file [message #627804 is a reply to message #478617] |
Wed, 22 July 2009 10:22 |
Tom A Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Hi,
I'm having trouble finding the source code of the examples (for UML2
3.0.0). I googled for org.eclipse.uml2.examples.source, but I don't seem
to find the source code of the examples. Where have you placed the
source code ? :)
Thank you.
Regards,
Tom
James Bruck wrote:
> Hi Tom,
>
> I think this may be more of an EMF question regarding how to work with
> ResourceSets you may want to try to post there for a more complete response.
>
> One issue you will face will be to properly register packages with your
> resource set.
> Something like:
> Map packageRegistry = resourceSet.getPackageRegistry();
> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>
> You will also probably need to register extensions:
> Map extensionFactoryMap =
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
> UMLResource.Factory.INSTANCE);
>
> The UML project also makes uses of pathmaps so you will need something like:
> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>
> I would recommend downloading the UML2 examples and plugins and see how it
> makes use of extensions.
> There is also some example code here (scroll toward the bottom):
> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>
> The EMF newsgroup also has many Q/A regarding ResourceSets.
>
> Cheers,
> - James.
>
> "Tom" <tom@collibra.com> wrote in message
> news:h3no08$7pr$1@build.eclipse.org...
>> Hi,
>>
>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>> I've read the "EMF Framework Programmer's Guide" and "Getting Started with
>> UML2" in the UML2 wiki. I also googled a lot, but I could not find the
>> right information on how my problem is solved or even an indication if it
>> can be solved.
>>
>> I have a XMI file that has nothing to do with EMF/Ecore. The file contains
>> a metamodel, unlike most guides (which seem only to work with concrete
>> datamodels in their xmi files). This metamodel can for instance be a class
>> diagram exported from IBM's Rational Rose or Visual Paradigm. I want to
>> write an application that reads the classifiers and their associations
>> from this XMI file. I believe it has to be possible to transform the
>> metamodel to some Ecore object-set that can be browsed in Java. Am I
>> correct?
>>
>> If so, how should I configure a ResourceSet to load the XMI file in this
>> way? I tried using the UMLPackage.eINSTANCE in my code but with no succes,
>> because I don't seem to understand the core concepts of ResourceSets and
>> how I might configure them to load any XMI file. There seem to be an
>> overwhelming amount of settings for Resouces that are to my knowledge not
>> covered in some tutorial.
>>
>> Ideas? Sample source code would be highly appreciated :-)
>>
>> Regards,
>> Tom
>
>
|
|
|
Re: Reading general XMI file [message #627805 is a reply to message #478625] |
Wed, 22 July 2009 15:38 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
The source code is now jar'd up.
Download the UML2 SDK and then look for those .jars with a .source prefix
(ie. org.eclipse.uml2.examples.uml.ui.source_3.0.0xxx)
Cheers,
- James.
"tom" <tom@collibra.com> wrote in message
news:h46p8h$ect$1@build.eclipse.org...
> Hi,
>
> I'm having trouble finding the source code of the examples (for UML2
> 3.0.0). I googled for org.eclipse.uml2.examples.source, but I don't seem
> to find the source code of the examples. Where have you placed the source
> code ? :)
>
> Thank you.
>
> Regards,
> Tom
>
> James Bruck wrote:
>> Hi Tom,
>>
>> I think this may be more of an EMF question regarding how to work with
>> ResourceSets you may want to try to post there for a more complete
>> response.
>>
>> One issue you will face will be to properly register packages with your
>> resource set.
>> Something like:
>> Map packageRegistry = resourceSet.getPackageRegistry();
>> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>>
>> You will also probably need to register extensions:
>> Map extensionFactoryMap =
>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
>> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
>> UMLResource.Factory.INSTANCE);
>>
>> The UML project also makes uses of pathmaps so you will need something
>> like:
>> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
>> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>>
>> I would recommend downloading the UML2 examples and plugins and see how
>> it makes use of extensions.
>> There is also some example code here (scroll toward the bottom):
>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>
>> The EMF newsgroup also has many Q/A regarding ResourceSets.
>>
>> Cheers,
>> - James.
>>
>> "Tom" <tom@collibra.com> wrote in message
>> news:h3no08$7pr$1@build.eclipse.org...
>>> Hi,
>>>
>>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>>> I've read the "EMF Framework Programmer's Guide" and "Getting Started
>>> with UML2" in the UML2 wiki. I also googled a lot, but I could not find
>>> the right information on how my problem is solved or even an indication
>>> if it can be solved.
>>>
>>> I have a XMI file that has nothing to do with EMF/Ecore. The file
>>> contains a metamodel, unlike most guides (which seem only to work with
>>> concrete datamodels in their xmi files). This metamodel can for instance
>>> be a class diagram exported from IBM's Rational Rose or Visual Paradigm.
>>> I want to write an application that reads the classifiers and their
>>> associations from this XMI file. I believe it has to be possible to
>>> transform the metamodel to some Ecore object-set that can be browsed in
>>> Java. Am I correct?
>>>
>>> If so, how should I configure a ResourceSet to load the XMI file in this
>>> way? I tried using the UMLPackage.eINSTANCE in my code but with no
>>> succes, because I don't seem to understand the core concepts of
>>> ResourceSets and how I might configure them to load any XMI file. There
>>> seem to be an overwhelming amount of settings for Resouces that are to
>>> my knowledge not covered in some tutorial.
>>>
>>> Ideas? Sample source code would be highly appreciated :-)
>>>
>>> Regards,
>>> Tom
>>
|
|
|
Re: Reading general XMI file [message #627810 is a reply to message #478626] |
Thu, 23 July 2009 18:25 |
Tom A Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Thanks James. The file
org.eclipse.uml2.examples.uml.ui.source_3.0.0.v200905041045. jar contains
Java files, but org.eclipse.uml2.examples.source_3.0.0.v200905041045.jar
doesn't. Maybe the first one will contain enough information on how to
set up the ResourceSet.
James Bruck schreef:
> The source code is now jar'd up.
> Download the UML2 SDK and then look for those .jars with a .source prefix
> (ie. org.eclipse.uml2.examples.uml.ui.source_3.0.0xxx)
> Cheers,
> - James.
>
> "tom" <tom@collibra.com> wrote in message
> news:h46p8h$ect$1@build.eclipse.org...
>> Hi,
>>
>> I'm having trouble finding the source code of the examples (for UML2
>> 3.0.0). I googled for org.eclipse.uml2.examples.source, but I don't seem
>> to find the source code of the examples. Where have you placed the source
>> code ? :)
>>
>> Thank you.
>>
>> Regards,
>> Tom
>>
>> James Bruck wrote:
>>> Hi Tom,
>>>
>>> I think this may be more of an EMF question regarding how to work with
>>> ResourceSets you may want to try to post there for a more complete
>>> response.
>>>
>>> One issue you will face will be to properly register packages with your
>>> resource set.
>>> Something like:
>>> Map packageRegistry = resourceSet.getPackageRegistry();
>>> packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
>>>
>>> You will also probably need to register extensions:
>>> Map extensionFactoryMap =
>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
>>> extensionFactoryMap.put(UMLResource.FILE_EXTENION,
>>> UMLResource.Factory.INSTANCE);
>>>
>>> The UML project also makes uses of pathmaps so you will need something
>>> like:
>>> URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PA THMP),
>>> umlResourcePluginURI.appendSegment("libraries").appendSegment( ""));
>>>
>>> I would recommend downloading the UML2 examples and plugins and see how
>>> it makes use of extensions.
>>> There is also some example code here (scroll toward the bottom):
>>> http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2. 0_Migration_Guide/guide.html
>>>
>>> The EMF newsgroup also has many Q/A regarding ResourceSets.
>>>
>>> Cheers,
>>> - James.
>>>
>>> "Tom" <tom@collibra.com> wrote in message
>>> news:h3no08$7pr$1@build.eclipse.org...
>>>> Hi,
>>>>
>>>> I'm new the subject of parsing an XMI file with the eclipse libraries.
>>>> I've read the "EMF Framework Programmer's Guide" and "Getting Started
>>>> with UML2" in the UML2 wiki. I also googled a lot, but I could not find
>>>> the right information on how my problem is solved or even an indication
>>>> if it can be solved.
>>>>
>>>> I have a XMI file that has nothing to do with EMF/Ecore. The file
>>>> contains a metamodel, unlike most guides (which seem only to work with
>>>> concrete datamodels in their xmi files). This metamodel can for instance
>>>> be a class diagram exported from IBM's Rational Rose or Visual Paradigm.
>>>> I want to write an application that reads the classifiers and their
>>>> associations from this XMI file. I believe it has to be possible to
>>>> transform the metamodel to some Ecore object-set that can be browsed in
>>>> Java. Am I correct?
>>>>
>>>> If so, how should I configure a ResourceSet to load the XMI file in this
>>>> way? I tried using the UMLPackage.eINSTANCE in my code but with no
>>>> succes, because I don't seem to understand the core concepts of
>>>> ResourceSets and how I might configure them to load any XMI file. There
>>>> seem to be an overwhelming amount of settings for Resouces that are to
>>>> my knowledge not covered in some tutorial.
>>>>
>>>> Ideas? Sample source code would be highly appreciated :-)
>>>>
>>>> Regards,
>>>> Tom
>
|
|
|
Goto Forum:
Current Time: Tue Apr 23 17:59:32 GMT 2024
Powered by FUDForum. Page generated in 0.03226 seconds
|