Techniques are provided for performing structural joins for answering
containment queries. Such inventive techniques may be used to perform
efficient structural joins of two interval lists which are neither sorted
nor pre-indexed. For example, in an illustrative aspect of the invention,
a technique for performing structural joins of two element sets of a
tree-structured document, wherein one of the two element sets is an
ancestor element set and the other of the two element sets is a
descendant element set, and further wherein each element is represented
as an interval representing a start position and an end position of the
element in the document, comprises the following steps/operations. An
index is dynamically built for the ancestor element set. Then, one or
more structural joins are performed by searching the index with the
interval start position of each element in the descendant element set.