Tuple trees lend themselves to various representations for different purposes. The external form used by Qddb in its database files prefaces each value with its leaf identifier, omitting those attributes that have empty values.
The readable form is a textual representation of the tuple tree with attributes given their local (textual) names and with structured attributes surrounded by parentheses.
For example, consider the following schema tree: A ( B* C )* D
.
A simple readable form of a tuple tree might be:
A (
B = "10"
C = "20"
)
D = "30"
A
is a structured attribute containing subattributes B
and
C
.
Since the attributes A
and A.B
are expandable and values can be
empty, tuples can be more complex:
A (
B = "10"
B = "80"
C = "20"
)
A (
B = "40"
)
D = "30"
Multiple instances of expandable attributes are always adjacent in the
readable form. Attributes with empty values are omitted.
Qddb uses the readable form for a text-editor interface to data.
Figure 5: The graphical form of a tuple tree
For the convenience of Tcl programmers, Qddb supports the tcl form of tuple trees. In this form, a tuple tree is a list of (attribute, value) pairs, where the attribute is a leaf identifier and the value is a string.
The newest presentation form of a tuple tree is the graphical form.
The graphical form is displayed in a window (in the X Window System [Scheifler & Gettys 1986]).
Given the following schema tree, Qddb tools automatically build
the graphical form of the tuple shown in Figure 5.
Name ( First Last )
Address ( Street City State Zip Phones (Desc Number)* )*
Phones ( Desc Number )*
The graphical form looks very similar to the schema tree . At any given time, the graphical form displays one complete row in a single tuple.
Rows of an expandable attribute associated with the current complete row
are accessible by interactively selecting a ``View'' button.
This button invokes the ProduceAttributes algorithm introduced in Section
4.3.
For example, suppose
we are in the 2nd instance of Address
and wish to view
Address.Phones
.
The viewed rows are produced by evaluating:
r = ProduceAttributes(Address.2.Phones)
If we choose to view the Address
attribute, the viewed rows are
produced with:
r = ProduceAttributes(Address)
In other words,
choosing the Address
attribute's ``View'' button shows all possible rows
beginning at the Address
node in the tuple tree. Choosing the
Address.Phones
``View'' button
shows all rows beginning at the Address.Phones
node in the current
instance of Address
in the tuple tree.
All views are configurable, that is, the user can choose to view only certain
columns, sort by given columns, and order the columns.
The user can add a new instance of an expandable attribute by selecting the ``Add'' button. This button adds an entire branch (with initially empty contents or default values) to the tuple tree. Similarly, the user can delete an entire branch of the tuple tree by selecting the ``Del'' button.
The graphical form provides a clean interface for attributed searching. The user may specify one or more keys for all attributes. If multiple keys are specified for a particular attribute, each constitutes a search. The results of the searches within a particular attribute are combined by strong operations. The results of searches across attributes are then combined using weak intersection, and the result is pruned by the algorithm presented in Section 5.2. The matching tuples are then read, and the rows that satisfy the query are constructed and displayed.