pyecore / pyecore

A Python(nic) Implementation of EMF/Ecore (Eclipse Modeling Framework)
BSD 3-Clause "New" or "Revised" License
160 stars 45 forks source link

get all properties of a model element #131

Closed Z-Rajaei closed 1 year ago

Z-Rajaei commented 1 year ago

Hello, I want to get all the properties of an element in the model.

    <eStructuralFeatures xsi:type="ecore:EReference" name="states" upperBound="-1"
        eType="#//State" containment="true"/>

for example, in the above ecore part. I want to know which properties the states EReference has. (i.e. name, upperbound, etype and containment and their values.) what can I do in case I don't know which properties are specified to access them?

alessiostalla commented 1 year ago

You obtain the element's EClass, then query it, e.g.

myEObject.eClass.eAllStructuralFeatures()
aranega commented 1 year ago

I'll close the issue as @alessiostalla answered your question and we also exchanged a little bit by email :)