# QSAS: The QM Science Analysis System

# KVF (Key Value Format) Specification

Key Value Format is a simple format, similar to C style assignments, for associating values with names. The values can be numeric, string, or sequences of numbers or strings.

KVF format is used by the QDOS classes KVFDataSource, KVDataBase, and StringRep.

## Examples

    // EXAMPLE KVF FILE
    //
    // KVF file for ampte uks pdb attrib data
    //
    Author="Anonymous";
    Pi = 3.14;

    Ampte_uks_description = {
     "Ampte UKS was a small satellite ..",
     "It had a small battery as well" };

    // example of hierarchical naming
    forests/sherwood = { "oak", "elm" };
    forests/new = {"elm", "beech", "oak"};

    // END OF EXAMPLE

## Specification

The implementation of KVFDataSource uses bison and yacc. The following is a rather loose specification ...

    key_value_pair := <name> "=" <value> ";"
    value := <numeric_val> | <string_val> | <numeric_seq> | <string_seq>
    numeric_val := C_syntax_numerical_constant
    string_val := double_quote_delimited_character_string
    numeric_seq := "{" numeric_val "}"
                        "{" comma_separated_list_of_numeric_vals "}"
    string_seq := "{" string_val "}"
                        "{" comma_separated_list_of_string_vals "}"

Names can be hierarchical, with the conventional separator "/". Comments follow the C++ style. Strings can contain the standard C-style escaped variants, eg "\"" for double quote.

## Planned Enhancements

The format will include option for size of sequence and multidimensional array information. The suggested format is:

    sequence_of_arrays = [2] [2,2] { {24.3, 34,2, 34.5, 1.7}, {25.6, 3, 4,6,} };

The first dimension is the number of items in the sequence, and the second dimension block is the dimensionality of every item (ie all items the same dimensionality. If the second block is "[*]" then each matrix has to have its own dimensionality information (as in the following example:

    sequence_of_different_arrays =
    [3][*]{ [2,1]{34.5,23.1}, [2,3]{1,2,3,4,5,6}, [2] {34.9, 94.3 } };

This has been implemented in StringRep, but not KVFDataSource. Comments on format are welcome!

The suggestion has been made to make hierarchical naming using the following format:

    FileMenu = { Open_str = "Open..."; timeout=5; };

This has not yet been attempted or decided!

Last up-dated: Septemeber 2001