EnEff-BIM / EnEffBIM-Framework

translating from BIM to BEPS
MIT License
8 stars 0 forks source link

XLSX to XML Mapping Rules #69

Closed PRemmen closed 8 years ago

PRemmen commented 9 years ago

Creating a script that converts the Excel based mapping rules into XML based data.

Could you upload a current version to this github repository @ReinhardWimmer ?

PRemmen commented 8 years ago

Technically reading the Excel sheet and creating an XML with the given schema is possible. However, I struggle with the meaning of the attributes both on XML and Excel side. Seccond thing is that the schema defines a namespace "datamap", thus the binding framework in Python requires me to set this namespace. The current available mapping rules XML has no namespace.

math-boy commented 8 years ago

@PRemmen I can help you to check current XML based mapping rules when I finished the new binding framework.

PRemmen commented 8 years ago

@math-boy just for understanding: which kind of "binding framework" are you talking about? Mapping Rules Binding or SimXML Binding?

Anyway: Is there an UML Representation of the Mapping Rule XSD? Would help a lot to implement the corresponding Python Function and Classes

math-boy commented 8 years ago

@PRemmen Thank you very much for finding this small bug in the mapping rule schema. I'll do the follwing issue later: 1) delete the 'datamap' namespace from the mapping rule schema. This is very straightforward. 2) or add another space for the whole mapping rule schema. This is very useful for my C++ code in order to distinguish the SimModel mapping rule API from the SimModel data model API.

PRemmen commented 8 years ago

:+1:

I think my code will be able to handle these small modifications

PRemmen commented 8 years ago

@math-boy in a first step I deleted the datamap namespace (see commit 91e0cff ). We can modify the .xsd with a second namespace without a problem later.

PRemmen commented 8 years ago

I had a closer look at the new designed Mapping Rule Table. I will continue the development of this branch, if the design is more stable.

I'm not very experienced in converting Excel Data with Python, but from what I see right now, the conversion process will be very error-prone.

We need to catch a lot of different possible cases. This leads especially to a lot of string analysis (lots of "if clauses", which is in general vulnerable to errors. (e.g.: Stuff like "a1+273,15" -> "a1=simmep:SimFlowPlant_DesignWaterOutletTemp" or line breaks etc.). Another example is the multiple call of "SimFlowPlant" in column A. Of course we can theoretically catch all these exceptions, but this will lead to a lot of code that might not be very good maintainable and what if the user adds a column? Thus I think there is the need of very specific formatting rules in the excel sheet which should be developed with a focus both on human readability (as it is right now) and machine readability (again: this is just based on my experience).

In addition the Mapping Rule Schema (mapping.xsd) probably needs some modification because of new Mapping Rules, and missing attributes (e.g. datatype)

PRemmen commented 8 years ago

I'm currently implementing all XML Mapping Rule Classes to the Python side (does not include conversion from EXCEL -> Python).

I have some comments on the schema:

      <xs:choice minOccurs="1" maxOccurs="1">
        <xs:element ref="Value"/>
        <xs:element ref="RefValue"/>
      </xs:choice>

These are just some first comments. I will complete my comments till the workshop and then we can change the schema together

PRemmen commented 8 years ago

Should we close this issue?

PRemmen commented 8 years ago

agreed to directly create XML with a valid XSD. Specific issue should be openend for this discussion