Name

define — defines inventory fields and variables

Synopsis

Content Model

	    <define> = EMPTY

	    

Attributes

NameTypeDefault
fieldString: field name used in ForestModel REQUIRED
columnExpression based on values in the inventory None
constantString of values that will always appear in the field None

Description

The <define> element is essential in making a link to database attribute values of the original forest inventory. Once the column values have been defined to the ForestModel they can be used in various select statements throughout the XML file.

The <define> element is an EMPTY tag meaning it is not allowed to wrap any other elements, it must exist on its own (<define attribute=" "/>). This element must occur near the beginning of the ForestModel, as input fields and columns must be identified before select statements can be made. The number of define elements used depends on the number of columns in the input inventory and the number of fields that need to be defined for use in the ForestModel (see field attribute below). The constant attribute can define a string or numeric literal. Values cannot be assigned to a constant field later in the file.

Empty fields play a useful and essential role in the ForestModel by providing a location for values to be temporarily assigned and used in subsequent select statements. If making a link to an inventory column, the field name need not be the same as the inventory column name. Field is the name used in the ForestModel... that's all! Field is a required attribute and must be defined each time the define element is used.

These extra columns can be used to further sub-divide statum temporarily in various select statements to keep track of various 'possibilities'. This is most apparent and essential for treatment options and the resulting products. A treatment select statment will assign a stratum a particular treatment type temporarily to match another product select statemnent. With multiple treatments, the same statum could be assigned a number of 'treatments' temporarily in the extra field to find all the products that would result from all the' possible' treatment types.

Parents

These elements contain define: ForestModel.

Children

The following elements can occur in define: NONE

Attributes

field

The field attribute defines the name of the fields to be used in the ForestModel that either match the inventory column names or are empty 'helper' fields. Field names must be alpha-numeric and start with a letter or underscore character.

column

The column attribute is an expression that uses a field from the inventory record.

constant

Constants are string or numeric literal values. These fields cannot be updated by assign elements, and are not used as stratification values. The may be used wherever the Patchworks query language is used, including in query statements and expressions that provide attribute values.

The following is a simple example where a constant field has been defined to contain the management unit as a string. If the XML file is to be re-purposed to another management unit then only this define element has to be changed, not every instance of the management unit throughout the file.

  <define field="unit" constant="'C5'"/>
		  

Next is a 'list' example. Stratification value query expressions can check if strata codes match to any of the values in the list by using the 'in' operator. A change to the definition of managed (perhaps to include another code) only requires a single modification to this <define> statement.

  <define field="managed" constant="'ifm,limited'"/>
	

See Also

assign, input, treatment.

Examples

In the following example the first 5 fields have been assigned expressions that evaluate columns in the original forest inventory. The 6th field has no initial value, and will be used has been record the currently applied treatment. The final 5 define statements establish constants that may be refereed to by name elsewhere in the model.

  <define field="MU" column="MU" />
  <define field="OWNER" column="OWNER" />
  <define field="FU" column="FU" />
  <define field="IFM" column="IFM" />
  <define field="SILVINT" column="INTENSITY" />
  <define field="treatment" />
  <define field="managed" constant="'ifm,limited'" />
  <define field="unmanaged" constant="'unmanaged,retained'"/>
  <define field="ifm" constant="'ifm'" />
  <define field="InitialShelterwood" constant="'Prsnt,Regrowth'" />
  <define field="unit" constant="'C5'"/>
	  

The 'treatment' field is used to find the resulting products when different treatment types are assigned to the same stratum. For example:

  <select statement="MU eq 'unit' and FU eq 'BW1' and IFM in managed and SILVINT eq 'Prsnt'">
    <track>
      <treatment label="Exten" minage="60">
        <produce>
          <assign field="treatment" value="'Exten'" />
	    

In the last line of the above example we can see that our empty field 'treatment' has been assigned the value 'Exten'. This assignment is temporary and only persists for the search for product values. This new stratum can than be tested against product select statements to identify the products that would result from this treatment.