The two StrawTies objects provide a one-to-many mapping between keys (labels), and other Haystack objects. This essentially provides us with a method to maintain the list of ``edges'' that any vertex is attached to. StrawTies therefore represent the function f, where f(s) = {TieWeavable objects}, where s is a string label.
StrawTies are internally implemented as two
Hashtables. One table maps a key to set of pointers (in the
Java sense), and the other contains the mapping between a key and the
HaystackIDs (see below) of the objects. In order to save the
HDM structure persistently we serialize (see
Section
) each Straw object
to save on disk. Because the Java serialization mechanism will save
not only the object being serialized but any objects that the
serialized object points at, it is necessary to break apart
Straws before saving them. Maintaining the two hashtables
is an optimization that allows us to break apart and reassemble
Straws easily.
We enforce the following invariant: let each vertex of the HDM graph (the Straw) possess a function, f1 that accepts as input some key, k and produce a set of connected edges, A, labeled k. Let f2 map some key j to a set of identifiers, B. Then " keys k, j, where k = j, $ a in A and b in B, s.t. a.getID() = b. Simply stated, the hashtable holding HaystackIDs as values can be used to produce the hashtable holding Straws as values.
StrawTies provide a subset of the features of the Java Hashtable. The function getVal(label) returns the Vector of values with the given label. To place a new element into the table, put(key,value) is used. Alternatively, remove(...) and removeKey(...) allow for pointers (i.e. edges) to be removed. getAllLinks(), getIDs(), isEmpty(), and toString() perform obvious functions.