An Ecore file whose instances are other Ecore files [message #1696823] |
Thu, 28 May 2015 18:28 |
|
I would like to define an Ecore, say "MMEcore.ecore", whose instances are other Ecore files, say "MEcore1.ecore", "MMEcore2.ecore". "MMEcore3.ecore", etc. In other words, when I create an instance of "MMEcore.ecore", it generates another ecore file, say "MEcore1.ecore", which in turn I can instantiate and get a regular ecore model, say "MEcore1Model.xmi".
Is this possible to do in EMF? any thoughts?
Thanks
[Updated on: Thu, 28 May 2015 18:32] Report message to a moderator
|
|
|
Re: An Ecore file whose instances are other Ecore files [message #1696825 is a reply to message #1696823] |
Thu, 28 May 2015 19:26 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
Yes, and this is what you do with Ecore anyway.
However if you want to instantiate Ecore and get Ecore you need MMEcore*
to be Ecore anyway.
Regards
Ed Willink
On 28/05/2015 19:28, Hamid Qartal wrote:
> I would like to define an Ecore, say "MMEcore", whose instances are
> other Ecore files, say "MEcore1", "MMEcore2". "MMEcore3", etc. In
> other words, when I create an instance of MMEcore, it generates
> another ecore file which in turn I can instantiate and get a regular
> ecore model.
>
> Is this possible to do in EMF? any thoughts?
>
|
|
|
Re: An Ecore file whose instances are other Ecore files [message #1696826 is a reply to message #1696825] |
Thu, 28 May 2015 20:28 |
|
Thanks for the reply Ed
Then what would be the content of my MMEcore.ecore file if suppose that I want to force all of my "MMEcore1.ecore ... MMEcore3.ecore " files have a classifier named "Node" in them. How can I achieve this?
Actually I tried to define an EClass in my MMEcore.ecore file that extends EClass in ecore.ecore to achive this. But then when I instantiate MMEcore.ecore it no longer conforms to ecore.ecore, because there is no EClass named "Node" in ecore.ecore!
Which part I am missing or confusing? any thoughts?
[Updated on: Thu, 28 May 2015 20:29] Report message to a moderator
|
|
|
Re: An Ecore file whose instances are other Ecore files [message #1696849 is a reply to message #1696826] |
Fri, 29 May 2015 04:39 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Hamid,
You can always create a reference to an EPackage or to anything else in
Ecore, e.g., in Xcore syntax:
package org.example.mmecore
import org.eclipse.emf.ecore.EPackage
class Root
{
refers EPackage ePackages
}
Then when you create a Root instance, you can generate a bunch of
EPackages (in their own resources) to which it then refers.
On 28/05/2015 10:28 PM, Hamid Qartal wrote:
> Thanks for the reply Ed
>
> Then what would be the content of my MMEcore.ecore file if suppose
> that I want to force all of my "MMEcore1.ecore ... MMEcore3.ecore "
> file have a classifier named Node in them. How can I achieve this?
>
> Actually I tried to define an EClass in my MMEcore.ecore file that
> extends EClass in ecore.ecore to achive this. But then when I
> instantiate MMEcore.ecore it no longer conforms to ecore.ecore,
> because there is no EClass named "Node" in ecore.ecore!
> Which part I am missing or confusing? any thoughts?
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02745 seconds