Conversion-enabled Variables

By Sandra Schloen, May 2016
Updated July 2022

Numeric data is represented in OCHRE by variables which are defined to be of the Type "decimal" or "integer." Typically numeric data is expressed in terms of a unit of measurement, say meters, centimeters or millimeters for Length, or grams for Weight. This is simple enough in theory, but in practice things tend to get complicated. Perhaps the pottery specialist has measured the preserved length of potsherds on a centimeter scale; the faunal expert has measured the preserved length of bones in millimeters, and the field excavator has measured the length of walls in meters. Formerly this has required three separate variables which we would typically denote as Length (cm), Length (mm), and Length (m). Even more problematic is trying to compare numeric data across projects or data sets where different units of measure have been used for similar measurements. For example, if faunal data were to be measured using centimeters in one project and using millimeters in another, any comparisons between the two projects would not be valid.

To address this issue, the OCHRE master project has set up a system of Measurements in the Concepts category which is available to all OCHRE projects. Using the International System of Units (SI) as our guide we have established standard base units, like Meter for length and Kilogram for mass, along with a compatible set of derived units which know how to convert themselves into base units using a specified Conversion factor. Any Variable based on a standard unit is said to be conversion-enabled as to its units because its values can be entered using any of the related units, and they will automatically convert into standard units. That is, if the conversion-enabled variable of Length is used (based on meters) a user can enter as a value "10 cm" or "5 mm" or simply "5" which will default to meters. Note that related units are organized hierarchically within the appropriate standard unit in the OCHRE master list.

Creating a Conversion-enabled Variable

To set up a variable that is conversion-enabled as to its units, simply create a numeric variable in the usual way and indicate on which of the standard units it is based. This should be set to either Meter (for length/distance), Kilogram (for weight/mass), or Liter (for volume). Choosing Meter, for example, lets you add values as mm, cm, km, as well as m.

We are expecting that this will cut down on the variety of variables that will be needed. A single, generic Length variable, for example, can accommodate a wide range of all things measured in meters, centimeters, millimeters, and even feet or inches (e.g. legacy data). Of course a project will need additional variables for less generic types of measurements -- "Distance from the sea" or "Rim diameter" -- but in each case only one variable will be needed to cover all variations of the unit.

You are also free (encouraged!) to use variables that have already been set up in the OCHRE master project. They can be found in OCHRE under Property variables, Metrics, Conversion-enabled variables and can be linked into your own project's Taxonomy in the usual way. If you would like us to add new variables to be shared from our master list, please email us and we will be happy to do so.

Data Entry Using a Conversion-enabled Variable

When entering numeric data as the Value of a conversion-enabled Variable, the numeric value will be considered to be represented by the relevant standard unit unless otherwise specified. For example, if the user enters "5" as the Length of an item it will be assumed that this is "5 m".

To override the standard unit default on data entry, simply enter the numeric value along with an approved compatible unit; for example, "5 cm". Approved units are those that match either the full name of the Variable as listed in the OCHRE Measurements hierarchy, or any of its abbreviations. If a unit other than the base unit is specified, this also has the effect of changing the default unit going forward for the current session. That is, if a user enters a Length of "5 cm" and saves this value for the current item, on the next item if the user enters "6" it will be assumed that this is "6 cm" (having established a new default unit). To revert to the default base unit simply provide it explicitly, e.g. "0.1 m".

By way of explanation, under the hood OCHRE will retain the data as it was entered so as not to lose the original content. But it will also calculate the equivalent standard value on-the-fly and will save this as well (as a ghosted value not visible to the user). This standard value is then available to be used for comparisons and calculations that require values to be normalized into values of same units. If the original value is edited the compatible standard value will also be updated; the two will always stay in sync.

Querying Using Conversion-enabled Variables

Conversion-enabled variables participate very naturally in OCHRE queries in the usual way. Specify the units if needed, e.g. Length is greater than 5 cm, or omit the units altogether to query based on the standard unit. OCHRE will do the necessary conversions and comparisons behind the scenes and will report all results whether they were originally entered in centimeters, meters, millimeters, or even inches.

Other Uses of Conversion-enabled Variables

Having originally conceived of the use of Conversion-enabled variables for managing measurements, we are finding it to be extremely useful for managing currencies as well, both modern and ancient. One of our projects that tracks the sale of ancient artifacts on modern-day markets can enter price-based data as USD, EUR or GBP, depending on the source of the sale. Another project studying the coins found in hoards all over the Greek world tracks currencies based on staters and tetradrachms. This is obviously a more complex usage since currency values fluctuate with respect to other currencies over time. But the basic strategy works well, and we are working on ways to dynamically adjust the relevant conversion factors as needed in different circumstances (e.g. on a query or view).

Using Conversion-enabled Variables Offline

Conversion-enabled variables are available for use offline. OCHRE will determine whether or not they are being used and will take along any supporting details it needs for the offline session. The standard Measurements hierarchy from the OCHRE master project does not need to be included in the offline session.