next up previous
Next: Conversion of Data Up: History of Development (keywords/memes) Previous: Producing Fake Data

Database Memes

To anyone familiar with relational database applications, our Memes table looks suspiciously like a data dictionary. In fact, the attributes of our Memes are almost a perfect superset of the attributes needed to describe a database table. Each field can be a meme, and the table can be a meme bundle (a collection of fields). Each field has a name, a datatype, and semantics. However, relational tables have additional attributes that one might wish to remember: primarykeying, foreignkeying, and indexing.

We added attributes to the Mbundles table:

einkey (keying and indexing flags)

as a first cut at expressing these features. The ISA relationship described above permits us to establish that the name of Meme A in this bundle will be X. Therefore, in the case of the Memes table, we can express the fact that ctrl_mid, rpt_mid, and isa_mid are all instances of the mid primarykey in that same table. This is a relationship, by the way, which a Sybase server is unable to express explicitly.

ISA already expresses the occurrence of mid in another table, such as the Mvalues table (where mid is a foreignkey); a Sybase server can express this relationship explicitly via the sp_foreignkey command. We now need define the meme mid only once, not N times for all its occurrences in various tables; the foreignkey relationship is implicit, especially if the original meme is a primarykey in one or more tables.

The einkey field is an unapologetic hack. We decided to use a small (char(3)) field to encode keying and indexing information. If a P is found in this field, then the element meme is part of the primarykey for the table being defined. If an I is found, then the designers (we) recommend that the table be indexed on that field.

With these modest hacks, we were ready to describe Sybase tables using our Memes and Mbundles tables. We used the KTL alt_name field in Memes to store the fully-qualified name of the Sybase table, e.g. keck.dbo.Memes. One meme was stored for each table, and one meme for each semantically distinct field. Fields such as uid (Sybase user ID used to track insertions and modifications of data) and stamp (datetime stamp for the same purpose) are shared among many tables, and only appear once as memes.

Years ago I had incorporated a data dictionary into a large online database application; I still had the code which parsed Sybase table definitions (directly from the server) and stuffed the dictionary with everything except the semantics. It was but a couple of hours' work to retrofit this old code to stuff the Memes and Mbundles tables similarly. We were now able to define the Memes, Mvalues, and Mbundles tables themselves in terms of memes and bundles; we had become self-referential.


next up previous
Next: Conversion of Data Up: History of Development (keywords/memes) Previous: Producing Fake Data

De Clarke
Mon Sep 9 16:46:16 PDT 1996