| Schema is used to manage schema meta data.
Uses a tree w/ next pointing to subsequent peers and child
pointing to subtrees. Assumes the schema described is
heirarchical.
The schema is represented as a binary tree,
the nodes of which carry either a table (SchemaTblNode)
or a column (SchemaColNode).
The table nodes are invented on the fly as a convenience,
the SOIF representation revolves
around columns.
Data associated with different columns is
represented by multi-value SOIF,
the data associated with a column is
grouped on by the multi-value.
The schema eliminates the multi-value
during construction,
grouping on the SchemaColNode class.
When the toSOIF() method is used,
the numbering is created by that method
as it traverses the nodes.
Removing the multi-value makes the
nodes easier to work with in a general way.
Also, if the schema is edited, adding or
deleting columns, the tree doesn't have
to be traversed for unused multi-values.
Interestingly, the actual schema is not a tree,
but rather a graph with no duplicate tables.
A table can have multiple parents,
all tables up the graph from it qualify as parents.
The schema is constructed and managed with the
expectation that at any given level, the
attributes are followed by the subtable
references.
When the schema is dumped toSOIF,
duplicate tables are eliminated
in order to create the graph.
When editing a given instance
of a table in the hierarchy,
it is necessary to synch it with other
instances of the table in the hierarchy.
This is accomplished by maintaining an array
of columns which are pointed back to by the
binary tree - only one copy per column.
This stick of dynamite is lit, baby.
Mercifully, the hierarchy issue is now also moot,
since we're flattening the tree for now.
Currently, only attributes in the root table
are supported.
This issue may be revisited in future releases,
but note that toSOIF()'s current incarnation will
not produce correct "unduplicated graph" SOIF.
Note that some methods were created before the current
paradigm was established and will be reviewed for
efficiency in future releases.
|