Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Loading an EMFCompare differences model(Loading an EMFCompare differences model)
Loading an EMFCompare differences model [message #526672] Mon, 12 April 2010 14:53 Go to next message
Sebastián is currently offline SebastiánFriend
Messages: 6
Registered: April 2010
Junior Member
Hi. After comparing 2 versions of a model, I get the differences model and save it as an XMI file. Now I want to load this model to navigate it using EMF API, but I'm getting this error:

Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/emf/compare/diff/1.1' not found. (file:/C:/eclipseGalileo/workspace/org.eclipse.emf.examples. library/model/result2.xmi, 2, 296)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:315)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:274)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)

So basically it says that diff metamodel can't be found. Do I need to have a diff metamodel instance in the workspace for being able to do what I want to do? If this is the case, where can I get this resources?

Thanks in advance.
Sebastián.
Re: Loading an EMFCompare differences model [message #526702 is a reply to message #526672] Mon, 12 April 2010 16:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hi Sebasián,
I assume that you are running your code outside of Eclipse? In such a
case you have to register the used packages manually because the Eclipse
registry isn't present. Try this:

EPackage.Registry.INSTANCE.put(DiffPackage.eNS_URI, DiffPackage.eINSTANCE);

best regards,
Gilbert

Am 12.04.2010 16:53, schrieb jsebas85@gmail.com:
> Hi. After comparing 2 versions of a model, I get the differences model
> and save it as an XMI file. Now I want to load this model to navigate it
> using EMF API, but I'm getting this error:
>
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos
> ticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException:
> Package with uri 'http://www.eclipse.org/emf/compare/diff/1.1' not
> found. (file:/C:/eclipseGalileo/workspace/org.eclipse.emf.examples.
> library/model/result2.xmi, 2, 296)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe
> mandLoadException(ResourceSetImpl.java:315)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo
> adHelper(ResourceSetImpl.java:274)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou
> rce(ResourceSetImpl.java:397)
>
> So basically it says that diff metamodel can't be found. Do I need to
> have a diff metamodel instance in the workspace for being able to do
> what I want to do? If this is the case, where can I get this resources?
>
> Thanks in advance.
> Sebastián.
>
Re: Loading an EMFCompare differences model [message #526707 is a reply to message #526702] Mon, 12 April 2010 16:51 Go to previous messageGo to next message
Sebastián is currently offline SebastiánFriend
Messages: 6
Registered: April 2010
Junior Member
Hi Gilbert, thanks for your response.

Actually, I'm running the code inside Eclipse, so it is not the case.
Probably I would also have to register diff metamodel, but as I don't have a metamodel instance (an .ecore file in my workspace) I don't know how to do it.
Re: Loading an EMFCompare differences model [message #526726 is a reply to message #526707] Mon, 12 April 2010 18:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hi Sebastián,

> Actually, I'm running the code inside Eclipse, so it is not the case.
> Probably I would also have to register diff metamodel, but as I don't
> have a metamodel instance (an .ecore file in my workspace) I don't know
> how to do it.

Then the code line from my previous answer should do the trick anyway.
If the code doesn't compile then you need to add a dependency to the
org.eclipse.emf.compare.diff plugin.

best regards,
Gilbert
Re: Loading an EMFCompare differences model [message #526897 is a reply to message #526726] Tue, 13 April 2010 12:32 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010907050506090407030906
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Sebastián, Gilbert,

The line of code Gilbert pointed out is exactly what you need if you are
not using the default eclipse actions to load this model (ie, you create
the resource on the emfdiff path and then use EMF APIs to load it
instead of double clicking the emfdiff file in the workspace).

You'll need to add Gilbert's code _before_ creating and loading the EMF
resource.

However if you are using standard Eclipse actions to load the model
(double click in the workspace comes in mind), then what you encounter
is a bug.

Could you tell us which of these cases you're in?

Laurent Goubet
Obeo

Gilbert Mirenque wrote:
> Hi Sebastián,
>
>> Actually, I'm running the code inside Eclipse, so it is not the case.
>> Probably I would also have to register diff metamodel, but as I don't
>> have a metamodel instance (an .ecore file in my workspace) I don't know
>> how to do it.
>
> Then the code line from my previous answer should do the trick anyway.
> If the code doesn't compile then you need to add a dependency to the
> org.eclipse.emf.compare.diff plugin.
>
> best regards,
> Gilbert


--------------010907050506090407030906
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010907050506090407030906--
Re: Loading an EMFCompare differences model [message #526953 is a reply to message #526897] Tue, 13 April 2010 15:02 Go to previous messageGo to next message
Sebastián is currently offline SebastiánFriend
Messages: 6
Registered: April 2010
Junior Member
Thanks to both of you for your help. For obtaining the differences model, I was using standard Eclipse actions, so I thought metamodels were already registered.

So what I had to do was to include 3 dependencies in the plugin.xml

org.eclipse.emf.compare
org.eclipse.emf.compare.diff
org.eclipse.emf.compare.match

And add 2 lines of code before loading the resources:

EPackage.Registry.INSTANCE.put(DiffPackage.eNS_URI, DiffPackage.eINSTANCE);
EPackage.Registry.INSTANCE.put(MatchPackage.eNS_URI, MatchPackage.eINSTANCE);

Thanks again Smile
Re: Loading an EMFCompare differences model [message #622459 is a reply to message #526702] Mon, 12 April 2010 16:51 Go to previous messageGo to next message
Sebastián is currently offline SebastiánFriend
Messages: 6
Registered: April 2010
Junior Member
Hi Gilbert, thanks for your response.

Actually, I'm running the code inside Eclipse, so it is not the case.
Probably I would also have to register diff metamodel, but as I don't have a metamodel instance (an .ecore file in my workspace) I don't know how to do it.
Re: Loading an EMFCompare differences model [message #622461 is a reply to message #622459] Mon, 12 April 2010 18:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hi Sebastián,

> Actually, I'm running the code inside Eclipse, so it is not the case.
> Probably I would also have to register diff metamodel, but as I don't
> have a metamodel instance (an .ecore file in my workspace) I don't know
> how to do it.

Then the code line from my previous answer should do the trick anyway.
If the code doesn't compile then you need to add a dependency to the
org.eclipse.emf.compare.diff plugin.

best regards,
Gilbert
Re: Loading an EMFCompare differences model [message #622464 is a reply to message #526726] Tue, 13 April 2010 12:32 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010907050506090407030906
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Sebastián, Gilbert,

The line of code Gilbert pointed out is exactly what you need if you are
not using the default eclipse actions to load this model (ie, you create
the resource on the emfdiff path and then use EMF APIs to load it
instead of double clicking the emfdiff file in the workspace).

You'll need to add Gilbert's code _before_ creating and loading the EMF
resource.

However if you are using standard Eclipse actions to load the model
(double click in the workspace comes in mind), then what you encounter
is a bug.

Could you tell us which of these cases you're in?

Laurent Goubet
Obeo

Gilbert Mirenque wrote:
> Hi Sebastián,
>
>> Actually, I'm running the code inside Eclipse, so it is not the case.
>> Probably I would also have to register diff metamodel, but as I don't
>> have a metamodel instance (an .ecore file in my workspace) I don't know
>> how to do it.
>
> Then the code line from my previous answer should do the trick anyway.
> If the code doesn't compile then you need to add a dependency to the
> org.eclipse.emf.compare.diff plugin.
>
> best regards,
> Gilbert


--------------010907050506090407030906
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010907050506090407030906--
Re: Loading an EMFCompare differences model [message #622465 is a reply to message #526897] Tue, 13 April 2010 15:02 Go to previous message
Sebastián is currently offline SebastiánFriend
Messages: 6
Registered: April 2010
Junior Member
Thanks to both of you for your help. For obtaining the differences model, I was using standard Eclipse actions, so I thought metamodels were already registered.

So what I had to do was to include 3 dependencies in the plugin.xml

org.eclipse.emf.compare
org.eclipse.emf.compare.diff
org.eclipse.emf.compare.match

And add 2 lines of code before loading the resources:

EPackage.Registry.INSTANCE.put(DiffPackage.eNS_URI, DiffPackage.eINSTANCE);
EPackage.Registry.INSTANCE.put(MatchPackage.eNS_URI, MatchPackage.eINSTANCE);

Thanks again :)
Previous Topic:[MWE] WorkflowComponent API should support some Resource Cleanup mechanism
Next Topic:Generating from UML2 Model an Ecore Modell
Goto Forum:
  


Current Time: Fri Apr 26 16:41:01 GMT 2024

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

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

Back to the top