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

AttributeError for EDerivedCollection #124

Open
fabtrie opened this issue May 21, 2022 · 2 comments
Open

AttributeError for EDerivedCollection #124

fabtrie opened this issue May 21, 2022 · 2 comments

Comments

@fabtrie
Copy link

fabtrie commented May 21, 2022

I am trying to load an AUTOSAR arxml file. Therefore, I created the Ecore model from the publicly available XSD. When I try to load the resource, I am getting the following error:

File "c:\workspace\pyecore_issue\test.py", line 22, in main
    rset.get_resource(URI("test.arxml"))
  File "C:\python\3.8.1.0.7\python-3.8.1.amd64\lib\site-packages\pyecore\resources\resource.py", line 94, in get_resource
    resource.load(options=options)
  File "C:\python\3.8.1.0.7\python-3.8.1.amd64\lib\site-packages\pyecore\resources\xmi.py", line 63, in load
    self._decode_eobject(child, modelroot)
  File "C:\python\3.8.1.0.7\python-3.8.1.amd64\lib\site-packages\pyecore\resources\xmi.py", line 173, in _decode_eobject
    self._decode_eobject(child, eobject)
  File "C:\tpython\3.8.1.0.7\python-3.8.1.amd64\lib\site-packages\pyecore\resources\xmi.py", line 167, in _decode_eobject
    parent_eobj.__getattribute__(feat_container.name).append(eobject)
  File "C:\python\3.8.1.0.7\python-3.8.1.amd64\lib\_collections_abc.py", line 962, in append
    self.insert(len(self), value)
  File "C:\python\3.8.1.0.7\python-3.8.1.amd64\lib\site-packages\pyecore\valuecontainer.py", line 407, in __len__
    raise AttributeError('Operation not permited '
AttributeError: Operation not permited for "AR-PACKAGE" feature

It looks like it has something to do with the class EDerivedCollection which does not allow to get length information.

I am using pyecore version 0.12.2.

I attached a minimal example to reproduce the issue:
pyecore_issue.zip

@aranega
Copy link
Member

aranega commented Jun 20, 2022

Hi @fabtrie,

I'm so sorry, I totally missed your issue. Thanks for the case study and the ticket! Following the message, it looks like indeed, a derived feature is responsible for this behavior. As there is currently no implementation of the AUTOSAR metamodel in Python, PyEcore relies only in dynamic metamodel to load the XMI. I will try to load your project with Eclipse, without any plugin beside EMF to see if the same behavior occurs, if yes, it means that a static AUTOSAR metamodel implementation in Python will be required, if no, it means something is wrong on the assumptions I made while decoding the metamodel. I will try to test all of that asap!

Thanks again for your help in improving PyEcore and sorry again for the late answer.

EDIT> I found the issue there, it comes from the fact that PyEcore doesn't deal right now with ExtendedMetadata. It seems that for derived features, when there is a group annotation let in the ExtendedMetadata, EMF considers the feature pointed by group as a feature to which delegate the addition/removal of the object. I will try to think about a trick or something to overcome this until I propose a proper implementation for ExtendedMetadata. The implementation I have right now introduce an overhead for features accesses on instances.

@fabtrie
Copy link
Author

fabtrie commented Jun 20, 2022

OK. Thank you for the analysis. Actually, I used Artop before, which is an abstraction for AUTOSAR on top of EMF. This is working fine. But I want to get rid of the java dependency. If you can find a workaround, It would be highly appreciated. I need it mainly for extracting information and navigating through references.

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