-
Notifications
You must be signed in to change notification settings - Fork 45
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
Problems Adding External resources with references in JSON #116
Comments
The ecore file was missing, now it is included! :-) Thank you in advance! |
Hi @pablo-campillo , Thanks for the ticket and the use-case! I think you found a nasty bug here, I can see from the serialized json that something is wrong in the computed Thanks again, I will fix that very soon! |
Thanks again for the use-case and the issue. I fixed it on |
@aranega , Thanks to you! |
Hi @pablo-campillo , Thanks for the report! I tried your use-case, but I cannot reproduce the problem on my side 😬, everything is going just fine... For the execution of the code, I'm on the |
Hi @aranega, I removed the issue because the problem was solved, I think I was loading the metamodel two times or something like that. Now, I found a problem, when I deserialize a model instead of get instances of object generated static by pyecoregen I got EProxy objects, please, do you know why? Thank you very much! |
I'm glad this issue went away :) Regarding the proxies, yes, everytime you deserialize models that are split into different resources, PyEcore puts a proxy to reference the external object. EMF does the same, but it has a mechanism that then transfers the real instance and reconnect things, destroying proxies. In PyEcore, the proxies stays, but acts like a transparent proxy, meaning that you can handle it as a normal instance and it will resolve the proxy on it's own when you access any feature of the object (loading the external resource automatically if this resource has not been loaded before). To avoid this, I should slightly change the way resources are deserialized by checking first if the external resource owning the object is already loaded in the resource set and resolve it from there. I think there is not so much work on that, but perhaps there is corner cases to deal with that. This joins a little bit what I can do to deal with #120 . |
Ok, I understand. The problem is that isinstance(obj, Class) does not work, right? |
It should work if the proxy can be resolved meaning if the external resource can be loaded (if it wasn't in the first place), from pyecore.ecore import EClass, EProxy
A = EClass('A')
instance = A()
proxy = EProxy(wrapped=instance)
assert isinstance(instance, A)
assert isinstance(proxy, A) |
I want to split the model in several files. However, when I try to join the models, attributes that are references to an external resource are None.
My toy example (all files attached at files.zip):
Code:
The test:
The content of the serialized files:
The error:
files.zip
The text was updated successfully, but these errors were encountered: