Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » References not stored in xmi file when I save the objects
References not stored in xmi file when I save the objects [message #1780364] Sun, 21 January 2018 15:38 Go to next message
antonio guillen is currently offline antonio guillenFriend
Messages: 34
Registered: January 2014
Member
index.php/fa/31880/0/Why some references are not saved in the xmi file when I save the object containing them?

See the xmi file attached
and the genmodel image

Thanks

Cheers
Re: References not stored in xmi file when I save the objects [message #1780367 is a reply to message #1780364] Sun, 21 January 2018 17:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6066
Registered: July 2009
Senior Member
Hi

You show a metamodel and a saved model but nothing to show what is 'not saved'.

Default values are not normally saved.

Regards

Ed Willink
Re: References not stored in xmi file when I save the objects [message #1780368 is a reply to message #1780367] Sun, 21 January 2018 17:21 Go to previous messageGo to next message
antonio guillen is currently offline antonio guillenFriend
Messages: 34
Registered: January 2014
Member
For example the FieldMesh of adaptedGeophysicalMeasurements is not saved as you can see in TonioReport.xmi text file!
This EReference is not declared transient?
Re: References not stored in xmi file when I save the objects [message #1780369 is a reply to message #1780368] Sun, 21 January 2018 17:35 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6066
Registered: July 2009
Senior Member
Hi

But perhaps there was nothing to save. Perhaps null. Perhaps not serializeable. Perhaps a proxy. Perhaps a bug. You don't provide nearly enough information. Why no *.ecore file? Why no JUnit test to create the model that is 'not saved'.

Regards

Ed Willink
Re: References not stored in xmi file when I save the objects [message #1780379 is a reply to message #1780369] Mon, 22 January 2018 03:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29589
Registered: July 2009
Senior Member
I see what appears to be one cross reference that is serialized, i.e., topographySection="//@groups.6/@data.6" but I don't see that this serialization has 7 groups. Perhaps it's a broken proxy, i.e., you loaded the model, removed some objects from some containment references, but never resolved the cross references to that referenced contained object, nor did you try to clean up all cross references to remove references to the no-longer-contained objects (which in the generated editor is done automatically when an object is deleted from the tree.

In any case, the most likely reason that a cross reference isn't serialized is because the referenced EObject isn't contained by any Resource. Only references to objects contained by a Resource can be serialized. The following code could be used to debug this. I.e., it iterates over each object contained by the resource, iterates over each such contained object's cross references, and checks if the cross referenced object is a proxy or if it's not contained in a resource:
    for (TreeIterator<EObject> i = resource.getAllContents(); i.hasNext(); )
    {
      for (EObject eObject : i.next().eCrossReferences())
      {
        if (eObject.eIsProxy() || eObject.eResource() == null)
        {
           // This is a) a broken proxy or b) a dangling reference
        }
      }
    }
Re: References not stored in xmi file when I save the objects [message #1780399 is a reply to message #1780379] Mon, 22 January 2018 08:04 Go to previous message
antonio guillen is currently offline antonio guillenFriend
Messages: 34
Registered: January 2014
Member
Thanks a lot Ed,

You are right using your code I discover that the EObjects are on dangling reference, and There is a good reason. I will debug the stuffs.

Thanks a lot.

Previous Topic:[XCore] / [EMF] Derived Attribute notifier definition/generation from model
Next Topic:[CDO] Authentication problem since Java update 8u161
Goto Forum:
  


Current Time: Tue Oct 16 22:46:14 GMT 2018

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

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

Back to the top