Hello,

We've developed a model for energy systems using the Eclipse Modeling Framework 
and we're trying to use GenerateDS
to create python classes. The project is hosted here: 
https://github.com/EnergyTransition/ESDL-Python

A picture of the class diagram can be found here: 
https://github.com/EnergyTransition/ESDL/blob/master/esdl/model/esdl.png

The Eclipse tooling allows exporting the model as an XML schema definition. 
There are two different options:
- An xsd based on XML: 
https://github.com/EnergyTransition/ESDL-Python/blob/master/model/EsdlXML.xsd
- An xsd based on XMI: 
https://github.com/EnergyTransition/ESDL-Python/blob/master/model/esdlXMI.xsd

No matter what xsd we use as an input, we get undesired output when we try to 
write an instance of a EnergySystem to a file.

The problem exists where we use a collection of an abstract class, with many 
sub classes. In the example below area
is an instance of class Area. An Area can contain 0 to many (0..*) Assets. 
Asset is an abstract class and WindTurbine is
a subclass of Asset.

The desired output should look like this:

<esdl:EnergySystem>
    <esdl:instance>
        <esdl:area>
            <esdl:asset xsi:type="esdl:WindTurbine">
                ...
            </esdl:asset>
        </esdl:area>
    </esdl:instance>
</esdl:EnergySystem>

Using the XML version of the XSD, the output looks like:

<esdl:EnergySystem>
    <esdl:instance>
        <esdl:area>
            <esdl:WindTurbine>
                ...
            </esdl:WindTurbine>
        </esdl:area>
    </esdl:instance>
</esdl:EnergySystem>

Using the XMI version of the XSD, the output looks like:

<esdl:EnergySystem>
    <esdl:instance>
        <esdl:area>
            <esdl:asset>
                ...
            </esdl:asset>
        </esdl:area>
    </esdl:instance>
</esdl:EnergySystem>

Any ideas how to get this right? Any help is highly appreciated

Regards,
Edwin




This message may contain information that is not intended for you. If you are 
not the addressee or if this message was sent to you by mistake, you are 
requested to inform the sender and delete the message. TNO accepts no liability 
for the content of this e-mail, for the manner in which you use it and for 
damage of any kind resulting from the risks inherent to the electronic 
transmission of messages.
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to