Information Technology Reference
In-Depth Information
Step 1 Decompose the XPath Transaction
Each slash-separated (/) path component of XPath query is a step. The following
nodes and predicates are identified from the descendent axis:
VHOHFWVDOOHOHPHQWFKLOGUHQRIWKHFRQWH[WQRGH
#QDPH±VHOHFWVWKHQDPHDWWULEXWHRIWKHFRQWH[WQRGH
#VHOHFWVDOOWKHDWWULEXWHVRIWKHFRQWH[WQRGH
>PHWKRG@±EXLOWLQIXQFWLRQVWRFUHDWHPRUHH[SUHVVLYHTXHULHV
7KH\DUHWH[WSRVLWLRQ QRUODVWZKHUHQLVLQGH[RIWKH
ORFDWLRQRIHOHPHQWLQVWDQFHVWDUWLQJIURP
>#QDPH ³DWWULEXWH9DOXH´@±WKHYDOXHRIWKHQDPHDWWULEXWHLV
HTXDOWR³DWWULEXWH9DOXH´
Step 2 Create XPath Query Graph
The query graph of the XPath expression or query is created in this step. Based on
the translated XML schema, a navigation path is created to indicate the relation-
ship between nodes by stepping down the XML document tree hierarchy. From the
node_sequence table, all the nodes down from the root element are identified.
Step 3 Map the XPath Query Graph to SQL Query Graph
From the XPath query graph, the root node and its descendant child node are lo-
cated. For each node, the elements are mapped to their corresponding relation in
the RDB.
Step 4 Translate XPath Query to SQL Queries
From the mapped XML schema, each XML document has a key for retrieving the
data for each element node. A key cursor is created for first retrieving the keys for
the XML documents. This key is stored in the table xml_document_key, and each
value fetched from this cursor is used subsequently for each translated SQL query.
It is constructed by the following replacements:
• ReplacingXMLdocumenttreenodenavigationpathbySQLjoinrelationspath.
• ReplacingtheXMLtreeelementsbytheircorrespondingSQLrelations.
• ReplacingXMLdocumenttreenodefilteringbySQLWHEREclause.
• ReplacingtheXMLdocumentinstancelocationindexfunctionbyembedded
SQL query cursor. By counting the number of time result set is fetched from cur-
sor, the location index of XML document is emulated (Fig. 6.12 ).
Step 5 Map the Retrieved Relation Data into XML Document Format
The result set returned from SQL query is mapped into the translatedXML schema.
The tags for the data returned from SQL query are identified from the table xml_
document_node. The result is formatted into XML document returned to user.
Search WWH ::




Custom Search