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

Empty resource.contents after autoload #112

Open
AnNeub opened this issue Nov 18, 2021 · 3 comments
Open

Empty resource.contents after autoload #112

AnNeub opened this issue Nov 18, 2021 · 3 comments

Comments

@AnNeub
Copy link

AnNeub commented Nov 18, 2021

This issue occur if a autoloaded resource is accessed via get_resource again. The problem occur in the function _update_container where the value is removed from contents. If accessing the same resource again, the resource is already loaded but has no contents.

I resolve this issue by adding the following lines to get_resource

        if uri.normalize() in self.resources:
            resource = self.resources[uri.normalize()]
            if resource.contents:
                return self.resources[uri.normalize()]
        else:
            # If not, we create a new resource
            resource = self.create_resource(uri)

See the stack trace below, when that happens. The line numbers may be not 100% correct.

_try_resource_autoload, resource.py:464
_get_href_decoder, resource.py:453
resolve_object, resource.py:400
__getattribute__, ecore.py:1018
_update_container, valuecontainer.py:78
add, valuecontainer.py:346
@aranega
Copy link
Member

aranega commented Nov 18, 2021

Hi again @AnNeub,

Thanks again for the issue, I'll check that asap. So the scenario is that there is an external resource that is automatically loaded (let say there is A.xmi that's loads objects from B.xmi) and when you access again the loaded resource from the resource set (so accessing B.xmi from the resource set) the content of this model is empty. That's it?

@AnNeub
Copy link
Author

AnNeub commented Nov 18, 2021

Thats correct

@aranega
Copy link
Member

aranega commented Jan 21, 2022

Hi @AnNeub

Sorry for the late answer... I started to try to reproduce your issue, but I cannot, mainly because I think the issue you have is directly related to the issue you raised in #113 (having the container object in a resource and the contained elements in another). I need to investigate further how EMF/Java reacts in those way, i.e, what will the contained object will answer if I ask who's its parent and which is its resource, to be compliant with that.

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