Extending Datalog to cover XQuery.
David Bednárek · 2008
Abstract. Datalog is a traditional platform in database research and, due to its ability to comprehend recursion, it seems to be a good choice for modeling XQuery. Unfortunately, XQuery functions have arguments carrying sequences; therefore, logic-based models of XQuery must be second-order languages and, consequently, Datalog is usually extended by node-set variables. In this paper, we suggest an alternative approach- extending Datalog by allowing structured variables in a form similar to Dewey numbers. This extension is then used to model the behavior of a XQuery program as a whole, using predicates that reflect the semantics of XQuery functions only in the context of the given program. This fact distinguishes our approach from traditional models that strive to comprehend the behavior of a function independently of its context. The advantage of this approach is that it uses the same means to model the structural recursion of documents and the functional recursion of programs, allowing various modes of bulk processing, loop reversal and other optimization techniques. 1