By Sandra Schloen, August 2017; updated February 2018

Derived Variables, introduced in the Spring of 2017, provide additional property-based features that have a variety of uses. There are six official derivation Types that can be applied to variables – Aggregation, Definition, Calculation, Concatenation, Conversion, Selection, and Substitution – but they can be used in combination to create powerful effects. They are often used in conjunction with the auto-label feature of Predefinitions to derive names of new items. They might also be used as additional columns in Table View (see the Format Specification of a Set) to derive table values based on other properties (which themselves do not need to be included in the table). A few examples will illustrate some possibilities.

Selection

The simplest derivation type is that of Selection which allows you to use OCHRE's usual linking mechanism to create an ordered list of variables. OCHRE will search the item on which the derived property is applied for any of the variables, starting with the first one in the list and working down. When a value of a listed variable is found, OCHRE returns that value as the value of the derived variable. The value will be returned in the data type of the original value and formatted appropriately; e.g. as a link, or a date, etc.

derivedSelection.PNG

Concatenation

The simplest derivation type is that of Concatenation which can be used with Alphanumeric (String) Variables. This option lets you specify any combination of:
  • Hard-coded character strings
  • A few standard template values (that of [YY] or [YYYY] to represent the current year)
  • Intrinsic field values of the ‘self’ item, in particular [Name], [Abbreviation], and [Code]
  • Any number of property values of any properties on either the ‘self’ item or any of its ancestors
  • The + (plus-sign) which indicates that any hard-coded text preceding the plus-sign is only present if the value following the plus-sign is not blank

A recent excavation project collected faunal remains in paper bags to which a barcode label was affixed. The item was designated by a Location or object type of Faunal remains collection – a name much too long to print on a barcode label. These “bone bags” as they were known were represented by OCHRE database items inserted within the appropriate unit of excavation but they were not uniquely identified by the project. Rather, a derived variable was created which used the Concatenation technique to simply assign the hard-coded string “Bone”; this became the item’s Name when applied via an appropriate Predefinition. Simple enough, but worth it when you get it essentially for free with the Predefinition’s auto-label feature.
derived_ConcatBone.PNG

A Concatenation Formula may contain any of several templates that refer to intrinsic data of the item to which the formula is applied. These templates are entered in square brackets, valid options for which are [Name], [Abbreviation], and [Code].

A Concatenation Formula may also contain any number of variables linked in (using the hyperlink operator) from the Taxonomy. The value of the linked-in variable, as found on the item to which the formula is applied, or as found on any of its ancestors (if not found on the item itself), is substituted in for the linked-in variable.

derived_linkTaxItem.PNG

Here, for example, the "C" is hard-coded (representing a Ceramic item). The [YY] is an allowable template item representing the current 2-digit year ("17"). The Grid and Square are properties on an ancestor item within which this item is in context. They are joined by a hard-coded dot and followed by a hashtag symbol. The Registered C no. is a serial#-variable, a next-unique-value of which will be assigned to the item.

derived_ConcatFormula.PNG

This Variable, called Auto-label C#, is then specified as an auto-label option on a Predefinition. When the Predefinition is applied to an item, it will be auto-labeled with a Name generated by the formula, in this case something like: C17-65.42#1.

derive_autolabel.PNG

Here is a final Concatenation example of a derived variable used to auto-abbreviate an item using a Predefinition. Again, the Grid, Square, and Finegrid are properties on an ancestor item within which this item is in context. Note that they are joined by a dot and the plus-sign. This indicates, for example, that if the Finegrid is absent then omit the dot following the Square. The hard-coded U is a prefix for the property value of the variable Unit, found on the current item. The [Name] template item represents the Name of the item itself. Thus if this derived variable's Formula is applied to the Abbreviation of an item whose Name is MC123456, the derived Abbreviation would be something like: 92.33.U20 MC123456.

derived_templates.PNG


The remaining derivation types apply to numeric-Type variables, either Decimal or Integral.

Aggregation

One of our archaeology projects counts and weighs the Pottery body sherds according to common ware types found at the site. Each ware type that is tracked is inserted as a sub-item within the Pottery Pail item listing the Quantity and Weight of the representative pot sherds. A separate sub-item is used to tally and weigh the Diagnostic sherds.

derived_subitems.PNG

But in this case we let OCHRE calculate the Total sherd count for the Pail. Simply adding this derived Variable to the Properties of the Pottery Pail item triggers OCHRE calculation of its value. OCHRE checks the sub-items for instances of the listed Based on variables, and aggregates their values.

derived_aggregation.PNG

Notice that the resulting aggregate Value is displayed in a highlight color and is read-only; this is because the value is derived and therefore not editable.
derived_Total.PNG

Conversion

This option works just like Selection, described above, but then converts the resulting value to the units specified. Decimal or integer variables are expected here.
derive_conversion.PNG

Calculation

Use the Add-hyperlink-with-name option of the string-link tools (as shown for Concatenation above) to target selected variables from the Taxonomy to construct a new value based on a simple formula. The only operators currently supported are addition, subtraction, multiplication, and division. (Note that here the plus sign simply represents the addition operator and has no other special meaning.)
derivedCalc.PNG

Substitution

"Quantity, qualified" is a Variable used to describe Greek coin hoards when they are cataloged as having "a few", "some", or "a great many" coins in the hoard, for example. This type of qualified data would not normally be available for computational methods. But OCHRE gives the option of imputing a value for each of the qualifications and thus converts them to numeric equivalents which can be used, say, as input to a statistical process. By using the Substitution derivation option, the user can specify a numeric value to substitute in for each of the nominal/ordinal values of the property. Note that you need to own the values in your own project in order to give them imputed values using Substitution.

derived_substitution.PNG

Definition

The Definition derivation option provides a mechanism for quantifying phrases or clauses in a Text based on a chain of information that relates quantities and their measures, and provides OCHRE with the means to evaluate them. OCHRE will look up the definition of an implicated word -- one that represents a measure (e.g. "kurru" in the phrase "15 kurru") -- in the project Dictionary. On the Properties of its Dictionary entry, the predefined variable Measure will link to an appropriately defined Concept item that provides a Conversion factor reconciling the measure with the specified standard unit.

From the phrase or clause of a Text where the derived variable, here Measurement (l), is applied, OCHRE will search its subitems for a word that represents a measure (based on its dictionary definition) and a word that represents a number (based on its Type), and will calculate the appropriate value given in the specified standard units.

Here, for example, is the system of measures (Concept items) on which the derived variable is based ...

derivedDefn_measures.PNG

... where "kurru" is defined as a Concept item with a Conversion factor that indicates how it relates to the standard measure (LB volumetric measure) defined by this project:

derivedDefn_concept.PNG

(Note that the hierarchy LB Measures needs to be linked to OCHRE's master system of Measurements; contact the OCHRE Data Service to achieve this.)

Here is the Dictionary entry that is, by definition, a Measure (where Measure is the OCHRE predefined variable -- link this into the project's own Taxonomy). That is, by definition it is linked to an appropriate Concept item via the property Measure.

derivedDefn_dict.PNG

Finally, here is the derived variable itself:

derivedDefn.PNG

This, the derived variable Measurement (l), is the property that is applied to a phrase from a cuneiform Text. For an example of this see Summarizing Complex Units.