crossecore / ecore-csharp

Ecore and OCL runtime API for C#
Eclipse Public License 2.0
10 stars 1 forks source link

Issues resolving references in an XmiResource #2

Open stephan-herrmann opened 5 years ago

stephan-herrmann commented 5 years ago

We are observing some problems when loading an XmiResource:

(1) Inside resolveEObject() only specifications starting with "#//" are understood. For local references within a resource EMF creates references starting with "//" without the leading hashmark.

(2) In resolveRecurr() it seems the levels of model and meta model are confused: current.eContents() will iterate all attributes of the current attribute, but then "is ENamedElement" will be false, because here we (probably) need the feature from the meta model, not the value from the model. Perhaps "current.eClass().eContents()" would be a step in the intended direction. OTOH, we do need the concrete attribute value corresponding to the parsed segment, too.

(3) I don't see any interpretation of list indices like in "#//@elements.1/@subelems.3"

schwichti commented 5 years ago

(1) The ecore files I have created with EMF use local references starting with "#//"; e.g. see Conference.ecore. I could not find any documentation when EMF inserts "#" into URI and when not. I guess the best is to consider URI fragments starting with either "#//" or "//".

(2) Yep. Seems to be something like that:

            foreach (EObject content in current.eClass().eAllContainments())
            {
                if (content is ENamedElement)
                {

                    if ((content as ENamedElement).name == segment)
                    {
                        return resolveRecurr(path, current.eGet(content));
                    }
                }
            }

I will check that.

(3) Feature will be supported soon.

schwichti commented 5 years ago

I have pushed a fix for XmiResource. I seems that an URI is starting with "//" when it accesses an array index. So (1) and (3) seem to be related.