# Presentation: 111076

## Units Markup Language (UnitsML)

**Open Forum 2003 on Metadata Registries**
***4:15 - 4:45 pm***
***Wednesday, January 22, 2003***

- Bob Dragoset
- National Institute of Standards and Technology

## Outline

- Introduction
- Background information on units and quantities
- UnitsML
- Instance documents for SI units
- XML schema for measurement units markup
- Repository containing measurement unit information
- XML schema for repository submissions
- Will offer to publish in NIST XML registry/repository
- Issues
- Future

## Introduction

- Units Markup Language (UnitsML) is a proposed method of representing scientific units of measure in XML.
- Original motivation for this project came from initial effort by Frank Olken and John McCarthy of the Lawrence Berkeley National Laboratory (LBNL).
- Collaborators:
- Barry Taylor (NIST,emeritus)
- Michael McLay (NIST)
- Frank Olken (LBNL)
- Peter Murray-Rust (CML - Chemical Markup Language)
- Funded in part by NIST's Systems Integration for Manufacturing Applications (SIMA) program.
- http://www.nist.gov/sima

## Introduction (cont.)

**VISION**
- XML schema(s) available for incorporating UnitsML into XML documents for encoding scientific units of measure.
- Extensive XML repository containing schemas and information on units, quantities, prefixes.
- Design of schemas and repository to facilitate unit information processing:
- validating documents for self-consistent usage of units, quantities, and prefixes
- unit conversion and manipulation

## Background Information on Units and Quantities

## 7 SI Base Units& Quantities

| Unit Name | Unit Symbol | BaseQuantity | Quantity Symbol | Dimension Symbol |
| --- | --- | --- | --- | --- |
| meter | m | length | l | L |
| kilogram | kg | mass | m | M |
| second | s | time | t | T |
| ampere | A | electric current | I | I |
| kelvin | K | thermodynamic temperature | T | Θ |
| mole | mol | amount of substance | n | N |
| candela | cd | luminous intensity | Iv | J |

**Examples:*** **	**l* = 7.24 m	 *v* = 6.32 m/s
*	**m* = 1.53 kg	 dim *v* = **L T****-1**

**SI defines **
**7 base units**

## 22 SI Special Derived Units

| Derived quantity | Special name | Special Symbol | Expression in terms of |  |
| --- | --- | --- | --- | --- |
|  |  |  | other SI units | SI base units |
| plane angle | radian | rad |  | m · m-1 = 1 |
| solid angle | steradian | sr |  | m2 · m-2 = 1 |
| frequency | hertz | Hz |  | s-1 |
| force | newton | N |  | m · kg · s-2 |
| pressure, stress | pascal | Pa | N/m2 | m-1 · kg · s-2 |
| energy, work, quantity of heat | joule | J | N · m | m2 · kg · s-2 |
| power, radiant flux | watt | W | J/s | m2 · kg · s-3 |
| electric charge, quantity of electricity | coulomb | C |  | s · A |
| electric potential, potential difference, electromotive force | volt | V | W/A | m2 · kg · s-3 · A-1 |
| capacitance | farad | F | C/V | m-2 · kg-1 · s4 · A2 |
| electric resistance | ohm | Ω | V/A | m2 · kg · s-3 · A-2 |
| electric conductance | siemens | S | A/V | m-2 · kg-1 · s3 · A2 |

## 22 SI Special Derived Units (cont.)

| Derived quantity | Special name | Special Symbol | Expression in terms of |  |
| --- | --- | --- | --- | --- |
|  |  |  | other SI units | SI base units |
| magnetic flux | weber | Wb | V · s | m2 · kg · s-2 · A-1 |
| magnetic flux density | tesla | T | Wb/m2 | kg · s-2 · A-1 |
| inductance | henry | H | Wb/A | m2 · kg · s-2 · A-2 |
| Celsius temperature | degree Celsius | °C |  | K |
| luminous flux | lumen | lm | cd · sr | cd · sr |
| illuminance | lux | lx | lm/m2 | m-2 · cd · sr |
| activity (of a radionuclide) | becquerel | Bq |  | s-1 |
| absorbed dose, specific energy (imparted), kerma | gray | Gy | J/kg | m2 · s-2 |
| dose equivalent, et al. | sievert | Sv | J/kg | m2 · s-2 |
| catalytic activity | katal | kat |  | s-1 · mol |

- There are also many derived quantities with units without special names; e.g., the quantity **area** has units of **m****2**.

## UnitsML

- Example instance documents for unit markup
- Complex instance document illustrating an XML schema for measurement units markup

## Instance Documents

**Simple Examples, i.e., contains base SI units:**
- 1.	 <physicalQuantity name="tableLength">**1.75 m**</physicalQuantity>
- 2.	<physicalQuantity name="tableLength">
- 		<value>**1.75**</value>
- 		<units>**m**</units>
- 	</physicalQuantity>
- 3.	<physicalQuantity name="tableMass" value="**18.5**" units="**kilogram**" />

**Not so simple example, i.e., contains derived units:**
- 4.	<physicalQuantity name="specialAcceleration">
- 		<value>100</value>
- 		<units>**mm·μs^-2**</units>
- 	</physicalQuantity>

- Why not use MathML to markup these units?

## Complex Instance Document

**Usage within a document:**
- <physicalQuantity	name="specialAcceleration"
- 	value="100"
- 	unitIDRef="millimeterPerMicrosecondSquared" />

**Definition within a document:**
- <derivedUnit	 unitID="millimeterPerMicrosecondSquared"
- 			quantityRef="acceleration">
- 	<unitsML:units>
- 		<unit name="meter" prefix="milli" power="1" system="SI" />
- 		<unit name="second" prefix="micro" power="-2" system="SI" />
- 	</unitsML:units>
- </derivedUnit>

- Alternatively, one could use unit & prefix symbols rather than unit & prefix names.

## XML Repository

- Detailed instance documents and graphics representing an XML schema for repository submissions and extractions.

## Repository Hierarchy

- http://unitsml.nist.gov/version
- 	/units/SI/base
- 	/units/SI/specialDerived
- 	/units/SI/coherentDerived
- 	/units/customary
- 	/quantities
- 	/prefixes/SI
- 	/prefixes/binary
- 	/symbols/units
- 	/symbols/prefixes
- 	/symbols/quantities
- 	/symbols/dimensions
- 	/tools

- No expected submissions for prefixes.

## Defined Namespaces

- Units
- xmlns:SI	="http://units.nist.gov/2003/01/units/SI"
- xmlns:cu	="http://units.nist.gov/2003/01/units/customary"
**...**
- Prefixes
- xmlns:pre	="http://units.nist.gov/2003/01/prefixes"
- Quantities
- xmlns:q	="http://units.nist.gov/2003/01/quantities"
- Symbols
- xmlns:usym	="http://units.nist.gov/2003/01/symbols/units"
- xmlns:psym	="http://units.nist.gov/2003/01/symbols/prefixes"
- xmlns:qsym	="http://units.nist.gov/2003/01/symbols/quantities"
- xmlns:dsym	="http://units.nist.gov/2003/01/symbols/dimensions"

- May use "href"s rather than namespaces,(other than a single, default UnitsML namespace).This is really a processing issue.

## UnitsML Schema Diagram

## UnitsML Schema Diagrams - unit -

- UnitsML Schema Diagrams **- unit -**

## Details of a Single SI Base Unit- Meter -

- <units	xmlns="http://units.nist.gov/2003/01/units/SI"
- 			xmlns:q="http://units.nist.gov/2003/01/quantities"
- 			xmlns:usym="http://units.nist.gov/2003/01/symbols/units" >
- 	<unit  commonName="**meter**"  unitID="**unit0001**" symbol="**m**">
- 		<system type="base">SI</system>
- 		<name xml:lang="en-US" >**meter**</name>
- 		<name xml:lang="en-GB" >**metre**</name>
- 		<name xml:lang="fr" >**mètre**</name>
- 		<unitSymbolRef unitSymbolIDRef="usym:symbol0001">m</unitSymbolRef>
- 		<quantityRef  quantityIDRef="**q:quantity0001**" />
- 		<**history** href="http://...">*...*</history>
- 		<**definition** href="http://...">*...*</definition>
- 		<**remarks** href="http://...">...</remarks>
- 	</unit>
- </units>

## UnitsML Schema Diagrams- quantity -

- UnitsML Schema Diagrams**- quantity -**

- No "system" element!
- How do we handle repository submissions for domain specific quantities, e.g., slew rate?

## Quantities for 7 Base UnitsXML Repository

- <quantities	xmlns="http://units.nist.gov/2002/01/quantities"
- 	 			xmlns:qsym="http://units.nist.gov/2002/01/symbols/quantities"
- 				xmlns:dsym="http://units.nist.gov/2002/01/symbols/dimensions" >
- <quantity quantityID="**quantity0001**" 	commonName="**length**"	type="base">
- 		<name xml:lang="en-US">length</name>
- 		<quantSymRef	**quantSymbolIDRef**="qsym:symbol0001">l</quantSymRef>
- 		<dimSymRef	**dimSymbolIDRef**="dsym:symbol0001">L</dimSymRef>
- 		<unitSIRef	unitSIIDRef="SI:unit0001" />
- 	</quantity>
- 	<quantity name="mass"			symbol="***m***"	dimensionSymbol="**M**" />
- 	<quantity name="time"			symbol="***t***"	dimensionSymbol="**T**" />
- 	<quantity name="electric current"		symbol="***I***"	dimensionSymbol="**I**" />
- 	<quantity name="thermodynamic temperature"	symbol="***T***"	dimensionSymbol="**Θ**" />
- 	<quantity name="amount of substance"		symbol="***n***"	dimensionSymbol="**N**" />
- 	<quantity name="luminous intensity"		symbol="***I*****v**" 	dimensionSymbol="**J**" />
- </quantities>

## Special Derived UnitsXML Repository - Examples

- <units system="SI"	xmlns="http://units.nist.gov/2002/01/units/SI"
- 				xmlns:usym="http://units.nist.gov/2002/01/symbols/units" >
- 	<unit type="specialDerived" commonName="**joule**" symbol="**J**" unitID="**unit0060**" >
- 		<unitRef unitIDRef="newton" power="1" />
- 		<unitRef unitIDRef="meter" power="1" />
- 		<symbolRef  unitSymbolIDRef="usym:symbol0060" />
- 	</unit>
- 	<unit type="specialDerived" commonName="**volt**" symbol="**V**" unitID="**unit0070**" >
- 		<unitRef unitIDRef="watt" power="1" />
- 		<unitRef unitIDRef="ampere" power="-1" />
- 		<symbolRef  unitSymbolIDRef="usym:symbol0070" />
- 	</unit>
- 	<unit type="specialDerived" commonName="**radian**" symbol="**rad**" unitID="**unit0080**" >
- 		<unitRef unitIDRef="meter" power="1" />
- 		<unitRef unitIDRef="meter" power="-1" />
- 		<symbolRef  unitSymbolIDRef="usym:symbol0080" />
- 	</unit>
- </units>

- N · m
- m2 · kg · s-2

- W/A
- m2 · kg · s-3 · A-1

- m · m-1 = 1

## Quantities for Special Derived UnitsXML Repository

- <quantities
- 		xmlns="http://units.nist.gov/2002/01/quantities"	 				xmlns:qsym="http://units.nist.gov/2002/01/symbols/quantities"
- 		xmlns:SI="http://units.nist.gov/2002/01/units/SI" >
- 	<quantity quantityID="**quantity0050**" commonName="**energy**" type="**derived**">
- 		<name xml:lang="en-US">energy</name>
- 		<quantSymRef quantSymbolIDRef="qsym:symbol0100" />
- 		<unitSIRef unitSIIDRef="SI:unit0060" />
- 	</quantity>
- 	<quantity name="work"	unit="**joule**" />
- 	<quantity name="quantityOfHeat"	unit="**joule**" />
- 	<quantity name="voltage"	unit="**volt**" />
- 	<quantity name="electricPotential"	unit="**volt**" />
- 	<quantity name="electricPotentialDifference"	unit="**volt**" />
- 	<quantity name="electromotiveForce"	unit="**volt**" />
- 	<quantity name="electricTension"	unit="**volt**" />
- 	<quantity name="planeAngle"	unit="**radian**" />
- </quantities>

***V*****emf**

***V***

## SI Coherent Derived UnitsXML Repository?

- <units xmlns="http://units.nist.gov/2002/01/units/SI" >
- 	<unit commonName="**squareMeter**" unitID="**unit1000**" symbol="**m^2**">
- 		<system type="derived">SI</system>
- 		<name xml:lang="en-US">square meter</name>
- 		<unitRef unitIDRef="unit0001" power="2"/>
- 	</unit>
- 	<unit commonName="**meterPerSecond**" unitID="**unit1010**" symbol="**m/s^-1**">
- 		<system type="derived">SI</system>
- 		<name xml:lang="en-US">meter per second</name>
- 		<unitRef unitIDRef="unit0001" />
- 		<unitRef unitIDRef="unit0003" power="-1"/>
- 	</unit>
- </units>

- To what extent will the repository be populated with coherent derived units and their associated symbols?

## Quantities for SI Coherent Derived Units

- <quantities system="SI"	xmlns="http://units.nist.gov/2002/01/quantities"
- 	 		xmlns:SI="http://units.nist.gov/2002/01/units/SI" >
-   <quantity	commonName="**area**"	commonUnit="**squareMeter**"	symbol="***A***"
- 		quantityID="quantity1000" >
- 	<unitSIRef   unitSIIDRef="SI:unit1000" />
-   </quantity>
-   <quantity	commonName="**speed**"	commonUnit="**meterPerSecond**" />
-   <quantity	commonName="**velocity**"	commonUnit="**meterPerSecond**" />
- </quantities>

- Adding symbols for derived quantities may be too ambitious!
- Quantity symbols are not unique.
**Example:** Velocity is a vector quantity. In the English language, the magnitude of velocity is usually called speed. The symbols for velocity include *υ* and *c*. Also, the notation *u*, *υ*, *w* are recommended for the components of a velocity.
**Example: **The symbols for plane angle include , , , , , ....

## UnitsML Schema Diagrams- prefix -

## SI PrefixesXML Repository

- <prefixes 	xmlns="http://units.nist.gov/2002/01/prefixes"
- 			xmlns:psym="http://units.nist.gov/2002/01/symbols/prefixes">
- 	**...**
- 	<prefix prefixID="**prefix0004**" commonName="**mega**" symbol="**M**"
- 			power="**6**" system="**SI**" base="**10**">
- 		<name xml:lang="en-US" >mega</name>
- 		<prefixSymbolRef  prefixSymbolIDRef="psym:symbol0004" />
- 	</prefix>
- 	<prefix		name="kilo"	symbol="k"	power="3" />
- 	<prefix		name="hecto"	symbol="h"	power="2" />
- 	<prefix		name="deka"	symbol="da"	power="1" />
- 	<prefix		name="deci"	symbol="d"	power="-1" />
- 	<prefix		name="centi"	symbol="c"	power="-2" />
- 	<prefix		name="milli"	symbol="m"	power="-3" />
- 	<prefix		name="micro"	symbol="μ"	power="-6" />
- 	**...**
- </prefixes>

- Not 7-bit ASCII,
- but Unicode

- deka (U.S.)
- deca (U.K.)

## Binary PrefixesXML Repository

- <prefixes	xmlns="http://units.nist.gov/2002/01/prefixes"
- 				xmlns:psym="http://units.nist.gov/2002/01/symbols/prefixes" >
- 	<prefix prefixID="**prefix0050**" commonName="**kibi**" symbol="**Ki**"
- 				power="**10**" system="**binary**"  base="**2**" >
- 			<name xml:lang="en-US" >kibi</name>
- 			<symbolRef   prefixSymbolIDRef="psym:symbol0050" />
- 	</prefix>
- 	<prefix		name="mebi"	symbol="Mi"	power="20" />
- 	<prefix		name="gibi"	symbol="Gi"	power="30" />
- 	<prefix		name="tebi"	symbol="Ti"	power="40" />
- 	<prefix		name="pebi"	symbol="Pi"	power="50" />
- 	<prefix		name="exbi"	symbol="Ei"	power="60" />
- </prefixes>

- For information storage and transfer

## UnitsML Schema Diagrams- symbols -

- UnitsML Schema Diagrams**- symbols -**

## Unit & Prefix SymbolsXML Repository

- <symbols>
- 	<unitSymbols	xmlns="http://units.nist.gov/2002/01/symbols/units" >
- 		<unitSymbol	unitSymbolID="**symbol0001**"	commonSymbol="**m**">
- 			 <symbolFont family="serif" style="normal" weight="normal">m</symbolFont>
- 		</unitSymbol>
- 	</unitSymbols>
- 		...
- 	<prefixSymbols	xmlns="http://units.nist.gov/2002/01/symbols/prefixes" >
- 		<prefixSymbol	prefixSymbolID="**symbol0001**"	commonSymbol="**m**">
- 			 <symbolFont family="serif" style="normal" weight="normal">m</symbolFont>
- 		</prefixSymbol>
- 	</prefixSymbols>
- </symbols>

- m

- m

## Quantity & Dimension SymbolsXML Repository

- <symbols>
- 	<quantitySymbols	 xmlns="http://units.nist.gov/2002/01/symbols/quantities">
- 		<quantitySymbol quantitySymbolID="**symbol0001**" commonSymbol="**l**">
- 			<symbolFont family="serif" style="italic" weight="normal">l</symbolFont>
- 		</quantitySymbol>
- 		<quantitySymbol quantitySymbolID="**symbol0007**" commonSymbol="**I_v**">
- 			<symbolFont family="serif" style="italic" weight="normal">I</symbolFont>
- 			<symbolFont family="serif" style="normal" weight="normal"
- 					position="sub">v</symbolFont>
- 		</quantitySymbol>
- 	</quantitySymbols>
- 		...
- 	<dimensionSymbols	 xmlns="http://units.nist.gov/2002/01/symbols/dimensions" >
- 		<dimensionSymbol dimensionSymbol ID="**symbol0001**" commonSymbol="**L**">
- 			<symbolFont family="sans-serif" style="normal" weight="bold">L</symbolFont>
- 		</dimensionSymbol>
- 		<dimensionSymbol dimensionSymbol ID="**symbol0005**" commonSymbol="**Θ**">
- 			<symbolFont family="sans-serif" style="normal" weight="bold">Θ</symbolFont>
- 		</dimensionSymbol>
- 	</dimensionSymbols>
- </symbols>

*l*

**L**

*I*v

**Θ**

- An alternative markup scheme would be to use the presentation mode of MathML.

## UnitsML XML Schema

## Issues

- Unit, prefix, and quantity names are not standardized internationally (e.g., meter vs metre vs mètre).
- Solution: Inclusion of more than U.S. English spellings of names.
- Symbols often require special fonts and characters(e.g., unit **°C**, prefix **μ**,*** ***and quantity ***V*****emf**** **).
- Notation for symbol representation: HTML/CSS and/or MathML.
- Symbols are not available (or not standardized internationally) for all units or quantities.
- E.g., there is no defined symbol in SI for nautical mile.
- Many quantities, units, and symbols are not unique and will be domain specific. Examples:
- “ ***t****** ***” is the quantity symbol for **time** and **Celsius temperature**.
- “ ***"*** ” is a unit symbol for the **second** (plane angle) and **inch**.
- “**second**” is a unit name for **time** and **plane angle**.
- Note that symbols and names may be able to be distinguished by unit system or hierarchy (must manage namespaces).

## Issues (Cont.)

- If the user community is dependent upon our repository, how do we insure its constant availability?
- Solutions: Mirroring/caching and/or portable dictionaries.
- Various (e.g., ISO, IEC) existing hierarchies for quantity names and symbols.
- Inclusion of dimensions of quantities(e.g., velocity, **LT**-1; force, **LMT**-2).
- Dimensions of SI base quantities: **L**, **M**, **T**, **I**, **Θ**, **N**, and **J**.
- Identify/develop appropriate tools for use with UnitsML.
- Units editor for generating markup.
- Software library for manipulating units.
- Software to validate user defined units against repository.
- Education on use of units:Quantities should not be mixed with units.
- flux = 100 neutrons/second
- neutron flux = 100/second

## Processing Issues

- SI Base unit “kilogram” is a combination of the prefix “kilo” and the unit “gram.”
- If prefixes are applied at different “levels,” multiple prefixes (e.g., millikilometer) could occur. Possible solutions:
- Allow prefixes at only one level.
- Combine prefixes (e.g., millikilometer = meter).
- Convert leading prefixes to multiplier	(e.g., millikilometer = 10-3 kilometer).
- Note: A prefix + unit can imply measurement range (e.g., kV/μs vs. GV/s).
- Unit representation in symbolic manipulation in calculations.
- Units can be represented in the 7 SI base units, which is particularly useful when combining units in an equation. However, final representation of units may be more practical in special derived units. (e.g., m2 · kg · s-2 = N · m ).
- There are multiple representations for special derived units.
- 	(e.g., V = W / A =  · A ).

## Future

- Publish prototype schemas on website.
- Solicit industry/organization/government input.
- e.g., ebXML, Agilent, ISO, IUPAC, ANSI, IEEE, ASTM, ASME, APS, ACS, DISA, EPA, DoE, NASA, DoD, NIH, NSF
- Contact W3C and/or OASIS about activity.
- Revise schemas to allow:
- SI derived units
- non-SI units, with conversion to SI units
- Create units repository, including SI, IEC, and"inch-pound" units.
- Create portable dictionaries or mirror sites.
- Draft paper.
- Develop useful tools.
- unit conversion utility
- UnitsML editor, e.g., plug-in for Amaya
- XSLT & XSL-FO rules

## For More Information

- Bob Dragoset
- National Institute ofStandards and Technology
- dragoset@nist.gov
- http://unitsml.nist.gov