Presentation is loading. Please wait.

Presentation is loading. Please wait.

XQuery with User-defined Functions David Bednárek ulita.ms.mff.cuni.cz/~bednarek Department of Software Engineering Faculty.

Similar presentations


Presentation on theme: "XQuery with User-defined Functions David Bednárek ulita.ms.mff.cuni.cz/~bednarek Department of Software Engineering Faculty."— Presentation transcript:

1 XQuery with User-defined Functions David Bednárek david.bednarek@mff.cuni.cz ulita.ms.mff.cuni.cz/~bednarek Department of Software Engineering Faculty of Mathematics and Physics Charles University Prague

2 XQuery program with user-defined functions declare function local:toc($P) { for $X in $P/section return { $X/@*, $X/title, local:toc($X) } }; { for $S in $I/book return local:toc($S) }

3 XQuery with user-defined functions Turing-complete language Identification of patterns of "strong" computation Relational algebra representation Identifier handling Bulk-evaluation R-programs Temporary structures Static analysis Generation of the output document Reversed evaluation

4 Turing-completeness of XQuery Identification of patterns of "strong" computation

5 The simplest XQuery application XML document tree 12 3 4 A B C D XQuery evaluation tree

6 The simplest XQuery application Cartesian product 12 3 4 A B C D

7 The simplest XQuery application Two-dimensional attribute grammar Dependence analysis

8 The simplest XQuery application Turing-strong patterns Mesh Tape

9 Relational algebra representation Identifier handling

10 Example – input document and its Dewey encoding / 1book 1.5section 1.5.7title 1.5.8section 1.5.8.6@id 1.5.8.7title 1.5.8.9p 1.9section 1.9.4title 1.9.8p

11 XQuery program and its effect on encoded documents / 1book 1.5section 1.5.7title 1.5.8section 1.5.8.6@id 1.5.8.7title 1.5.8.9p 1.9section 1.9.4title 1.9.8p / ()toc ()((1)(1.5))section ()((1)(1.5))(2(1.5.7))title ()((1)(1.5))(3(1.5.8))section ()((1)(1.5))(2(1.5.7))(1(1.5.8.6))@id ()((1)(1.5))(2(1.5.7))(2(1.5.8.9))title ()((1)(1.9))section ()((1)(1.9))(2(1.9.4))title declare function local:toc($P) { for $X in $P/section return { $X/@*, $X/title, local:toc($X) } }; { for $S in $I/book return local:toc($S) }

12 Example – decoded output document / ()toc ()((1)(1.5))section ()((1)(1.5)) (2(1.5.7))title ()((1)(1.5)) (3(1.5.8))section ()((1)(1.5)) (2(1.5.7))(1(1.5.8.6))@id ()((1)(1.5)) (2(1.5.7))(2(1.5.8.9))title ()((1)(1.9))section ()((1)(1.9)) (2(1.9.4))title

13 Life cycle of identifiers

14 Bulk-evaluation R-programs

15 Handling recursion by expansion Bulk-evaluation by relational algebra

16 R-programs DAG of relational algebra operators Gradual expansion driven by triggers

17 Temporary structures Static analysis Published in: "Reducing Temporary Trees in XQuery" ADBIS 2008, Pori, Finland, LNCS

18 Static analysis algorithm Input: a XQuery program Output: a set of modes assigned to each sub- expression and each variable Mode determines a particular way of representation required Reversed evaluation is one of the modes Time O(n 2 ), space O(n)

19 Generation of the output document Reversed evaluation Published in: "Output-driven evaluation of XQuery" IDC 2008, Catania, Italy, Springer Verlag

20 Standard data flow declare function local:toc($P) { for $X in $P/section return { $X/@*, $X/title, local:toc($X) } }; { for $S in $I/book return local:toc($S) }

21 Reversed data flow

22 Future work Cost-based optimization in R-programs Distributed/parallel XQuery engine


Download ppt "XQuery with User-defined Functions David Bednárek ulita.ms.mff.cuni.cz/~bednarek Department of Software Engineering Faculty."

Similar presentations


Ads by Google