摘要:An XQuery optimization by rewriting based on a partial evaluation using folding expressions is proposed. It consists of two parts: one is the main algorithm, which is a recursive algorithm based on an inductive definition of XQuery expressions. The other is invoked by the main algorithm with an expression whose subexpressions are already folded as its input, and it applies the expression-specific folding function. The main contributions of this paper is to propose an algorithm of an expression-specific folding called “child-path folding”. For a given query to the child axis over an element constructed by another XQuery, that is, a composite XQuery, this folding eliminates redundant element construction operators and expressions. These kinds of queries are typical in Global-As-View approach to data integration systems. We also show that all redundant element construction operators and expressions in child-path expressions are eliminated by applying auxiliary transformations. In addition to child-path folding, we discuss folding of major XQuery constructors including FLWOR and quantified expressions. Moreover, we improve the rewriting algorithm based on pruning by adding two annotations to the parsed trees of XQuery expressions.