Giter Club home page Giter Club logo

Comments (9)

aranega avatar aranega commented on June 1, 2024

Hi,

Thanks for the bug report. Actually, it seems that I forgot to code the iD feature in the pyecore metamodel.

The modification is in two step, the first one is to enable the feature decoding by adding L.1198 in pyecore/ecore.py the missing feature:

EAttribute.iD = EAttribute('iD', EBoolean)

And the second step is to enable the code generator to code this information in the EAttribute constructor and in the generated code (so in pyecoregen and the Acceleo generator also) . This modification fairly easy, but I need to write corresponding tests.

I fix all of this asap!

from pyecore.

kdheepak avatar kdheepak commented on June 1, 2024

Thanks for the quick reply! I made the first change you suggested. I didn't exactly follow what the second change was.

However, on rerunning I no longer get the first error ( yay! ), but I do receive another error. I'm not sure if this is related to the first one.

pyecoregen -e schema.ecore -o your_output_path
Traceback (most recent call last):
  File "/Users/$USER/miniconda2/envs/python3-env/bin/pyecoregen", line 11, in <module>
    sys.exit(main())
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 12, in main
    generate_from_cli(sys.argv[1:])  # nocover
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 40, in generate_from_cli
    model = load_model(parsed_args.ecore_model)
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 59, in load_model
    resource = rset.get_resource(pyecore.resources.URI(ecore_model_path))
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/resource.py", line 41, in get_resource
    resource.load()
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 39, in load
    self._decode_ereferences()
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 233, in _decode_ereferences
    .format(value))
ValueError: EObject for ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDate is unknown

Do you know what might be going on or how I should proceed?

from pyecore.

aranega avatar aranega commented on June 1, 2024

Oh, right, it is a missing EDataType in the pyecore metamodel... I also forgot to add the EDate datatype. The modification is also quite easy (I will add it right after the iD feature) in the pyecore/ecore.py file:

at the import level:

from datetime import datetime

then, L.1167:

EDate = EDataType('EDate', datetime)

then, L.1297:

Core.register_classifier(EDate)

and finally, add EDate in __all__, L.1308:

..., 'EDate']

You surely have a great metamodel to deal with all the missing feature! I'm adding the type right away.

from pyecore.

aranega avatar aranega commented on June 1, 2024

I added the missing iD feature and EDate on the devrop branch. I also modified the Acceleo generator to deal with the iD feature, you should not be bother with this anymore.

I need to go, but I will adapt the pyecoregen generator as soon as I can.

from pyecore.

kdheepak avatar kdheepak commented on June 1, 2024

Thanks for the quick fixes! I seem to have found another object that is unknown.

pyecoregen -e schema.ecore -o your_output_path
Traceback (most recent call last):
  File "/Users/$USER/miniconda2/envs/python3-env/bin/pyecoregen", line 11, in <module>
    sys.exit(main())
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 12, in main
    generate_from_cli(sys.argv[1:])  # nocover
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 40, in generate_from_cli
    model = load_model(parsed_args.ecore_model)
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 59, in load_model
    resource = rset.get_resource(pyecore.resources.URI(ecore_model_path))
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/resource.py", line 41, in get_resource
    resource.load()
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 39, in load
    self._decode_ereferences()
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 233, in _decode_ereferences
    .format(value))
ValueError: EObject for ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigDecimal is unknown

from pyecore.

aranega avatar aranega commented on June 1, 2024

Arf, you're right, this time, this is the EBigDecimal which is missing. I'm really sorry I forgot so much types... I fix this as soon as I come back home!

from pyecore.

kdheepak avatar kdheepak commented on June 1, 2024

No problem! This is a great package btw :)

from pyecore.

aranega avatar aranega commented on June 1, 2024

Thanks a lot! I really hope it will be soon 'missing EDataType'-free ;)

So, I finally pushed on develop the missing EBigDecimal. By the same occasion, I also pushed some other missing basic EDataType:

  • EBigDecimal
  • EBooleanObject
  • ELongObject
  • EByte
  • EByteObject
  • EByteArray
  • EChar
  • ECharacterObject
  • EShort
  • EJavaClass

However, if you use EByte, EByteObject or EByteArray, I'm not sure about the 'serialization' of these EDataType at the moment (each EDataType instance can express the way they will be serilized and how they need to be deserialized when they are read from the XMI file, I'm not sure yet the best way to handle them).

I hope this time, all the EDataType you need are in the pyecore metamodel.

from pyecore.

aranega avatar aranega commented on June 1, 2024

I've release a new version of PyEcore on pypi (0.5.11) that adds the missing feature for the EAttribute and the missing EDataTypes.
Also, there is a new version of pyecoregen on pypi (0.3.0) which deals with the iD feature generation and prevent Python name clashes.

You can update everything using

$ pip install pyecore pyecoregen -U

from pyecore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.