Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Insulating persisted data from changes to the Ecore model schema
Insulating persisted data from changes to the Ecore model schema [message #767562] Sun, 18 December 2011 10:37 Go to next message
Elvis Dowson is currently offline Elvis DowsonFriend
Messages: 65
Registered: December 2011
Member
Hi,
How can I re-use data that I've persisted earlier, using an older version of my Ecore model schema, after making changes, e.g addition of a new Ecore class and creating a new relationship?

For example, suppose that for the first version, I create a Library class and a Book class. I create the eclipse EMF plugin and create a new library project and add some books to the library.

For the second version, I add an Author class and model the relationship between the Book, Author and Library classes.

I've noticed that after I regenerate the new plugin, I am unable to right click on the Library model element and add a new Author.

I recall a while back that EMF was supposed to help insulate persisted data from changes in the model schema. I vaguely recall that it worked at the time.

But, when I try it now, it doesn't seem to work.

I'm using Eclipse-3.7 SR1 modeling tools SDK bundle on Mac OS X 10.7.2.

Elvis Dowson
Re: Insulating persisted data from changes to the Ecore model schema [message #767608 is a reply to message #767562] Sun, 18 December 2011 13:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Elvis,

Comments below.

On 18/12/2011 11:37 AM, Elvis Dowson wrote:
> Hi,
> How can I re-use data that I've persisted earlier, using an older
> version of my Ecore model schema, after making changes, e.g addition
> of a new Ecore class and creating a new relationship?
Additions shouldn't be a problem.
>
> For example, suppose that for the first version, I create a Library
> class and a Book class. I create the eclipse EMF plugin and create a
> new library project and add some books to the library.
>
> For the second version, I add an Author class and model the
> relationship between the Book, Author and Library classes.
> I've noticed that after I regenerate the new plugin, I am unable to
> right click on the Library model element and add a new Author.
Did you add a containment reference? (Note if not, and you change it,
you'll still have to change the GenFeature property for Libraries
authors feature.)
>
> I recall a while back that EMF was supposed to help insulate persisted
> data from changes in the model schema. I vaguely recall that it
> worked at the time.
>
> But, when I try it now, it doesn't seem to work.
> I'm using Eclipse-3.7 SR1 modeling tools SDK bundle on Mac OS X 10.7.2.
>
> Elvis Dowson


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Insulating persisted data from changes to the Ecore model schema [message #767621 is a reply to message #767608] Sun, 18 December 2011 14:04 Go to previous messageGo to next message
Elvis Dowson is currently offline Elvis DowsonFriend
Messages: 65
Registered: December 2011
Member
Hi Ed,

Ed Merks wrote on Sun, 18 December 2011 14:24

Did you add a containment reference? (Note if not, and you change it,
you'll still have to change the GenFeature property for Libraries
authors feature.)


I'm using the Ecore Tools plugin to create an Ecore diagram, which creates the library.ecore model. After that I create the *.genmodel file from the library.ecore model file.

I can't seem to find the GenFeature property for either the Ecore diagram or the Ecore model file. Could you please tell me on which model element / model file it is located in?

I did add the Author as a containment relationship, but it gave errors when trying to open the previous model.

Best regards,

Elvis Dowson
Re: Insulating persisted data from changes to the Ecore model schema [message #767633 is a reply to message #767621] Sun, 18 December 2011 14:37 Go to previous messageGo to next message
Elvis Dowson is currently offline Elvis DowsonFriend
Messages: 65
Registered: December 2011
Member
Hi Ed,
I tried it once again carefully, and it worked. I don't know what went wrong earlier.

The last time, I'd manually re-load the genmodel, this time around, I noticed that the genmodel was
always in sync with the changes made to the ecore diagram.

I've attached screenshots and the model project with this message. Its working fine now.

I've come across COPE (Coupled Evolution of Metamodels and Models) which takes things a bit further and allows you to build a migrator, to convert models if the meta-model changes.

While building this example, I changed the relationship between Book and Author from "has" to "written_by", and it automatically picked up the changes while loading an older version of the model, which had the "has" relationship.

So, to what extent does EMF actually insulate or preserve existing data, from changes to the meta-model / Ecore model schema?

Best regards,

Elvis Dowson
Re: Insulating persisted data from changes to the Ecore model schema [message #767656 is a reply to message #767633] Sun, 18 December 2011 15:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Elvis,

As long as you only add things, but no renames or removes, you should be
fine. There are also options like OPTION_RECORD_UNKNOWN_FEATURES that
can help in cases where you really break the serialization.



On 18/12/2011 3:37 PM, Elvis Dowson wrote:
> Hi Ed,
> I tried it once again carefully, and it worked. I don't know what went wrong earlier.
>
> The last time, I'd manually re-load the genmodel, this time around, I noticed that the genmodel was
> always in sync with the changes made to the ecore diagram.
>
> I've attached screenshots and the model project with this message. Its working fine now.
>
> I've come across COPE (Coupled Evolution of Metamodels and Models) which takes things a bit further and allows you to build a migrator, to convert models if the meta-model changes.
>
> While building this example, I changed the relationship between Book and Author from "has" to "written_by", and it automatically picked up the changes while loading an older version of the model, which had the "has" relationship.
>
> So, to what extent does EMF actually insulate or preserve existing data, from changes to the meta-model / Ecore model schema?
>
> Best regards,
>
> Elvis Dowson


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF code generator formats code but not comments
Next Topic:How to instantiate objects that have simple association relationships and not containment references
Goto Forum:
  


Current Time: Fri Apr 26 03:02:54 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