petervizi / python-eeml

A python package for generating eeml documents.
http://petervizi.github.com/python-eeml
GNU General Public License v3.0
43 stars 11 forks source link

XSD schema validaton for "id" breaks Cosm compatibility #24

Closed jolcese closed 11 years ago

jolcese commented 11 years ago

Cosm currently does not enforce "id" to be nonNegativeInteger (per EEML 0.5.1) so commit c75e280bdcc2e8e171dbae527cf18e4bff5d03ce breaks previous Datastreams with String identifiers. Those can't be updated any longer.

petervizi commented 11 years ago

Hi Jose,

I'm assuming you are referring to the id of the data element - environment also has a non negative although optional id -, and what I see is type="xsd:nonNegativeInteger" and use="required" in line 132 of the schema. Can you please double check?

Thanks

jolcese commented 11 years ago

That's right. It's the id of the Data element.

I used to use: pac.update([eeml.Data("Power", power, unit=eeml.Unit('Watt','derivedSI','W')), eeml.Data("PowerApparent", powerapparent, unit=eeml.Unit('VoltAmpere','derivedSI','VA')), eeml.Data("PowerAccumulated", poweracc, unit=eeml.Unit('WattHour','derivedSI','kWh')), eeml.Data("Current", current, unit=eeml.Unit('Ampere','basicSI','mA')), eeml.Data("Voltage", voltage, unit=eeml.Unit('Volt','derivedSI','V')), eeml.Data("PowerFactor", powerfactor)])

<eeml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.eeml.org/xsd/0.5.1" xsi:schemaLocation="http://www.eeml.org/xsd/0.5.1 http://www.eeml.org/xsd/0.5.1/0.5.1.xsd" version="0.5.1"><data id="Power">532.78<unit type="derivedSI" symbol="W">Watt<data id="PowerApparent">716.33<unit type="derivedSI" symbol="VA">VoltAmpere<data id="PowerAccumulated">467.27<unit type="derivedSI" symbol="kWh">WattHour<data id="Current">3182.36<unit type="basicSI" symbol="mA">Ampere<data id="Voltage">225.09<unit type="derivedSI" symbol="V">Volt<data id="PowerFactor">0.74

But now I need to use: pac.update([eeml.Data(0, power, unit=eeml.Unit('Watt','derivedSI','W')), eeml.Data(1, powerapparent, unit=eeml.Unit('VoltAmpere','derivedSI','VA')), eeml.Data(2, poweracc, unit=eeml.Unit('WattHour','derivedSI','kWh')), eeml.Data(3, current, unit=eeml.Unit('Ampere','basicSI','mA')), eeml.Data(4, voltage, unit=eeml.Unit('Volt','derivedSI','V')), eeml.Data(5, powerfactor)])

<eeml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.eeml.org/xsd/0.5.1" xsi:schemaLocation="http://www.eeml.org/xsd/0.5.1 http://www.eeml.org/xsd/0.5.1/0.5.1.xsd" version="0.5.1"><data id=0>532.78<unit type="derivedSI" symbol="W">Watt<data id=1>716.33<unit type="derivedSI" symbol="VA">VoltAmpere<data id=2>467.27<unit type="derivedSI" symbol="kWh">WattHour<data id=3>3182.36<unit type="basicSI" symbol="mA">Ampere<data id=4>225.09<unit type="derivedSI" symbol="V">Volt<data id=5>0.74

J+

On Thu, Jan 31, 2013 at 12:06 PM, Peter Vizi notifications@github.comwrote:

Hi Jose,

I'm assuming you are referring to the id of the data element - environment also has a non negative although optional id -, and what I see is type="xsd:nonNegativeInteger" and use="required" in line 132 of the schema. Can you please double check?

Thanks

— Reply to this email directly or view it on GitHubhttps://github.com/petervizi/python-eeml/issues/24#issuecomment-12946423.

petervizi commented 11 years ago

So do we agree that prior to version 4.0.0 the generated xml wasn't valid eeml? If so I'll close this ticket.

jolcese commented 11 years ago

Yes, I agree that it wasn't a valid eeml. However I suggest to add some mechanism to allow these non-valid eeml in order to be able to still communicate with Cosm :)

J+

On Thu, Jan 31, 2013 at 1:49 PM, Peter Vizi notifications@github.comwrote:

So do we agree that prior to version 4.0.0 the generated xml wasn't valid eeml? If so I'll close this ticket.

— Reply to this email directly or view it on GitHubhttps://github.com/petervizi/python-eeml/issues/24#issuecomment-12952026.

petervizi commented 11 years ago

Sorry for the slow turnaround. Can you give the Invalidator a try to see if it fits your use case?