1 / 22

XQuery with User-defined Functions

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. XQuery program with user-defined functions. declare function local:toc($P) {

dwinston
Télécharger la présentation

XQuery with User-defined Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 <section> { $X/@* , $X/title , local:toc($X) } </section> }; <toc> { for $S in $I/book return local:toc($S) } </toc>

  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 A 4 1 2 B 3 C D • XQuery evaluation tree

  6. The simplest XQuery application • Cartesian product A 4 1 2 B 3 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

  11. XQuery program and its effect on encoded documents declare function local:toc($P) { for $X in $P/section return <section> { $X/@* , $X/title , local:toc($X) } </section> }; <toc> { for $S in $I/book return local:toc($S) } </toc>

  12. Example – decoded output document

  13. Life cycle of identifiers

  14. Bulk-evaluation • R-programs

  15. R-programs • 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(n2), 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 <section> { $X/@* , $X/title , local:toc($X) } </section> }; <toc> { for $S in $I/book return local:toc($S) } </toc>

  21. Reversed data flow

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

More Related