Rewriting XQuery to Avoid Redundant Expressions based on Static Emulation of XML Store
Hiroyuki Kato, Soichiro Hidaka, Zhenjiang Hu, Yasunori Ishihara, Keisuke Nakano · 2009
Rewriting composite expressions based on eliminating intermediate results generated by redundant expressions is a traditional optimization technique (known as fusion) in both programming languages community and database community. In XQuery, composite expressions for node creation are typical in practice, for example, in data integration systems for XML with XQuery as schema mapping. We propose a fusion algorithm for this kind of composite XQuery. The XQuery fusion is more difficult than the existing fusion, because naive elimination of node creations does not preserve document order. The document order plays an important role in XQuery. An XQuery expression is evaluated against an XML store which contains XML fragments that are created as intermediate results, in addition to initial XML documents with their document order. So, the XML store is updated as the expression with node creations is evaluated. In this paper, we show that XML fragments created dynamically as intermediate results in a store can be emulated statically in such a way that rewriting XQuery to avoid redundant expressions is enabled. This emulation is achieved by using an adornment code called extended Dewey’s assigned to the occurrences of expressions. By using this static emulation, our XQuery fusion avoids unnecessary expressions including node creations while preserving the document order in XML. 1.