next up previous contents index
Next: 11.6 Adding new fields Up: 11 Schemas Previous: 11.4 Schema options

11.5 Example Schemas

This section provides some sample schemas to give you an idea for the style and types of schemas that you can create.

Schemas are free-form

You can enter your database description in the Schema file using any style you choose. Qddb only requires the following:

  1. You can choose any name you want for your fields, except for those shown in table 11.5

      table2680
    Table 11.5: Keywords that must not be used for attribute names

  2. You must separate field names and keywords by one or more whitespace characters.
    Whitespace characters can be either a (1) tab, (2) blank or (3) newline character.

    All of the schemas shown in figure 11.7 are equivalent.



    a ( b c ) * d          a (            a      
                               b          (
                               c            b c
                           ) *            ) * d
                           d              
    

      
    Figure 11.7: Equivalent schemas





11.5.2 Deeply Nested Schema

There is no limit to the number of nested structured attributes. For example, the schema shown in figure 11.8



a ( b ( c ( d ( e ( f ( g ( h ( i ( j ( k ) ) ) ) ) ) ) ) ) ) 

  
Figure 11.8: A deeply nested schema example





will work just fine -- although, if you have this much nesting in your database, you may want to rethink your design.

11.5.3 Sample Schema illustrating all the attribute options

Figure 11.9 shows a schema using all the options. It represents a family that might have many members, addresses and phone numbers. The attributes n, a, and p are expandable so you can have multiple names, addresses and phone numbers grouped together in one record.



\progfont
    # Database of families I know
    HashSize = 2000
    CacheSize = 100
    Use Cached Hashing
    Use reduced attribute identifiers
    DateFormat = "%d %B %Y" # "27 February 1956"
    n verbosename "Name" ( 
       t verbosename "Dr./Mr./Mrs./Ms./Miss"
        f verbosename "First"
        m verbosename "Middle" exclude
        l verbosename "Last"
    )*
    a verbosename "Address" (
        street city state # three attributes on one line
        zip verbosename "zip code" type integer
    )*
    e verbosename "E-mail" separators "@!%"
    p verbosename "Phones" (
        d verbosename "Desc"
        a type integer verbosename "" alias pa format "%10d"
        p verbosename "" alias pp type integer
        s verbosename "" type integer
    )*
    z verbosename "Extra stuff" ( 
        a ( a b c ) b c d e f g h 
    )
    c verbosename "Comments"

  
Figure 11.9: An example of a schema showing all options







Herrin Software Development, Inc.