Skip to main content



      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 10:38 Go to next message
Eclipse UserFriend
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 12:05 Go to previous messageGo to next message
Eclipse UserFriend
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 12:21 Go to previous messageGo to next message
Eclipse UserFriend
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 12:35 Go to previous messageGo to next message
Eclipse UserFriend
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] Sun, 21 January 2018 22:25 Go to previous messageGo to next message
Eclipse UserFriend
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 03:04 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 16:32:06 EDT 2025

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

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

Back to the top