| Summary: | Unable to save objects from packages with cyclic dependencies | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Chahid Mariam <m.chahid> | ||||||||||||
| Component: | cdo.core | Assignee: | Caspar D. <caspar_d> | ||||||||||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||||||||||
| Severity: | normal | ||||||||||||||
| Priority: | P3 | CC: | caspar_d, Ed.Merks, mtaal, saulius.tvarijonas, stepper | ||||||||||||
| Version: | 3.0 | Flags: | stepper:
review+
|
||||||||||||
| Target Milestone: | --- | ||||||||||||||
| Hardware: | PC | ||||||||||||||
| OS: | Windows XP | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Chahid Mariam
Created attachment 170175 [details]
the exception happening when trying to create elements on the db for the first time
Created attachment 170176 [details]
The metamodel
Can you please provide us with the minimum model/code required to reproduce this issue? Created attachment 170177 [details]
model code plugin
Created attachment 170178 [details]
plugin containing the test class which reproduces the problem
The CDO tests already have 2 cases for circular package dependencies: org.eclipse.emf.cdo.tests.PackageRegistryTest.testCommitCircularPackages() org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_256141_Test.testBugzilla_256141() Martin, can you start investigating in HibernateStore/Teneo? I spend several hours on this this morning. The example packages you provided have nsuri which ends with a #. This results in proxies not being resolved. This happened with me even before I got into the Teneo mapping functionality, so your bugzilla can still be very valid. Can you provide sample models without a # in the namespace? Then I can take a look at it again. See also this post on the EMF newsgroup on using # in namespace uris: http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg05768.html I wonder though how did the # end up in the namespace uri? Was this done by EMF when converting a xsd to ecore? gr. Martin Created attachment 170511 [details]
Partial patch
This patch addresses the problem that the check in CDOModelUtil was
using the EGenericType's own resource instead of the resource of the
element that is referenced through the EGenericType.
There's still a problem though: after applying this patch it
occurs on the server side, for the same model element that caused
trouble in the CDOModelUtil.checkCrossResourceURIs.
Will investigate further, but must warn that my knowledge of advanced
EMF tricks (such as seem to be used in this model) are pretty much
over my head.
My suspicion is that the trouble derives from the nsURI
declared for the RDFType feature in RdfsResource,
via ExtendedMetaData:
<eStructuralFeatures xsi:type="ecore:EReference" name="RDFtype" lowerBound="1"
upperBound="-1" eType="#//RDFSClass" eOpposite="#//RDFSClass/typedResource">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="namespace" value="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
</eAnnotations>
</eStructuralFeatures>
I don't know what it means for a model element to have a
different nsURI from its owner and its owner's package, nor
how do I know how EMF deals with this. Therefore I also
don't know how CDO "should" deal with it.
Perhaps the bug reporter can explain?
CC'ing Ed. Maybe he has deeper insights regarding the strange # (hash) character in an nsURI... It seems likely that a # will mess up when the nsURI is used as a reference, i.e., <nsuURI>#<fragment-path>. A URI with more then one # technically isn't valid; EMF will allow that but treats the second # as part of the fragment. I've tried after removing # from nsuri of my models, it works.
The # is not due to a conversion from an xsd to an ecore, in fact i'm working on an owl ontology editor using emf api. I've to define a handler which reads the rdf format. As for the nsuris with #, they are the real uris of rdf, rdfs and owl languages.
<eStructuralFeatures xsi:type="ecore:EReference" name="RDFtype"
lowerBound="1"
upperBound="-1" eType="#//RDFSClass"
eOpposite="#//RDFSClass/typedResource">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="namespace"
value="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
</eAnnotations>
</eStructuralFeatures>
This annotation is used to test some code, I won't keep it like that. That's why i have not used it as it should be.
Thank you very much for your help
Hi Chahid, To be sure, you mean that after removing the # from the uri now everything works as expected and you encounter no issues? gr. Martin Yes Martin everything works well. My tables are created and my elements are saved on database as expected. Ok good to hear! Then I close this issue for now. I solved a number of other issues yesterday. So it can make sense to try a new CDO build after today (I am not sure when Eike will promote/publish the next build). gr. Martin Oeps, maybe to quick closing this one as there is a patch attached. Caspar/Eike, what to do with this patch (it is not a hibernate store patch)? Will you commit it? gr. Martin (In reply to comment #16) > Caspar/Eike, what to do with this patch (it is not a hibernate store patch)? It *seems* the check is more robust with the patch in place. But then, as discussed, I find EGenericTypes to be somewhat obscure creatures, so perhaps someone with a better understanding of them should take a look at it. I'm reopening it and flagging it for Eike's review. Legal note: No code from the usewr has been used. Comment on attachment 170511 [details]
Partial patch
My patch committed to HEAD.
Chahid, please test the fix in your scenario and reopen this bug if it does not fully address the original problem. Resolving FIXED. Hi Eike, I've tested the fix it works. Thanks, Chahid and Caspar! Thanks everybody for your help! Available in 3.0 GA: http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/ |