Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Two instances of EPackage with same URI loaded by GenModel
Two instances of EPackage with same URI loaded by GenModel [message #415057] Wed, 28 November 2007 17:56 Go to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
I've recently refactored my ecore file defining my EClasses so that it
references the EClasses it depends on using their EPackage nsURIs ( before
I just usd to emit another resource and referenced it using a relative
path "..\MetaModel.ecore" ):

For example:

<eClassifiers xsi:type="ecore:EClass" name="PresentationElement">
<eSuperTypes href="uk.co.his.metamodel.core#//Object"/>
</eClassifiers>

references the EClass named "Object" in the EPackage with the URI
uk.co.his.metamodel.core#/

There's an EMF plugin project with genmodel for the EPackage with nsURI
"uk.co.his.metamodel.core".

However when I reload with the new "factored" model - using the standard
content menu option supplied by EMF on a genmodel - I get the following
error:

The package 'uk.co.his.metamodel.core#/' has the same namespace URI
'uk.co.his.metamodel.core' as package
'platform:/plugin/Tool2.metamodel.core/genmodel/MetaModel.ec ore#//core'

In the debugger I can see this is caused by one EPackage being the
generated Java class for this specific uri, and the other being the
"generic" EPackage loaded by the GenModel itself.

This may be because the genmodel at
platform:/plugin/Tool2.metamodel.core/genmodel does not have the
GenPackage for 'uk.co.his.metamodel.core' at its root but another empty
package with the URI 'uk.co.his.metamodel', as this root package contains
other packages.

<ecore:EPackage name="uk.co.his.metamodel" nsURI="uk.co.his.metamodel"
nsPrefix="">
<eSubpackages name="core" nsURI="uk.co.his.metamodel.core" nsPrefix="">
<eClassifiers xsi:type="ecore:EClass" name="Object"
eSuperTypes="#/1/core/ModelElement">
...

Is this what the problem is, and do I have no choice but to refactor the
model from which the platform:/plugin/Tool2.metamodel.core/genmodel is
built to have no dummy epackages at its root?


Or is there something else going wrong?
Re: Two instances of EPackage with same URI loaded by GenModel [message #415060 is a reply to message #415057] Wed, 28 November 2007 18:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
JF,

Comments below.


JF wrote:
> I've recently refactored my ecore file defining my EClasses so that it
> references the EClasses it depends on using their EPackage nsURIs (
> before I just usd to emit another resource and referenced it using a
> relative path "..\MetaModel.ecore" ):
Hmmm. That sounds not so good. The development time resources should
be referring to other development time resources so that the GenModel's
that wrap those things are properly located and used...
>
> For example:
>
> <eClassifiers xsi:type="ecore:EClass" name="PresentationElement">
> <eSuperTypes href="uk.co.his.metamodel.core#//Object"/>
> </eClassifiers>
>
> references the EClass named "Object" in the EPackage with the URI
> uk.co.his.metamodel.core#/
So this model is installed in the development environment itself I take it?
>
> There's an EMF plugin project with genmodel for the EPackage with
> nsURI "uk.co.his.metamodel.core".
Yes, and that has the development time version of the resource which is
likely the one you should be using...
>
> However when I reload with the new "factored" model - using the
> standard content menu option supplied by EMF on a genmodel - I get the
> following error:
>
> The package 'uk.co.his.metamodel.core#/' has the same namespace URI
> 'uk.co.his.metamodel.core' as package
> 'platform:/plugin/Tool2.metamodel.core/genmodel/MetaModel.ec ore#//core'
The first sign of troubles. Now there is confusion over the generated
static instance in the environment and the one the GenModel's GenPackage
actually loads.
>
> In the debugger I can see this is caused by one EPackage being the
> generated Java class for this specific uri, and the other being the
> "generic" EPackage loaded by the GenModel itself.
Yep!
>
> This may be because the genmodel at
> platform:/plugin/Tool2.metamodel.core/genmodel does not have the
> GenPackage for 'uk.co.his.metamodel.core' at its root but another
> empty package with the URI 'uk.co.his.metamodel', as this root package
> contains other packages.
>
> <ecore:EPackage name="uk.co.his.metamodel" nsURI="uk.co.his.metamodel"
> nsPrefix="">
> <eSubpackages name="core" nsURI="uk.co.his.metamodel.core"
> nsPrefix="">
> <eClassifiers xsi:type="ecore:EClass" name="Object"
> eSuperTypes="#/1/core/ModelElement">
> ...
>
> Is this what the problem is, and do I have no choice but to refactor
> the model from which the
> platform:/plugin/Tool2.metamodel.core/genmodel is built to have no
> dummy epackages at its root?
I'm not sure how dummy packages relate, but you don't really need them
generally since you can use the base package property for that.
>
>
> Or is there something else going wrong?
You really should be referring to the resource accessible via
platform:/plugin...
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Two instances of EPackage with same URI loaded by GenModel [message #415061 is a reply to message #415060] Wed, 28 November 2007 18:15 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Thanks Ed,

So if I get this correct the fragment that looks like this...

<eClassifiers xsi:type="ecore:EClass" name="PresentationElement">
<eSuperTypes href="uk.co.his.metamodel.core#//Object"/>
</eClassifiers>

which is part of a development time extract from a tool, should really be
referencing the development time entities of the "base" model;

<eClassifiers xsi:type="ecore:EClass" name="PresentationElement">
<eSuperTypes
href=" platform:/plugin/Tool2.metamodel.core/genmodel/MetaModel.eco re#//core/Object "/>
</eClassifiers>

So although "bad practice" ( left over form early days ) the empty root
Epackage is not to blame...
Re: Two instances of EPackage with same URI loaded by GenModel [message #415069 is a reply to message #415061] Wed, 28 November 2007 19:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
JF,

Yes, an empty root package should not be a cause of problems as far as I
know.


JF wrote:
> Thanks Ed,
>
> So if I get this correct the fragment that looks like this...
>
> <eClassifiers xsi:type="ecore:EClass" name="PresentationElement">
> <eSuperTypes href="uk.co.his.metamodel.core#//Object"/>
> </eClassifiers>
>
> which is part of a development time extract from a tool, should really
> be referencing the development time entities of the "base" model;
>
> <eClassifiers xsi:type="ecore:EClass" name="PresentationElement">
> <eSuperTypes
> href=" platform:/plugin/Tool2.metamodel.core/genmodel/MetaModel.eco re#//core/Object "/>
>
> </eClassifiers>
>
> So although "bad practice" ( left over form early days ) the empty
> root Epackage is not to blame...
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Add element to EList
Next Topic:Declare an array type
Goto Forum:
  


Current Time: Fri Apr 19 23:19:19 GMT 2024

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

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

Back to the top