Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [emf-dev] DanglingHREFs and few other problems


Shankar,

As mentioned on the web site, please use the newsgroup to ask questions.

http://www.eclipse.org/modeling/emf/newsgroup-mailing-list.php

Here's the whole previous history of your questions and my responses.  You seem to have simply repeated your question rather than taking into account what I've said below.  Repeating the question isn't going to generate a different answer.  :-(

====================================================================

Shankar,

You're the first person in years to claim to be unable to figure out how to sign up yet there are clear instructions for doing so:

http://www.eclipse.org/modeling/emf/newsgroup-mailing-list.php
http://www.eclipse.org/newsgroups/register.php

Please don't use my e-mail box as a free personalized consulting service.  I won't answer any more followup questions that you address directly to me.

When a non-containment reference to an object x is serialized, EMF checks two things.  It checks x.eProxyURI().  If that's set, it uses that value to serialize the reference.  Then it checks x.eResource() and if it isn't null, it uses x.eResource().getURI() to serialize the reference.  Otherwise it's an error. These are the only two ways to control how references are serialized.  Generally all objects must have x.eResource() != null, except for cases where x.eProxyURI() != null and such an object just represents a placeholder for the actual resolved object x' that's contained by a resource (as yielded by EcoreUtil.resolve).  So if you want things to serialize properly, you'll generally need to make sure that all objects are contain directly or indirectly be a resource.  

I've explained this many times on the newsgroups, so please use the search box on the right of this page to find previous discussions:

http://www.eclipse.org/newsportal/thread.php?group=eclipse.tools.emf


Ed Merks/Toronto/IBM@IBMCA
mailto: merks@xxxxxxxxxx
905-413-3265  (t/l 313)




"Shankar Ramachandran" <shanki.1107@xxxxxxxxx>

05/17/2008 01:46 AM

To
Ed Merks/Toronto/IBM@IBMCA
cc
Subject
Re: A basic doubt regarding serialization of e-objects of E-core





Hi Merks,

The forum didn't have the link to sign up a new user because of which I was not able to put my queries on the website. As this was a bit urgent I had to contact you directly for this.
However I will try and become a member there and would be putting up the mail chain there for people to see.

Merks, you were right when I tweaked each of those EObjects I was able to serialize them with their HREFs. But some of the entities were behaving in a different way.

See below snippet.

xml loaded through EMF

<Entity-1 id="id1">
    <Entity-2 href=""> </Entity-1

XMl serialized through EMF

<Entity-1 id="id1" Entity-2 ="../CPM_KP25/CPM_KP25.xml#//ent_mt1"/>

I had used the ((entity-1EObject).setEntity-2()) method. The entity-2 had the proxy URI set, along with its associated attributes.

The way I set the proxy URI was the same way you had suggested. It worked for some attributes while for some it didn't.

I would request you to suggest me ways of overcoming this.

Thanks and Regrds
Shankar
 

On Fri, May 16, 2008 at 9:50 PM, Ed Merks <merks@xxxxxxxxxx> wrote:

Shankar,


Please use the newsgroup for question.   <em>Comments</em> below.



Ed Merks/Toronto/IBM@IBMCA
mailto:
merks@xxxxxxxxxx
905-413-3265  (t/l 313)



"Shankar Ramachandran" <shanki.1107@xxxxxxxxx>

05/15/2008 11:48 PM


To
Ed Merks/Toronto/IBM@IBMCA
cc
Subject
A basic doubt regarding serialization of e-objects of E-core







Hello Merks,

I am a developer who is new to EMF and am facing some difficulty in working for a feature which involves EMF. I got your email id from some forums and would really appreciate your help here.

Feature
:

The work is to serialize (to xml files) data available from the database. The data were loaded from xml files only (using ecore). Now to complete the entire flow we need to getback the original data back from database.

Existing functionality -


With the current implementation, I am able to serialize into the xml file all direct contents, but when some entity carries a href attribute, which points to an entity in a different xml file, I get a DanglingHREF exception.

<em>You should get this only for an EObject x if x.eResource() == null and x.eIsProxy() is false.</em>


As part of the implementation I need to serialize the main EObject alone and not the dependent entity (to which the HREF points to).
If I discard the exception, then I don't get the entity serialized. I need the entity with href details but don't have the dependent EObject either for referencing or serializing.



<em>There must be more going on than you've spelled out.</em>



Eg:

Input file content used to load data into database


<Entity-1 id="id1">
    <Entity-2 href="">

Output file when serialized (after discarding danglingHREFException)

<Entity-1 id="id1"/>

Is there a way that you could suggest me for this?



<em>It sounds to me like you have an object not contained bya resource which should be marked as a proxy (InternalEobject.eSetProxyURI()) if you want to serialize a reference to it. Please ask any followup questions on the public newsgroup</em>

With Regards
Shankar Ramachandran




--
With Regards
Shankar Ramachandran


 

Ed Merks/Toronto/IBM@IBMCA
mailto: merks@xxxxxxxxxx
905-413-3265  (t/l 313)




"Shankar Ramachandran" <shanki.1107@xxxxxxxxx>
Sent by: emf-dev-bounces@xxxxxxxxxxx

05/17/2008 04:30 PM

Please respond to
Eclipse Modelling Framework  <emf-dev@xxxxxxxxxxx>

To
emf-dev@xxxxxxxxxxx
cc
Subject
[emf-dev] DanglingHREFs and few other problems





Hi all,

Initially I had faced a danglinghref exception, which got solved when the EObjects were set with the proxy URIs.
Now the problem is not dangling exceptions, but as mentioned below.

Feature
:

The work is to serialize (to xml files) data available from the database. The data were loaded from xml files only (using ecore). Now to complete the entire flow we need to getback the original data back from database.

Existing functionality -

The XML file loaded to the database using Ecore.


<Entity-1 id="id1">
    <Entity-2 href="">
</Entity-1

XMl serialized through EMF by getting info from the database.

<Entity-1 id="id1" Entity-2 ="../CPM_KP25/CPM_KP25.xml#//ent_mt1"/>

I had used the ((entity-1EObject).setEntity-2()) method. The entity-2 had the proxy URI set, along with its associated attributes. Other internal EObjects for which the HREF s are coming properly are set on the parent EObject using setListofEntities() method, while the problematic ones are the the ones having the method as setEntity() type.

I would request you to suggest me ways of overcoming this.

The older problem which got solved with suggestions from newsgroup people is below


With the current implementation, I am able to serialize into the xml file all direct contents, but when some entity carries a href attribute, which points to an entity in a different xml file, I get a DanglingHREF exception.

<em>You should get this only for an EObject x if x.eResource() == null and x.eIsProxy() is false.</em>


Eg:

Input file content used to load data into database


<Entity-1 id="id1">
    <Entity-2 href="">

Output file when serialized (after discarding danglingHREFException)

<Entity-1 id="id1"/>

Is there a way that you could suggest me for this?



<em>It sounds to me like you have an object not contained bya resource which should be marked as a proxy (InternalEobject.eSetProxyURI()) if you want to serialize a reference to it.

--
With Regards
Shankar Ramachandran
_______________________________________________
emf-dev mailing list
emf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/emf-dev


Back to the top