2. GRS-1 Internal Record Representation

When records are manipulated by the system, they're represented in a tree-structure, with data elements at the leaf nodes, and tags or variant components at the non-leaf nodes. The root-node identifies the schema that lends context to the tagging and structuring of the record. Imagine a simple record, consisting of a 'title' element and an 'author' element:

     ROOT
     TITLE     "Zen and the Art of Motorcycle Maintenance"
     AUTHOR    "Robert Pirsig"
    

A slightly more complex record would have the author element consist of two elements, a surname and a first name:

     ROOT
     TITLE  "Zen and the Art of Motorcycle Maintenance"
     AUTHOR
     FIRST-NAME "Robert"
     SURNAME    "Pirsig"
    

The root of the record will refer to the record schema that describes the structuring of this particular record. The schema defines the element tags (TITLE, FIRST-NAME, etc.) that may occur in the record, as well as the structuring (SURNAME should appear below AUTHOR, etc.). In addition, the schema establishes element set names that are used by the client to request a subset of the elements of a given record. The schema may also establish rules for converting the record to a different schema, by stating, for each element, a mapping to a different tag path.

2.1. Tagged Elements

A data element is characterized by its tag, and its position in the structure of the record. For instance, while the tag "telephone number" may be used different places in a record, we may need to distinguish between these occurrences, both for searching and presentation purposes. For instance, while the phone numbers for the "customer" and the "service provider" are both representatives for the same type of resource (a telephone number), it is essential that they be kept separate. The record schema provides the structure of the record, and names each data element (defined by the sequence of tags - the tag path - by which the element can be reached from the root of the record).

2.2. Variants

The children of a tag node may be either more tag nodes, a data node (possibly accompanied by tag nodes), or a tree of variant nodes. The children of variant nodes are either more variant nodes or a data node (possibly accompanied by more variant nodes). Each leaf node, which is normally a data node, corresponds to a variant form of the tagged element identified by the tag which parents the variant tree. The following title element occurs in two different languages:

      VARIANT LANG=ENG  "War and Peace"
      TITLE
      VARIANT LANG=DAN  "Krig og Fred"
     

Which of the two elements are transmitted to the client by the server depends on the specifications provided by the client, if any.

In practice, each variant node is associated with a triple of class, type, value, corresponding to the variant mechanism of Z39.50.

2.3. Data Elements

Data nodes have no children (they are always leaf nodes in the record tree).