Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF and dynamic meta-models
EMF and dynamic meta-models [message #1229982] Fri, 10 January 2014 18:20 Go to next message
Patrick Tournet is currently offline Patrick TournetFriend
Messages: 17
Registered: July 2009
Location: Aix-en-Provence, FRANCE
Junior Member
Hello everyone,

I'm currently project manager of a C++ developed modeling tool based on an extensible meta-model : at runtime, users can modify (CRUDing classes, relationships, properties, ...) the meta-model and use instantly those modifications in their models.

There's a plan to port it to the Eclipse platform, so I'm gathering as much information as possible to decide the forthcoming software architecture... and that's how I came to take a look at EMF, as it's better to use existing projects (especially when then come with a lot of tools) instead of having to reinvent the wheel (or at least re-develop something from scratch).

From what I've understood, the usual way of use of EMF, is to design a meta-model with ecore (I've seen there are already UML and BPMN ones that have been implemented here), then to generate the Java classes from a genmodel, extend/implement them, then use all that for your model.

My concern is that, if I'm correct, any modification of a meta-model implies a new build and therefore cannot be made by a final user... My idea is, so far, to create a meta-meta-model with EMF (making ecore a meta-meta-meta-model instead of a classic meta-meta-model in MDE 4 layered architecture) that will implement all the shared capabilities(multilingual strings, versioning, ...) the derived meta-models will inherit.

This way it seems to me that I should achieve the ability to design meta-models at runtime while being able to use related projects if needed (CDO, MDT, GMF, ...). But, as I'm new to all of these technologies, it might not be the best way to do it, or there might already be existing ways to do so. So any input would be much appreciated !


I can do anything and I can do it better than anyone. Be as I am : be the best ! Wink
Re: EMF and dynamic meta-models [message #1230172 is a reply to message #1229982] Sat, 11 January 2014 06:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Patrick,

Comments below.

On 10/01/2014 7:21 PM, Patrick TOURNET wrote:
> Hello everyone,
>
> I'm currently project manager of a C++ developed modeling tool based
> on an extensible meta-model : at runtime, users can modify (CRUDing
> classes, relationships, properties, ...) the meta-model and use
> instantly those modifications in their models.
>
> There's a plan to port it to the Eclipse platform, so I'm gathering as
> much information as possible to decide the forthcoming software
> architecture... and that's how I came to take a look at EMF, as it's
> better to use existing projects (especially when then come with a lot
> of tools) instead of having to reinvent the wheel (or at least
> re-develop something from scratch).
Certainly less work!
>
> From what I've understood, the usual way of use of EMF, is to design a
> meta-model with ecore (I've seen there are already UML and BPMN ones
> that have been implemented here), then to generate the Java classes
> from a genmodel, extend/implement them, then use all that for your model.
Yes, that's the typical common use case.
>
> My concern is that, if I'm correct, any modification of a meta-model
> implies a new build and therefore cannot be made by a final user...
Yes, a generate model cannot be changed at runtime, but it can be
dynamically extended (i.e., via a new EPackage with new EClasses) with a
few limitations. E.g., you can't extend a generated abstract class with
a concrete class, and you can't extend multiple generated classes. In
other words, you can only dynamically extend at most one concrete
class. And of course you can have
> My idea is, so far, to create a meta-meta-model with EMF (making ecore
> a meta-meta-meta-model instead of a classic meta-meta-model in MDE 4
> layered architecture) that will implement all the shared
> capabilities(multilingual strings, versioning, ...) the derived
> meta-models will inherit.
Given that Ecore directly supports dynamic models, i.e., you can create
Ecore models on the fly and instantiate instances that conform that that
model, this too might be reinventing the wheel.
http://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/
>
> This way it seems to me that I should achieve the ability to design
> meta-models at runtime while being able to use related projects if
> needed (CDO, MDT, GMF, ...).
Most of the infrastructure in the Eclipse modeling ecosystem rely on
working with EObjects (instance) whose meta model is Ecore.
> But, as I'm new to all of these technologies, it might not be the best
> way to do it, or there might already be existing ways to do so. So any
> input would be much appreciated !


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF and dynamic meta-models [message #1230225 is a reply to message #1230172] Sat, 11 January 2014 10:59 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Comments in line.

On 11/01/2014 06:46, Ed Merks wrote:
>> From what I've understood, the usual way of use of EMF, is to design
>> a meta-model with ecore (I've seen there are already UML and BPMN
>> ones that have been implemented here), then to generate the Java
>> classes from a genmodel, extend/implement them, then use all that for
>> your model.
> Yes, that's the typical common use case.
>>
>> My concern is that, if I'm correct, any modification of a meta-model
>> implies a new build and therefore cannot be made by a final user...
> Yes, a generate model cannot be changed at runtime,
There are an increasing number of modeling applications working solely
with dynamic models/meta-models, and some tools now allow you to change
the meta-model dynamically too.

Regards

Ed Willink
Re: EMF and dynamic meta-models [message #1231448 is a reply to message #1230172] Tue, 14 January 2014 17:57 Go to previous messageGo to next message
Patrick Tournet is currently offline Patrick TournetFriend
Messages: 17
Registered: July 2009
Location: Aix-en-Provence, FRANCE
Junior Member
Thank you, Ed,

Ed Merks wrote on Sat, 11 January 2014 07:46
Patrick TOURNET wrote on Fri, 11 January 2014 19:21

My concern is that, if I'm correct, any modification of a meta-model implies a new build and therefore cannot be made by a final user...

Yes, a generate model cannot be changed at runtime, but it can be
dynamically extended (i.e., via a new EPackage with new EClasses) with a
few limitations. E.g., you can't extend a generated abstract class with
a concrete class, and you can't extend multiple generated classes. In
other words, you can only dynamically extend at most one concrete
class. And of course you can have

Unfortunately, you didn't finish your last sentence. I really wonder what it is...
So, if I get it right, the limitation is that you can only extend one class. Is it per package ? (if you're using the UML meta-model, would it be ok to extend "Class" and "Actor" as they're not in the same package (well at least in the XMI definition file) ?
Is there a document that lists those model extension limitations ?

I've seen there"s also another modeling project, called "EMF Facet", that could allow to achieve a meta-model extension. Do you have any take on that ?

Ed Merks wrote on Sat, 11 January 2014 07:46
Patrick TOURNET wrote on Fri, 11 January 2014 19:21

My idea is, so far, to create a meta-meta-model with EMF (making ecore a meta-meta-meta-model instead of a classic meta-meta-model in MDE 4 layered architecture) that will implement all the shared capabilities(multilingual strings, versioning, ...) the derived meta-models will inherit.

Given that Ecore directly supports dynamic models, i.e., you can create
Ecore models on the fly and instantiate instances that conform that that
model, this too might be reinventing the wheel.
http://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/

I'll be looking into that more deeply...

Ed Merks wrote on Sat, 11 January 2014 07:46
Patrick TOURNET wrote on Fri, 11 January 2014 19:21

This way it seems to me that I should achieve the ability to design meta-models at runtime while being able to use related projects if needed (CDO, MDT, GMF, ...).

Most of the infrastructure in the Eclipse modeling ecosystem rely on
working with EObjects (instance) whose meta model is Ecore.

My take was that as long as you're working with extensions of EObjects (even through indirect extension (extension of an extension)), everything should still work... no ?

Ed Willink wrote on Sat, 11 January 2014 11:59

There are an increasing number of modeling applications working solely
with dynamic models/meta-models, and some tools now allow you to change
the meta-model dynamically too.

We've been doing this for more than 28 years now, so I know that exists... Wink
Do you have any reference for such an Eclipse based tool ?


I can do anything and I can do it better than anyone. Be as I am : be the best ! Wink
Re: EMF and dynamic meta-models [message #1231649 is a reply to message #1231448] Wed, 15 January 2014 06:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Patrick,

Comments below.

On 14/01/2014 6:57 PM, Patrick TOURNET wrote:
> Thank you, Ed,
>
> Ed Merks wrote on Sat, 11 January 2014 07:46
>> Patrick TOURNET wrote on Fri, 11 January 2014 19:21
>> > My concern is that, if I'm correct, any modification of a
>> meta-model implies a new build and therefore cannot be made by a
>> final user...
>>
>> Yes, a generate model cannot be changed at runtime, but it can be
>> dynamically extended (i.e., via a new EPackage with new EClasses)
>> with a few limitations. E.g., you can't extend a generated abstract
>> class with a concrete class, and you can't extend multiple generated
>> classes. In other words, you can only dynamically extend at most one
>> concrete class. And of course you can have
>
> Unfortunately, you didn't finish your last sentence. I really wonder
> what it is...
Cut and paste error...
> So, if I get it right, the limitation is that you can only extend one
> class. Is it per package ?
You can only dynamically extend one generated class (and that class
can't be abstract) because a dynamic extension relies on reusing the
generated implementation class of that one base class.
> (if you're using the UML meta-model, would it be ok to extend "Class"
> and "Actor" as they're not in the same package (well at least in the
> XMI definition file) ?
> Is there a document that lists those model extension limitations ?
No, but the limitation is summarized by the one sentence above. No
other caveats.
>
> I've seen there"s also another modeling project, called "EMF Facet",
> that could allow to achieve a meta-model extension. Do you have any
> take on that ?
It's a little like UML profiles for Ecore. I'm not familiar with all
the details.
>
>
> Ed Merks wrote on Sat, 11 January 2014 07:46
>> Patrick TOURNET wrote on Fri, 11 January 2014 19:21
>> > My idea is, so far, to create a meta-meta-model with EMF (making
>> ecore a meta-meta-meta-model instead of a classic meta-meta-model in
>> MDE 4 layered architecture) that will implement all the shared
>> capabilities(multilingual strings, versioning, ...) the derived
>> meta-models will inherit.
>>
>> Given that Ecore directly supports dynamic models, i.e., you can
>> create Ecore models on the fly and instantiate instances that conform
>> that that model, this too might be reinventing the wheel.
>> http://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/
>
> I'll be looking into that more deeply...
>
> Ed Merks wrote on Sat, 11 January 2014 07:46
>> Patrick TOURNET wrote on Fri, 11 January 2014 19:21
>> > This way it seems to me that I should achieve the ability to design
>> meta-models at runtime while being able to use related projects if
>> needed (CDO, MDT, GMF, ...).
>>
>> Most of the infrastructure in the Eclipse modeling ecosystem rely on
>> working with EObjects (instance) whose meta model is Ecore.
>
> My take was that as long as you're working with extensions of EObjects
> (even through indirect extension (extension of an extension)),
> everything should still work... no ?
Yes, as long as that EObject's eClass() describes all there is to know
about that EObject. And that's how dynamic extension works, by taking
an existing implementation and ensure that eClass() returns the
extending EClass and ensuring that all generated implementation classes
support this dynamic extension (i.e., have correct dynamic delegation
for the reflective methods, i.e., for eGet, eSet, eIsSet, and eUnset.
>
> Ed Willink wrote on Sat, 11 January 2014 11:59
>> There are an increasing number of modeling applications working solely
>> with dynamic models/meta-models, and some tools now allow you to change
>> the meta-model dynamically too.
>
> We've been doing this for more than 28 years now, so I know that
> exists... ;)
> Do you have any reference for such an Eclipse based tool ?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF and dynamic meta-models [message #1231708 is a reply to message #1231649] Wed, 15 January 2014 08:31 Go to previous messageGo to next message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Hi Ed,

could you please write a little bit more about the dynamic extension. How to do it? Any code example? Link to a documentation?
Is it enough to simply create new EClass which extends the generated one and then retrieving attributes will delegate to the generated code? Or how?

Cheers,
Paweł.
Re: EMF and dynamic meta-models [message #1231729 is a reply to message #1231708] Wed, 15 January 2014 09:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Paweł,

My first post in this thread included a link to an article. Read that.


On 15/01/2014 9:31 AM, Paweł Doleciński wrote:
> Hi Ed,
>
> could you please write a little bit more about the dynamic extension.
> How to do it? Any code example? Link to a documentation?
> Is it enough to simply create new EClass which extends the generated
> one and then retrieving attributes will delegate to the generated
> code? Or how?
>
> Cheers,
> Paweł.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF and dynamic meta-models [message #1231790 is a reply to message #1231729] Wed, 15 January 2014 12:04 Go to previous message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
I already did and I thought maybe there is something extra in this topic.
Previous Topic:Loading XML with multiple schemalocations
Next Topic:temporarily disable notifications
Goto Forum:
  


Current Time: Fri Apr 19 11:32:47 GMT 2024

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

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

Back to the top