Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem during serialization (resolve URIFragment) #113

Open
AnNeub opened this issue Dec 6, 2021 · 1 comment
Open

Problem during serialization (resolve URIFragment) #113

AnNeub opened this issue Dec 6, 2021 · 1 comment

Comments

@AnNeub
Copy link

AnNeub commented Dec 6, 2021

I have loaded a resource set which consists of two resource files. I did some modification in one file and than I store it again.
This was already working but suddenly it dont work any more. When i dive into the code, I found out the following:

As far as I understood, during loading of the first resource file an EProxy is generated for the link to an object into the other resource file. When loading the second resource the dedicated object is created and linked to the EProxy.

During serialization of the second resource, an error occur in the function eURIFragment.
The problem in my case was that parent.__getattribute__(name).index(self) raises an IndexError. The parent seems to be part of the first resource and therefore an EProxy object is part of the Orderset. But self is the dedicated object and therefore could not be found.
If I try to determine the index via a loop like this

            for idx, element in enumerate(parent.__getattribute__(name)):
                if isinstance(element, EProxy) and not isinstance(self, EProxy):
                    if self == element._wrapped:
                        index = idx
                        break
                else:
                    if self == element:
                        index = idx
                        break

it works.

I don't know if this case could be captured at the beginning of the function. I'm wondering why this was working if I have done less modification.

If you need more information, please let me know.

Best regards,
Andreas

@aranega
Copy link
Member

aranega commented Dec 18, 2021

Thanks again for your ticket and for a fix! I will try it. The thing is that objects that have their container in another resource is not so easy to deal with. EMF have a behavior for it that is still a little bit strange to me (for example, what happens if an object is contained in an object in a resource B, but another object has a containement relationship toward the same instance in a resource A).

Thanks a lot of all your scenarios, they will improve the test data set for sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants