Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » saveModel deletes the model(When i call saveModel, the model contents are deleted)
saveModel deletes the model [message #1140820] Wed, 16 October 2013 16:33 Go to next message
Victor Lopez is currently offline Victor LopezFriend
Messages: 21
Registered: August 2013
Junior Member
Hello everybody,

This is what I have:

packages -> metaModel
inModel -> input model
outModels -> output models
URI -> output URI (i have more than 1 output so I modify the URI while iterating)

here I save the input in the output URI (after I modify the input with other methods)
ModelManager.saveModel(this.inModel, URI);

here I save the modified input into de outputs array.
this.outModels.add(ModelManager.loadModel(packages, URI));

//Then I load the original input again
this.inModel = ModelManager.loadModel(packages, this.inModel.getURI().toString());

The thing is that after I execute the first ModelManager.saveModel(this.inModel, URI); the model's containment is deleted. While debugging (after that call) the model does not have the containment (the root).

What can I do to not loose the model after saving?

Best regards!

Victor.
Re: saveModel deletes the model [message #1140852 is a reply to message #1140820] Wed, 16 October 2013 17:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Victor,

Moving an object to a resource's contents will remove it from its
containment reference. That's just how it works, so don't do that if
you don't want that. Please consult with whomever provides these
ModelManager utilities for details about what they do; I can't answer that.


On 16/10/2013 6:33 PM, Victor Lopez wrote:
> Hello everybody,
> This is what I have:
>
> packages -> metaModel
> inModel -> input model
> outModels -> output models
> URI -> output URI (i have more than 1 output so I modify the URI while
> iterating)
>
> here I save the input in the output URI (after I modify the input with
> other methods)
> ModelManager.saveModel(this.inModel, URI);
>
> here I save the modified input into de outputs array.
> this.outModels.add(ModelManager.loadModel(packages, URI));
>
> //Then I load the original input again
> this.inModel = ModelManager.loadModel(packages,
> this.inModel.getURI().toString());
>
> The thing is that after I execute the first
> ModelManager.saveModel(this.inModel, URI); the model's containment is
> deleted. While debugging (after that call) the model does not have the
> containment (the root).
>
> What can I do to not loose the model after saving?
>
> Best regards!
>
> Victor.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: saveModel deletes the model [message #1140882 is a reply to message #1140852] Wed, 16 October 2013 17:28 Go to previous messageGo to next message
Victor Lopez is currently offline Victor LopezFriend
Messages: 21
Registered: August 2013
Junior Member
Thanks for the answer. ModelManager is mine, but it just encapsulated there. What I do is how to save models in EMF.

I will explain more:

What i want to do is from an input Model, generate N output Models from a list of modification that I do in the input one.

I see that it does not work as I implemented it but it must be some way.

How can I generate N models from an input without loosing the input?

If someone comes to the idea please share it.

Best regards,

Víctor.
Re: saveModel deletes the model [message #1141642 is a reply to message #1140882] Thu, 17 October 2013 05:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Victor,

Comments below.

On 16/10/2013 7:28 PM, Victor Lopez wrote:
> Thanks for the answer. ModelManager is mine, but it just encapsulated
> there. What I do is how to save models in EMF.
> I will explain more:
>
> What i want to do is from an input Model, generate N output Models
> from a list of modification that I do in the input one.
But it sounds as if you didn't actually do that. It sounds more like
some what you describe as input you also consider to be output, so you
put it in a resource, thereby removing it from where ever it was before.
> I see that it does not work as I implemented it but it must be some way.
> How can I generate N models from an input without loosing the input?
As I said, it doesn't sound like that's what your doing. If your
inputs are also considered outputs you must consider whether you want a
copy of the input saved somewhere else or whether you should be
referring to the original object in its original location without moving
it, i.e., not consider it an output.
>
> If someone comes to the idea please share it.
>
> Best regards,
>
> Víctor.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Specifying enum operations in xcore
Next Topic:Adding attributes to model elements in XMI?
Goto Forum:
  


Current Time: Thu Mar 28 20:11:52 GMT 2024

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

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

Back to the top