4 Querying

4.1. Overview

As described in Chapter 3, each GEOREFERENCE WINDOW maintains a Site List. The Site List is a list of georeferenced data sites that meet the current query parameters. Current query parameters are defined in terms of three concepts:
  1. Query Region: A geographic region specified in terms of latitude and longitude.
  2. Query Expressions: Each georeferenced data category has a Query Expression. A Query Expression is an expression that results in a subset of data sites for a particular georeferenced data category (such as tree ring or ice core).
  3. Reconstructed Variables Only: If you selected this checkbox in the DATA SELECTION dialog, only sites with reconstructed variables are included in the Site List.
You can change the query expression for a given category of data to control what data is displayed through the GEOREFERENCE QUERY dialog. To display the GEOREFERENCE QUERY dialog, select the Query Button from the Georeference' Window.
When you open the query dialog, at the top of the dialog is a list of the categories of data that were selected for this georeference window. Selecting one of the categories will result in a list of variables associated with this category being displayed in the center of the dialog. For querying, numeric variables are not a single value. A variable for a site is a package of two values - a minimum and a maximum value. These values are the minimum and maximum values of that variable for a particular site. By default, all variables are displayed (non-reconstructed and reconstructed). The checkbox below the variable list can be used to change the display to only reconstructed variables.
Clicking on a variable in the variable list causes the variable name to be placed in the expression box at the bottom of the dialog. The variable is surrounded by brackets ( [] ). The brackets distinguish between the variable names and other symbols in the expression. It is possible to type directly into the expression box, especially to backspace over mistakes.
To the right of the variable list is a group of buttons with operation symbols. These buttons are used to place operations in the expression box. There are 13 operations. These are:
  1. + (plus)
  2. - (minus)
  3. * (multiplication)
  4. / (divide)
  5. < (less than)
  6. <= (less than equal to)
  7. > (greater than)
  8. >= (greater than equal to)
  9. = (equal to)
  10. <> (not equal to)
  11. AND
  12. OR
  13. NOT
Variables and operations can always be typed directly into the expression box. The click to insert functions from the variable list and operation buttons is only for convenience for the user. Clicking to insert does not guarantee that the expression is correct. An expression can be built completely from clicking to insert and still produce syntax errors.
Parenthesises can be used to group parts of the expression to circumvent operator precedence. (See Appendix B for default operator precedence). Operators AND, OR, and NOT are preceded and followed by periods in the expression to distinguish these operators from strings and variable names.
Numbers and operators work just like the common calculator. Variables, on the other hand, have special rules about how they interact with operations and other types of operands. A variable is a package, a min/max pair. When a numeric value (integer or float value) is added to a variable, the value is added to both the min and max value of the variable. For example, a variable Age can have a minimum value of 10 and a maximum value of 100. The expression "[Age] + 5" would result in a variable with a minimum value of 15 and a maximum value of 105. All of the numeric operators (+, -, *, /) work similarly. Relational operators are the most useful operators. The rules for applying the relational operators to variables follows:
  • Variable < value returns if value > Variable.min
  • Variable > value returns if value < Variable.max
  • value < Variable returns if value < Variable.max
  • value > Variable returns if value > Variable.min
  • Variable1 > Variable2 returns if Variable1.max > Variable2.min
  • Variable1 < Variable2 returns if Variable1.min < Variable2.max
After the expression is completed, the button APPLY EXPRESSION is used to apply the current expression to the selected category. When an expression is applied to a category, the expression is actually applied to each site of the category. If the site has a variable of the type specified in the query, the expression is evaluated with that variable’s values. If the result of the evaluation is True, the site is included in the current display. If the result of the evaluation is False, the site is dropped from the current display. If the site does not have a variable of the types listed in the expression, the evaluation results in False and the site is dropped from the current display.
The goal of a query is to obtain a boolean (True/False) answer to whether a site fulfills a query. The query "2 + 5" is a valid query and all the sites fulfill the query, but it is not really a useful query. Including a variable in the expression uses values from the data sites to determine the expression value. If evaluating the expression for a site results in True, the data site is displayed on the GEOREFERENCE WINDOW.

Example:
Say you want to query for all Calcium Carbonate data sites that have a percentage of CaC03 greater than 90%. The process to query is as follows:
  1. Select the Calcium Carbonate data category from the top list by clicking on the left most column.
  2. Construct the query expression; Enter variables into the expression by selecting from the Category Variable Names list, enter operators by selecting from the operator buttons, type directly into the expression using the backspace key to delete. Variable names are preceded and followed by brackets ( [,] ). For example, if the variable CaCO3 Percent is selected, the variable name in the expression appears like [CaCO3 Percent].
  3. Click the APPLY EXPRESSION button.
  4. Click the Done button.
The site markers plotted in the GEOREFERENCE WINDOW for calcium carbonate will now reflect only the sites meeting the query expression.