Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Inegrating ECore Models
Inegrating ECore Models [message #518841] Fri, 05 March 2010 04:34 Go to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi,

in my application I have two Ecore Models A and B. I want all EClasses
in B to be subclasses of a selected super class in A. Since B is
replaceable in the application I want to make it as easy as possible to
add the super class for new B models.
I played with the "Root Extends Class" and "Root Extends Interface"
properties in the gen model but they only "connect" the class hierarchy
on the Java level not on the Ecore level. For example all features of
the superclass are not serialized to a resource if I use this approach.
Is there any way to make this work on the Ecore level also? Mabye a way
to make an EClass superclass of another EClass at runtime? B is
generated. While A is generated also it could also be a dynamic ECore if
this helps to solve the problem.

I appreciate any hint!

Thank you,
Maximilian
Re: Inegrating ECore Models [message #518851 is a reply to message #518841] Fri, 05 March 2010 05:00 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Maximilian,

Comments below.

Maximilian Koegel wrote:
> Hi,
>
> in my application I have two Ecore Models A and B. I want all EClasses
> in B to be subclasses of a selected super class in A. Since B is
> replaceable in the application I want to make it as easy as possible
> to add the super class for new B models.
> I played with the "Root Extends Class" and "Root Extends Interface"
> properties in the gen model but they only "connect" the class
> hierarchy on the Java level not on the Ecore level.
Yep.
> For example all features of the superclass are not serialized to a
> resource if I use this approach.
No, it's not the right approach for letting the model itself know about
the inheritance.
> Is there any way to make this work on the Ecore level also? Mabye a
> way to make an EClass superclass of another EClass at runtime?
No, it needs to be knows at generation type for generated models.
> B is generated. While A is generated also it could also be a dynamic
> ECore if this helps to solve the problem.
No, that won't. And it doesn't make sense for a generated model to
extend a dynamic one.
>
> I appreciate any hint!
You could define an object action contribution that applies to an
EPackage and would add to the eSuperTypes of all the contained EClasses.

Easiest is to define something like a BModelElement, ensure that all
other classes in B extend it, and then you'll have only one place to add
A's super class.
>
> Thank you,
> Maximilian


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Inegrating ECore Models [message #518870 is a reply to message #518851] Fri, 05 March 2010 10:42 Go to previous message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Ed,
thank you for the very fast and very helpful reply. The EMF newsgroup
really rocks, no other newsgroup where I get good replies so fast!
Cheers,
Maximilian

On 3/5/10 10:53 AM, Ed Merks wrote:
> Maximilian,
>
> Comments below.
>
> Maximilian Koegel wrote:
>> Hi,
>>
>> in my application I have two Ecore Models A and B. I want all EClasses
>> in B to be subclasses of a selected super class in A. Since B is
>> replaceable in the application I want to make it as easy as possible
>> to add the super class for new B models.
>> I played with the "Root Extends Class" and "Root Extends Interface"
>> properties in the gen model but they only "connect" the class
>> hierarchy on the Java level not on the Ecore level.
> Yep.
>> For example all features of the superclass are not serialized to a
>> resource if I use this approach.
> No, it's not the right approach for letting the model itself know about
> the inheritance.
>> Is there any way to make this work on the Ecore level also? Mabye a
>> way to make an EClass superclass of another EClass at runtime?
> No, it needs to be knows at generation type for generated models.
>> B is generated. While A is generated also it could also be a dynamic
>> ECore if this helps to solve the problem.
> No, that won't. And it doesn't make sense for a generated model to
> extend a dynamic one.
>>
>> I appreciate any hint!
> You could define an object action contribution that applies to an
> EPackage and would add to the eSuperTypes of all the contained EClasses.
>
> Easiest is to define something like a BModelElement, ensure that all
> other classes in B extend it, and then you'll have only one place to add
> A's super class.
>>
>> Thank you,
>> Maximilian
Previous Topic:EMF editor for customized XML output
Next Topic:add an EObject to the contents of another EObject?
Goto Forum:
  


Current Time: Sat Apr 20 02:35:16 GMT 2024

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

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

Back to the top