{'fraction_non_alphanumeric': 0.014198782961460446, 'fraction_numerical': 0.0, 'mean_word_length': 5.379310344827586, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Rewriting XQuery to Avoid Redundant Expressions based on Static Emulation of XML Store

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.