Opened 13 years ago

Closed 8 years ago

Last modified 8 years ago

#16 closed enhancement (fixed)

Add XML schema and namespace support for ucum-essence.xml

Reported by: Aaron Braeckel Owned by:
Priority: major Milestone: Revision 1.9
Component: Keywords:
Cc:

Description (last modified by Gunther Schadow)

Hello,

the current version of the XML portion of the specification (currently at http://unitsofmeasure.org/ucum-essence.xml) could benefit from having an XML schema and a namespace. The schema would provide the ability to ensure that new unit definitions conform properly to the definition grammar, while the namespace would allow for unambiguous element and attribute naming when UCUM is combined with other grammars. Together this would allow for a "common" set of units in the UCUM namespace, and allow these definitions to be extended with domain-specific or application-specific definitions in another XML file as needed.

This requires a very minor change to ucum-essence.xml (2 lines or so near the top), changes to some applications that currently use this XML file without a namespace, and the creation of an XML schema. I have created an initial cut at the ucum-essence.xml file and an associated schema which may be found at http://www.rap.ucar.edu/~braeckel/ucum/. All of my comments and questions on this process are documented in the schema file (ucum.xsd).

Thanks, Aaron Braeckel

Change History (6)

comment:1 Changed 11 years ago by Gunther Schadow

A schema could not "provide the ability to ensure that new unit definitions conform properly to the definition grammar" -- where "definition grammar" means how you put unit symbols together. The other thing is trivial, because we generate the ucum-essence.xml from other XML files.

The ucum-essence.xml is supposed to be simply a delivery vehicle, consumers could use this in various ways.

This could be done, but the utility of it is not clear.

I would like to see how someone would actually use this in combination with other XML so that namespace would be relevant. The schema may be helpful to some and they could use the one that you have reconstructed. Thank you very much for this contribution.

comment:2 Changed 11 years ago by Aaron Braeckel

You are correct that it would be difficult to completely ensure that unit definitions conform, but you can certainly add a much stronger validation mechanism. The "km = m * 1000" type of definition will not be completely solved with a schema, but you can guarantee that any XML definition files are well-formed in an XML syntactical sense. There may also be ways to go further than the current XML validation which would allow shallow validation on the definition contents themselves (Schematron, regex, etc.).

There are two portions of UCUM relevant here: 1) the units of measure defined by UCUM, irrespective of how these are represented (XML, text, DB, etc.). This might be summarized as "UCUM as an authority", much as EPSG is an authority for Coordinate Reference System definitions 2) the technical representation mechanism for UCUM's UoM definitions. In this case the XML

There are cases where domain-specific, organizationally-specific, and other units not yet in UCUM are used today and this will continue into the future. There are many cases of this in the meteorological and aviation domains that I work in. Either it is assumed that all will be added to UCUM before they are needed, or UCUM can allow other organizations to extend the UCUM units using the same representation techniques. In addition to the practical utility of having a schema for this XML file, this allows other parties to extend the the UCUM UoM definitions with some formal assurances of correctness.

comment:3 Changed 9 years ago by Gunther Schadow

Description: modified (diff)

comment:4 Changed 9 years ago by Gunther Schadow

Milestone: Revision 1.9

This seems to be rather trivial, or at least what is left of it. I shall add a namespace to the ucum essence file and that is it. Schema is not necessary as it won't validate anything critical and we wouldn't use it, since nobody would edit the ucum-essence file (it is always generated from the spec.)

comment:5 Changed 8 years ago by Gunther Schadow

Description: modified (diff)
Resolution: fixed
Status: newclosed

comment:6 Changed 8 years ago by georg@tencknet.de

I'd like to add a point to this discussion, though it has been just closed: So far the description of units has been coded statically into the software implementing the UCUM standard, at least as far as I oversee it. Tell me if i'm wrong!

Using the XML together with a XSD would allow to dynamically update the units known to a tool without recompiling. I'm on that with JScience and jaxb though I did not finish it jet. Anyhow, one of the prerequisites to automatically build a parser conforming to the XML's document structure (not it's content!) is a schema file. Though I could help myself with a "self knitted" one, my impression was, that the ucum_essence.xml ist not that strongly typed as it could and should be! I agree to braeckel, that doing so has the chance to give the UCUM a kick "as an authority" as it'll make it easy to adopt amendments and corrctions from within exiting code!

Note: See TracTickets for help on using tickets.