Ajutor:How can i relate my type to the correct SI unit?
Units of measurement can be specified for data types. For instance, the Type:Velocity
can be could have the unit km/h. SMW provides a special attribute for this task. The article for Type:Velocity
should contain the following line:
[[corresponds to:=1 km/h]]
For now, "km/h" is only an arbitrary string without a meaning. A reasoning system like Aura has to understand these units, so the unit has to be specified as SI unit:
[[corresponds to SI := 0.27777778 m/s]]
Such a definition must appear at most once on a page.
An SI definition consists of a conversion factor (with respect to the primary unit - the one with corresponds to = 1...
) and the unit expression.
The unit expression is a division of products of SI base units with an optional exponent. There must be at least the enumerator and an optional denominator. Products are written with * or blank. Exponents are introduced by ^, followed by a positive or negative integer.
The SI base units are:
-
m
- Meter -
kg
- kilograms -
s
- Second -
A
- Ampere -
K
- Kelvin -
mol
- Mole -
cd
- Candela
Examples:
-
m
- Meter -
m^2 = m*m = m m
- Square meter -
m/s
- meters per second -
m/s^2 = m*s^-2 = m s^-2
- Acceleration -
kg*m/s^2 = kg m /s^2 = kg m s^-2
- Newton -
1/s = s^-1
- Hertz
To test the parser, create a page for a new type e.g. <code>Type:Velocity</code>. The following text is semantical nonsense but contains several test cases for the parser:
[[corresponds to:=1 m/s]] [[corresponds to:=3.6 km/h]] [[corresponds to SI:=1 m]] [[corresponds to SI:=1 m/s]] [[corresponds to SI:=1 1/s]] [[corresponds to SI:=1 m*m*m/s*s*s]] [[corresponds to SI:=1 m*m*m^-1/s*s*s^-1]] [[corresponds to SI:=1 s^-1]] [[corresponds to SI:=1 s^-1/m^-1]] [[corresponds to SI:=1 m^2/s^2]] [[corresponds to SI:=1 m*kg/s^2]] [[corresponds to SI:=1 m kg/s^2 A]] [[corresponds to SI:=1 m*kg/s^2*A*cd]] [[corresponds to SI:=1 m^0]] [[corresponds to SI:=1 s/1]] [[corresponds to SI:=1]] [[corresponds to SI:=1meter/sec]] [[corresponds to SI:= m/s]] [[corresponds to SI:=1 M/S]] [[corresponds to SI:=1 m//s]] [[corresponds to SI:=1 m/m/s]] [[corresponds to SI:=1 m**m/s**s]] [[corresponds to SI:=1 m*m*m/m*m*m]]