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

Slides:



Advertisements
Similar presentations
Querying on the Web: XQuery, RDQL, SparQL Semantic Web - Spring 2006 Computer Engineering Department Sharif University of Technology.
Advertisements

Course Outline Presentation Term: F09 Faculty Name : Asma Sanam Larik Course Name :INTRO TO COMPUTING Course Code : CSE145 Section :1 Semester : 1.
Write a program step by step. Step 1: Problem definition. Given the coordinate of two points in 2-D space, compute and print their straight distance.
ECE Synthesis & Verification - Lecture 2 1 ECE 667 Spring 2011 ECE 667 Spring 2011 Synthesis and Verification of Digital Circuits High-Level (Architectural)
Knapsack Problem Section 7.6. Problem Suppose we have n items U={u 1,..u n }, that we would like to insert into a knapsack of size C. Each item u i has.
8 Intermediate code generation
CSE 6331 © Leonidas Fegaras XML and Relational Databases 1 XML and Relational Databases Leonidas Fegaras.
TIMBER A Native XML Database Xiali He The Overview of the TIMBER System in University of Michigan.
XQuery John Annechino Steven Pow. Agenda What is XQuery? Uses of XQuery XQuery vs. XSLT Syntax –Built-In Functions –FLWOR –if-then-else –User-Defined.
Figure 1.1 Basic components of a simple computer system © 2003 Brooks/Cole Publishing / Thomson Learning™
SSP Re-hosting System Development: CLBM Overview and Module Recognition SSP Team Department of ECE Stevens Institute of Technology Presented by Hongbing.
Cpeg421-08S/final-review1 Course Review Tom St. John.
XQuery: 1 W3C (World Wide Web Consortium) What is W3C? –An industry consortium, best known for standardizing HTML and XML. –Working Groups create or adopt.
Query Languages Aswin Yedlapalli. XML Query data model Document is viewed as a labeled tree with nodes Successors of node may be : - an ordered sequence.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Storing and Querying Ordered XML Using a Relational Database System By Khang Nguyen Based on the paper of Igor Tatarinov and Statis Viglas.
CSE S. Tanimoto Syntax and Types 1 Representation, Syntax, Paradigms, Types Representation Formal Syntax Paradigms Data Types Type Inference.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Section 1-5 Algebra: Variables and Expressions. Vocabulary Algebra: Is a language of symbols, including variables Variable: Is a symbol, usually a letter,
C Chuen-Liang Chen, NTUCS&IE / 1 COMPILER Chuen-Liang Chen Department of Computer Science and Information Engineering National Taiwan University Taipei,
2.2 A Simple Syntax-Directed Translator Syntax-Directed Translation 2.4 Parsing 2.5 A Translator for Simple Expressions 2.6 Lexical Analysis.
1 Distributed Monitoring of Peer-to-Peer Systems By Serge Abiteboul, Bogdan Marinoiu Docflow meeting, Bordeaux.
Recursive Descent Parsing for XML Developers Roger L. Costello 15 October
XML Processing Moves Forward XSLT 2.0 and XQuery 1.0 Michael Kay Prague 2005.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Introduction to Software Design Chapter 1. Chapter Objectives  To become familiar with the software challenge and the software life cycle  To understand.
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style COMPILER DESIGN Introduction to code generation.
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style COMPILER DESIGN Review Joey Paquet,
Modeling and simulation of systems Model building Slovak University of Technology Faculty of Material Science and Technology in Trnava.
Principles of Program Design What should be taught in core programming curricula.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Positional Grouping in XQuery Michael Kay. 2 Definitions Grouping –a function that takes a sequence as input, and produces a sequence of sequences as.
Using XML to present computer program Qingsong Yao Qingsong Yao Department of Computer Science Department of Computer Science York University York University.
Introduction to C++ Programming Language Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University,
Semantics In Text: Chapter 3.
Abdullah Aldahami ( ) April 6,  Huffman Coding is a simple algorithm that generates a set of variable sized codes with the minimum average.
XP New Perspectives on XML, 2 nd Edition Tutorial 7 1 TUTORIAL 7 CREATING A COMPUTATIONAL STYLESHEET.
XSLT Design Patterns.
The Hashemite University Computer Engineering Department
FUNCTIONS. Midterm questions (1-10) review 1. Every line in a C program should end with a semicolon. 2. In C language lowercase letters are significant.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
Authors: Magesh Jayapandian and H.V. Jagadish Chris Truszkowski.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts - 6 th Edition Chapter 8: Relational Algebra.
XML Query languages--XPath. Objectives Understand XPath, and be able to use XPath expressions to find fragments of an XML document Understand tree patterns,
Intermediate code Jakub Yaghob
Representation, Syntax, Paradigms, Types
Compiler Lecture 1 CS510.
Algebra 1 Section 2.3 Subtract real numbers
Computers & Programming Languages
Chapter 6 Intermediate-Code Generation
Chapter 4 - Case Study Clustering
Representation, Syntax, Paradigms, Types
Querying XML XPath.
Querying XML XPath.
Interpreter Pattern.
Subject: Language Processor
Representation, Syntax, Paradigms, Types
Implementation of a Functional Programming Language
Introduction to Software Planning and Design
An algebraic expression that defines a function is a function rule.
Software Development Approaches
Representation, Syntax, Paradigms, Types
Engine Part ID Part 1.
Engine Part ID Part 2.
Engine Part ID Part 2.
Evaluating Algebraic Expressions
Introduction to XML IR XML Group.
On to Object Design c. 14.
Lesson 3.3 Writing functions.
Presentation transcript:

XQuery with User-defined Functions David Bednárek 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) { for $X in $P/section return { $X/title, local:toc($X) } }; { for $S in $I/book return local:toc($S) }

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

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

The simplest XQuery application XML document tree A B C D XQuery evaluation tree

The simplest XQuery application Cartesian product A B C D

The simplest XQuery application Two-dimensional attribute grammar Dependence analysis

The simplest XQuery application Turing-strong patterns Mesh Tape

Relational algebra representation Identifier handling

Example – input document and its Dewey encoding / 1book 1.5section 1.5.7title 1.5.8section title p 1.9section 1.9.4title 1.9.8p

XQuery program and its effect on encoded documents / 1book 1.5section 1.5.7title 1.5.8section title p 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))(2( ))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/title, local:toc($X) } }; { for $S in $I/book return local:toc($S) }

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)) ()((1)(1.5)) (2(1.5.7))(2( ))title ()((1)(1.9))section ()((1)(1.9)) (2(1.9.4))title

Life cycle of identifiers

Bulk-evaluation R-programs

Handling recursion by expansion Bulk-evaluation by relational algebra

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

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

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)

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

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

Reversed data flow

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