Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF serialize gets href for unchanged elements
EMF serialize gets href for unchanged elements [message #543221] Mon, 28 June 2010 17:52 Go to next message
Jonathan Seng is currently offline Jonathan SengFriend
Messages: 5
Registered: June 2010
Junior Member
When I deserialize anEMF Model, then serialize it to another file, any portions not changed get saved with an href instead of content.

Their are specific instances where I will want references to occur, but, generally I want to save a model to a different file and have a full copy of the model for this application.

How can I better control this?
Re: EMF serialize gets href for unchanged elements [message #543228 is a reply to message #543221] Mon, 28 June 2010 18:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33146
Registered: July 2009
Senior Member
Jonathan,

Comments below.


Jonathan Seng wrote:
> When I deserialize anEMF Model, then serialize it to another file, any
> portions not changed get saved with an href instead of content.
The reference itself would have to support proxy resolution. These
would be references to the original changed version?
>
> Their are specific instances where I will want references to occur,
> but, generally I want to save a model to a different file and have a
> full copy of the model for this application.
Do those references already support cross resource references?
>
> How can I better control this?
Perhaps you'd be better off storing a ChangeDescription which would be a
delta against the original you could apply to produce the modified version.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF serialize gets href for unchanged elements [message #543232 is a reply to message #543228] Mon, 28 June 2010 18:32 Go to previous messageGo to next message
Jonathan Seng is currently offline Jonathan SengFriend
Messages: 5
Registered: June 2010
Junior Member
Perhaps I have overcomplicated the explanation.

If I read a.xml into an EMF Object Tree, then save it to b.xml, b.xml will contain an href to a.xml.

There will be some places where we want cross document references and will be happy to handle those separately. But, this is not one where we have asked for it.

Thank you.
Re: EMF serialize gets href for unchanged elements [message #543242 is a reply to message #543232] Mon, 28 June 2010 18:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33146
Registered: July 2009
Senior Member
Jonathan,

Comments below.

Jonathan Seng wrote:
> Perhaps I have overcomplicated the explanation.
>
> If I read a.xml into an EMF Object Tree, then save it to b.xml, b.xml
> will contain an href to a.xml.
I'd generally expect any same document references (references from
within a.xml to other things in a.xml to be resolved) upon completion of
loading. You can use EcoreUtil.resolveAll to force all proxies to be
resolved, so maybe that will help.
>
> There will be some places where we want cross document references and
> will be happy to handle those separately. But, this is not one where
> we have asked for it.
>
> Thank you.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF serialize gets href for unchanged elements [message #543244 is a reply to message #543242] Mon, 28 June 2010 19:02 Go to previous messageGo to next message
Jonathan Seng is currently offline Jonathan SengFriend
Messages: 5
Registered: June 2010
Junior Member
Ed,

Can I force them to resolve on save?

Thank you.
Re: EMF serialize gets href for unchanged elements [message #543249 is a reply to message #543244] Mon, 28 June 2010 19:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33146
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020407060505050407080501
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Jonathan,

It's just my theory right now. I'd expect during load for
XMLHandler.handleProxy to notice same document proxies and for them to
be resolve so I'd be curious why that isn't happening if indeed it
isn't. So I'd suggest you confirm that indeed proxies are a problem
before trying to find a workaround, especially one that really shouldn't
be necessary. Perhaps you're messing up by loading with a relative URI
or something else that makes this logic in XMLHandler.handleProxy fail:

// Test for a same document reference that would usually be handled
as an IDREF.
//
if (proxyURI.trimFragment().equals(resourceURI))
{
sameDocumentProxies.add(proxy);
}


Jonathan Seng wrote:
> Ed,
>
> Can I force them to resolve on save?
>
> Thank you.

--------------020407060505050407080501
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jonathan,<br>
<br>
It's just my theory right now.  I'd expect during load for
XMLHandler.handleProxy to notice same document proxies and for them to
be resolve so I'd be curious why that isn't happening if indeed it
isn't.   So I'd suggest you confirm that indeed proxies are a problem
before trying to find a workaround, especially one that really
shouldn't be necessary.  Perhaps you're messing up by loading with a
relative URI or something else that makes this logic in
XMLHandler.handleProxy fail:<br>
<br>
<small>    // Test for a same document reference that would usually be
handled as an IDREF.<br>
    //<br>
    if (proxyURI.trimFragment().equals(resourceURI))<br>
    {<br>
      sameDocumentProxies.add(proxy);<br>
    }</small><br>
<br>
<br>
Jonathan Seng wrote:
<blockquote cite="mid:i0ark5$qgs$1@build.eclipse.org" type="cite">Ed,
<br>
<br>
Can I force them to resolve on save?
<br>
<br>
Thank you.
<br>
</blockquote>
</body>
</html>

--------------020407060505050407080501--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF serialize gets href for unchanged elements [message #543257 is a reply to message #543249] Mon, 28 June 2010 20:10 Go to previous messageGo to next message
Jonathan Seng is currently offline Jonathan SengFriend
Messages: 5
Registered: June 2010
Junior Member
Ed,

The user-expected behavior is that with the exception of certain known cross document references, a file should be complete. The use case of read a.xml, change one item, write b.xml will occur frequently and the users will want to email or thumb-drive b.xml. Requiring a.xml will be unexpected and a major problem.

Thank you.
Re: EMF serialize gets href for unchanged elements [message #543278 is a reply to message #543257] Mon, 28 June 2010 21:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33146
Registered: July 2009
Senior Member
Jonathan,

Comments below.

Jonathan Seng wrote:
> Ed,
>
> The user-expected behavior is that with the exception of certain known
> cross document references, a file should be complete.
Yes, I'd expect that too.
> The use case of read a.xml, change one item, write b.xml will occur
> frequently and the users will want to email or thumb-drive b.xml.
Yes.
> Requiring a.xml will be unexpected and a major problem.
Yes. That was my point about how references within a document itself
are generally resolved during load. In the end, I don't see any
questions here and I don't see how this is a response to my previous
note. Have you determined yet why there continue to be references to
a.xml? Is it unresolved proxies? Or you really do still have
references to things still contained by a.xml?
>
> Thank you.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF serialize gets href for unchanged elements [message #543586 is a reply to message #543278] Tue, 29 June 2010 21:35 Go to previous message
Jonathan Seng is currently offline Jonathan SengFriend
Messages: 5
Registered: June 2010
Junior Member
I misunderstood resolving proxies when trying to load the second file.

Resolving the proxies after the initial load of a.xml allowed for complete persistence in the saved file b.xml.

Thank you!
Previous Topic:EMF model of OSGi platform
Next Topic:[Databinding] ObservableListTreeContentProvider for multiList of 'single' references
Goto Forum:
  


Current Time: Fri May 10 07:30:33 GMT 2024

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

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

Back to the top