Skip to content

LexDbInternals

BenjaminWaldron edited this page Mar 7, 2005 · 17 revisions

Fields of the LexDB

The main DB table public.revision contains an entry for each revision of each lexical entry. The fields which make up each revision entry are defined when the LexDB is initialized.

The following fields (used internally) occur in any LexDB:

 name TEXT NOT NULL,
 userid TEXT,
 modstamp TIMESTAMP WITH TIME ZONE,
 orthkey TEXT NOT NULL,
 flags INTEGER NOT NULL

Additional fields are defined by the user. Eg.

 type TEXT
 orthography TEXT
 keyrel TEXT
 altkey TEXT
 alt2key TEXT
 keytag TEXT
 altkeytag TEXT
 compkey TEXT
 ocompkey TEXT
 pronunciation TEXT
 complete TEXT
 semclasses TEXT
 preferences TEXT
 classifier TEXT
 selectrest TEXT
 jlink TEXT
 comments TEXT
 exemplars TEXT
 usages TEXT
 lang TEXT
 country TEXT
 dialect TEXT
 domains TEXT
 genres TEXT
 register TEXT
 confidence real DEFAULT 1
 source TEXT

A unique entry is specified by <name,userid,version> (the primary key).

The entries in public.revision are available to all users. In addition, for each user the table USERID.revision stores entries available only to that user (eg. new edits).

Before using the LexDB in the context of a parsing or generating applicationit is necessary to select the set of revisions constituting the current grammar. This is achieved by means of the user's FILTER. For example, the filter

userid = 'danf'

would restrict us to using only entries created by the user danf. When multiple instances of the same name pass the filter, we take the most recent (by modstamp). This filtered view is stored (for efficicent lookup) in USERID.current_grammar.

  • A number of indexes are required for efficient lookup:
 Indexes:
     "revision_pkey" primary key, btree (name, "version", userid)
     "name_modstamp" unique, btree (name, modstamp)
     "public_orthkey" btree (orthkey)
     "public_revision_name" btree (name varchar_ops)
     "public_revision_name_modstamp" btree (name, modstamp)
     "public_revision_name_pattern" btree (name varchar_pattern_ops)
Clone this wiki locally