Units of measurement?

Arnold, Curt Curt.Arnold at hyprotech.com
Thu Jul 15 18:00:14 BST 1999


This has been a real problematic area in earlier attempts to transfer
engineering information between applications.  In a lot of the STEP
proposals (I'm not a STEP expert so please forgive any inaccuracies), there
was a desire/requirement/need to preserve exactly the user's specification
of the value that was done at the expense of engineering apps that primarily
just wanted the value in SI.  

Unfortunately, that meant that one had to include in the STEP file all the
unit strings and their conversion factors to some base unit (and hope the
file had some unit you could recognize as your base unit).  I gets really
complicated really quickly.  Like in your example, most people would
interpret mph as miles per hour, but somebody else could use it for meters
per hour (or metres per hour).  In complex dimensions, you could have
thousands of reasonable permutations (whether to use dots between units,
slashes or -1 for units in the denominator)

Since in the types of apps I deal with only a very small fraction of "data"
is user provided (and hence would have some value to preserve what the user
type) and most of it is calculated (typically in SI or close to SI units),
my approach is to have an attribute for the value in a fixed SI unit (and in
a schema world it would be associated with a datatype that specified the
unit) and if you want to preserve the users input then use the elements text
data.  So for speed it would be something like 

He was travelling at <Velocity value="1">3600 kph</Velocity>

where value is defined as always being in meters per second.  In schemas,
I'd have a velocity datatype that was defined as being in meters per second.

If you though it could add value, you could tag the unit.

<Velocity value="1">3600 <UnitRef href="#kph">kph</UnitRef></Velocity>

This also allows you to support really fuzzy user specified values that you
could never hope to resolve by parsing the human presentation.

You know how <Temperature value="289">cold it feels on a brisk fall
morning</Temperature>   

(289K, 16C, 59F for those of you who don't think that Kelvin is the
temperature unit of choice)


-----Original Message-----
From: Ronald Bourret [mailto:rbourret at ito.tu-darmstadt.de]
Sent: Thursday, July 15, 1999 2:55 AM
To: 'XML Dev'
Subject: RE: Units of measurement?


Jeffrey E. Sussna wrote:

> Does the XSchema datatypes spec support the notion of units of 
measurement?
> In other words:
>
> 	element "x" is of type "speed", which can be in "mph" or "kph"
>
> A potential representation of this might be:
>
> 	<x units="mph">200</x>

Sort of.  What you can actually do is define a speed data type and say that 
the *units* attribute (not the x element) is of type speed -- that is, its 
value is either "mph" or "kph".  You can also say that the x element must 
have a units attribute.

Note that you can also do this specific example with DTDs, by defining 
units as an attribute with an enumerated type.

(Nit: XSchema is the name of the predecessor of DDML. I believe you are 
referring to XML Schemas -- the schema language being developed by the W3C. 
 Given the amount of confusion over these names, I'm beginning to wonder if 
we shouldn't donate the XSchema name to the W3C...)

-- Ron Bourret


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN
981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list