Database Reference
In-Depth Information
bles eXist to efficiently identify both a node and its structural relationship to other
nodes.
Each node from an XML document is given a DLN identifier . DLN identifiers are
hierarchical in nature and borrow concepts from the Dewey Decimal Classification
system. Each DLN identifier assigned to a node starts with the identifier of the parent
node and concludes with a number for the node under consideration, which indi‐
cates its position among its siblings.
DLN identifiers are unique within a document, which allows for easy identification of
a node. They also have some additional structural properties that are very useful:
• They include the ID of the parent node.
• By virtue of the IDs being hierarchical, you also have the ID of every ancestor
node.
• Given two DLN IDs, you can determine the structural relationship between two
nodes.
Here are some examples of how the DLN identifiers on the nodes shown in
Figure 4-10 can easily be used to perform structural joins in eXist and answer queries
without your needing to examine the nodes and traverse node relationships
themselves:
Root
By looking at the first level of any node identifier, we find its root node. For
example, if you take the node identifier for the text node “Apple,” which is
1.1.1.1 , and look at the first number before the first period, you can see that the
root identifier is 1 , and the node with the identifier 1 is the element “Shopping.”
Ancestors
By looking at all parts of a node identifier from left to right, excluding the last
part, we can find all ancestors of that node. For example, if you take the node
identifier for the text node “Apple,” which is 1.1.1.1 , and work backward from
right to left looking at the parent, then the parent of the parent, and so on until
you reach the root, you will find the ancestor nodes “Name” ( 1.1.1 ), “Fruit”
( 1.1 ), and “Shopping” ( 1 ).
Parent
By looking at the parent identifier levels of any node identifier, we can find its
parent node. For example, if you take the node identifier for the element “Quan‐
tity,” which is 1.2.2 , and look at the identifier all the way up to the last period,
you will see that the parent identifier is 1.2 , and the node with the identifier 1.2
is the element “Vegetable.”
Search WWH ::




Custom Search