man page(1) manual page
Table of Contents

Schema(5) Herrin Software Development, Inc. Schema(5)


Schema - Schema description file for Qddb relations.


The Schema file in a Qddb relation describes each attribute in the relation and whether the attribute is expandable and/or structured. Expandable attributes may have more than one instance within a single tuple. Structured attributes are a way of keeping secondary relational information with the primary tuple. The Schema file also specifies various options associated with each attribute, and some options that are associated with the entire relation.


Each Qddb Schema may have any of the following options that apply to the entire relation:

HashSize = <integer>
HashType = <integer>
CacheSize = <integer>
MaxMem = <integer>
DateFormat = <string>
Use Cached Secondary Search
Use Cached Hashing
Use Reduced Attribute Identifiers
Use ExcludeWords
Use Condensed Indexing

These options should go at the top of the Schema file.

HashType = <integer> specifies the hash function. <inte_ger> = 1 specifies a hash function designed for data in which prefixes and suffixes occur frequently in the data. <integer> = 0 specifies a hash function that uses the first four characters of the string to compute the hash value. <integer> = 0 is the default for backward compatibility. You can experiment with your own hash functions by inserting them into the function Qddb_HashValue (in qddb-<version>/Lib/LibQddb/Hash.c.)

CacheSize = <integer> specifies the number of hash entries that are cached when using cached hashing. DateFormat specifies the default date format when the format is not specified for an attribute of type date.

MaxMem = <integer> specifies the maximum KB of memory that Qddb will attempt to use during stabilization. This number is only a hint.

Use Cached Secondary Search informs Qddb that your database will be heavily modified and all modifications

QDDB Reference Manual 3 Jun 1997 1

Schema(5) Herrin Software Development, Inc. Schema(5)

should be indexed when saved. The index is stored both on disk (in the file SecondaryCache) and in memory.

Use Cached Hashing tells Qddb to build a HashTable of fixed width and height so that entries may be read on demand. We recommend this option for almost all relations. HashSize = <integer> specifies the number of hash buckets to use when stabilizing the relation.

Use Reduced Attribute Identifiers reduces the size of the Database and Index files by converting the full attribute identifiers to a base 36 number indexing into a new file called RedAttrIndex.

Use ExcludeWords specifies that the ExcludeWords file, if present in the database directory, contains a list of newline-separated words to exclude from indexing. If the file does not exist, this option has no effect.

Use Condensed Indexing instructs the stabilization process to use base-62 integers for indexing instead of base-10. This option can greatly reduce the size of all the indexrelated files. The database must be immediately restabilized after adding or removing this option.

Comments may be included in the Schema file by preceding the comment with a

Attributes are described in either a leaf or a structured form. The leaf form is:

?verbosename "attribute desc."?
?type integer|real|string|date?
?alias aliasname?
?format "format string"?
?separators "separator string"?
?defaultvalue "value string"?

The default type is string. The default formats are "%f" for attributes of type real, "%d" for attributes of type integer, and either "%m/%d/%y" or "%d/%m/%y" for attributes of type date (depending on the --with-defaultdate-format option to configure). Dates may have any format as described by strftime(3). Strings may not have a format specified.

Separators affect Qddb's definition of a word. By default, any alphanumeric sequence of characters (separated by non-alphanumeric characters) is a word.

Separators for attributes of type string default to:

QDDB Reference Manual 3 Jun 1997 2

Schema(5) Herrin Software Development, Inc. Schema(5)

" 0r!@#$%^&*()_+-={}[];':

Attributes of type real default to the above string minus ".+-". Attributes of type integer or date default to the above string minus "-+". You should take care when specifying separators for any attribute with a type other than string.

The exclude option excludes the corresponding attribute from indexing. Any search on that attribute will return a NULL keylist.

The structured form is:

AttributeName ?verbosename "attribute desc."? ( SubAttributeName <options>
SubAttributeName <options>
) ?*?

Optional features are enclosed by "?" above and may be omitted. Schemas are free-format, so arrange things to suit you.


Suppose that you want to build a small address book with all your friends names. Each friend has a family (with multiple first and last names) and possibly multiple addresses and multiple phones. A schema for this might be:

Use Cached Hashing
HashSize = 1000
CacheSize = 100

FamilyMembers verbosename "Family Members" ( Name (
First verbosename "First Name" Middle verbosename "Middle Name" Last verbosename "Last Name" )
) *
Address (
Street City State ZipCode verbosename "Zip Code" Phones (
Desc verbosename "Description" Area verbosename "Area Code" type integer format "%3d" Prefix type integer format "%3d" Suffix type integer format "%4d" ) *
) *
DateEntered verbosename "Date Entered" type date format "%d %B %Y" Brownies verbosename "Brownie Pts." type real format "%.2f"

QDDB Reference Manual 3 Jun 1997 3

Schema(5) Herrin Software Development, Inc. Schema(5)

Each record in this relation contains possibly multiple FamilyMembers each with their own Name. Each record also has a set of addresses; each address has a set of phone numbers associated with it.


A Guide to QDDB
Eric H. Herrin II and Raphael A. Finkel

Qddb User's Guide

An ASCII Database for Fast Queries of Relatively Stable Data Eric H. Herrin II and Raphael A. Finkel Computing Systems, Volume 4 Number 2
University of California Press, Berkeley CA

Schema and Tuple Trees: An Intuitive Structure for Representing Relational Data
Eric H. Herrin, II and Raphael A. Finkel Computing Systems, Volume 9, Number 2
MIT Press, Cambridge MA

QDDB Reference Manual 3 Jun 1997 4

Table of Contents