1 Static Type Analysis of Path Expressions in XQuery Using Rho-Calculus Wang Zhen (Selina) Oct 26, 2006.

Slides:



Advertisements
Similar presentations
XML: Extensible Markup Language
Advertisements

1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
XML Query Evaluation Using a –calculus Based Framework Pavel Loupal & Karel Richta, FEL ČVUT Praha
1 XQuery Web and Database Management System. 2 XQuery XQuery is to XML what SQL is to database tables XQuery is designed to query XML data What is XQuery?
CSE 425: Semantic Analysis Semantic Analysis Allows rigorous specification of a program’s meaning –Lets (parts of) programming languages be proven correct.
Fall Semantics Juan Carlos Guzmán CS 3123 Programming Languages Concepts Southern Polytechnic State University.
Paper by: A. Balmin, T. Eliaz, J. Hornibrook, L. Lim, G. M. Lohman, D. Simmen, M. Wang, C. Zhang Slides and Presentation By: Justin Weaver.
Foundations of Programming Languages: Introduction to Lambda Calculus
School of Computing and Mathematics, University of Huddersfield CAS810: WEEK 3 LECTURE: LAMBDA CALCULUS PRACTICAL/TUTORIAL: (i) Do exercises given out.
NaLIX: A Generic Natural Language Search Environment for XML Data Presented by: Erik Mathisen 02/12/2008.
Static Typing in XQuery Mary Fernández, Jérôme Siméon, Philip Wadler Επιμέλεια Παρουσίασης: Μαγδαληνός Παναγής.
ModelicaXML A Modelica XML representation with Applications Adrian Pop, Peter Fritzson Programming Environments Laboratory Linköping University.
XQuery from the Experts Chapter 5 – Introduction to the formal Semantics Νίκος Λούτας.
Misc. Announcements Assignment available end of the day today –Due back in 11/03 (after break) Will also update slides on website –Today Midterm next week.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
Containment and Equivalence for an XPath Fragment By Gerom e Mikla Dan Suciu Presented By Roy Ionas.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Describing Syntax and Semantics
Knowledge Mediation in the WWW based on Labelled DAGs with Attached Constraints Jutta Eusterbrock WebTechnology GmbH.
Syntax & Semantic Introduction Organization of Language Description Abstract Syntax Formal Syntax The Way of Writing Grammars Formal Semantic.
Lecture 24 XML processing. 2 XQuery Formal Semantics ‘goal is to complement XPath/XQuery spec, by defining meaning of expressions with mathematical rigor.
Lecture 21 XML querying. 2 XSL (eXtensible Stylesheet Language) In HTML, default styling is built into browsers as tag set for HTML is predefined and.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
TDDD43 XML and RDF Slides based on slides by Lena Strömbäck and Fang Wei-Kleiner 1.
XPath Processor MQP Presentation April 15, 2003 Tammy Worthington Advisor: Elke Rundensteiner Computer Science Department Worcester Polytechnic Institute.
Comparing XSLT and XQuery Michael Kay XTech 2005.
Structured-Document Processing Languages Spring 2011 Course Review Repetitio mater studiorum est!
1 XPath XPath became a W3C Recommendation 16. November 1999 XPath is a language for finding information in an XML document XPath is used to navigate through.
Session II Chapter 2 – Chapter 2 – XSLhttp://
Sofia, Bulgaria | 9-10 October Using XQuery to Query and Manipulate XML Data Stephen Forte CTO, Corzen Inc Microsoft Regional Director NY/NJ (USA) Stephen.
Graph Data Management Lab, School of Computer Science gdm.fudan.edu.cn XMLSnippet: A Coding Assistant for XML Configuration Snippet.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation eXist Update Lecturer.
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Lecture 22 XML querying. 2 Example 31.5 – XQuery FLWOR Expressions ‘=’ operator is a general comparison operator. XQuery also defines value comparison.
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
Chapter Twenty-ThreeModern Programming Languages1 Formal Semantics.
Optimization in XSLT and XQuery Michael Kay. 2 Challenges XSLT/XQuery are high-level declarative languages: performance depends on good optimization Performance.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Formal Semantics Chapter Twenty-ThreeModern Programming Languages, 2nd ed.1.
RRXS Redundancy reducing XML storage in relations O. MERT ERKUŞ A. ONUR DOĞUÇ
Resource Description Framework (RDF) Course: Electronic Document Team member: Ding Feng Ding Wei Wang Ling Date:
Declaratively Producing Data Mash-ups Sudarshan Murthy 1, David Maier 2 1 Applied Research, Wipro Technologies 2 Department of Computer Science, Portland.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Semantically Processing The Semantic Web Presented by: Kunal Patel Dr. Gopal Gupta UNIVERSITY OF TEXAS AT DALLAS.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
1 Formal Semantics. 2 Why formalize? ML is tricky, particularly in corner cases generalizable type variables? polymorphic references? exceptions? Some.
XML Access Control Koukis Dimitris Padeleris Pashalis.
1 Typing XQuery WANG Zhen (Selina) Something about the Internship Group Name: PROTHEO, Inria, France Research: Rewriting and strategies, Constraints,
12/9/20151 Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC Based in part on slides by Mattox.
Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0http://
Just Enough Type Theory or, Featherweight Java A Simple Formal Model of Objects Jonathan Aldrich
CMSC 330: Organization of Programming Languages Operational Semantics a.k.a. “WTF is Project 4, Part 3?”
XPath --XML Path Language Motivation of XPath Data Model and Data Types Node Types Location Steps Functions XPath 2.0 Additional Functionality and its.
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
1 Programming Languages (CS 550) Lecture 2 Summary Mini Language Interpreter Jeremy R. Johnson.
CMSC 330: Organization of Programming Languages Operational Semantics.
CS7120 (Prasad)L13-1-Lambda-Opt1 Typed Lambda Calculus Adapted from Lectures by Profs Aiken and Necula of Univ. of California at Berkeley.
SEMI-STRUCTURED DATA (XML) 1. SEMI-STRUCTURED DATA ER, Relational, ODL data models are all based on schema Structure of data is rigid and known is advance.
XML Query languages--XPath. Objectives Understand XPath, and be able to use XPath expressions to find fragments of an XML document Understand tree patterns,
LECTURE 10 Semantic Analysis. REVIEW So far, we’ve covered the following: Compilation methods: compilation vs. interpretation. The overall compilation.
Chapter 3 – Describing Syntax
Defining Macros in Lisp
{ XML Technologies } BY: DR. M’HAMED MATAOUI
Querying XML XQuery.
Mini Language Interpreter Programming Languages (CS 550)
Querying XML XQuery.
CSE S. Tanimoto Lambda Calculus
Presentation transcript:

1 Static Type Analysis of Path Expressions in XQuery Using Rho-Calculus Wang Zhen (Selina) Oct 26, 2006

2 Outline Background Related Work Typing XQuery Using Rho Calculus Conclusion and Future Work

3 Background XQuery: A query language for XML documents W3C Candidate Recommendation, 8 June 2006 Query processing (recommended for implementation):  Static analysis phase Parsing: parsed expression Static Context Processing: the static context (statEnv)statEnv Normalization: equivalent expression in Core Grammar [Expr]=core:Expr Static type analysis  Dynamic evaluation phase Dynamic Context Processing: the dynamic context (dynEnv)dynEnv Dynamic Evaluation (Dynamic type analysis)

4 Background Typing XQuery Static type analysis (STA):  Compile-time  Allows early detection of type errors  Can be used as the basis for certain classes of optimization. Dynamic type analysis (DTA):  Run-time  Can be avoided when STA is enabled, since: Any type error found during DTA can be found during STA

5 Background Rho-Calculus A framework embedding Lambda calculus and Term Rewriting Explicitly handles the rules, since the syntax allows rule definitions and rule applications Judgment: expresses whether a property holds or not. E.g.:  Type judgment: ( statEnv |- )? Expr: Type Rule application, e.g.: [X+Y →Y+X ](A+B) => B+A Rule definitionApplication

6 Background Rho-Calculus’s Typing System Subject reduction -- the type of a term does change during its reduction Type uniqueness Decidability -- given a term A in a context Γ, the following problems are decidable:  Whether there is a type , such that Γ├ A:   Given a type , whether it is true that Γ├ A: 

7 Related Work XQuery 1.0 and XPath 2.0 Formal Semantics W3C Candidate Recommendation “…uses several kinds of formal notations to define the relationships between [XPath/XQuery] expressions, XML values, and XML Schema types…” Some Important notations/definitions:  Judgment: expresses whether a property holds or not. E.g.: Type judgment: statEnv |- Expr: Type Subtype judgment: Type 1 <: Type 2  Typing rule: (All premises and the conclusion are judgments.)

8 Related Work XQuery 1.0 and XPath 2.0 Formal Semantics STA  Provides the typing rules for each kind of XQuery/XPath expression  Static typing works by recursively applying the rules over a given expression Other XML Query languages : XDuce/CDuce, µXQ, Tequyla-TX, …… STA: use rules

9 Related Work Problems 1 st Problem: Complicated, difficult to be fully implemented, E.g.: XQuery W3C Formal Semantics About 40~50 kinds of judgments Even more rules for each XQuery/XPath expression Many XQuery implementations, however:  Some of them do not support STA  Some support: encode the rules and judgments The specification is still being updated Difficult to keep up with the changes. 2 rd problem : difficult to prove the property of typing system, e.g.: soundness Question: whether we can use a “reasonable” and “safe” typing system, where the rules can be maintained easily

10 Typing XQuery Using Rho Calculus Some prefixes used later

11 Typing XQuery Using Rho Calculus XQuery W3C Formal Semantics STA [xq:Expr] FS = core:Expr Typed core:Expr Our approach: Rho-Normalization 『 fs:Definitions or core:Expr 』 Rho = mapped object XML Schema import fs:Definitions core:Expr fs:Definitions Mapped to judgments Rho term Typing rules Rho Calculus’s typing system

12 Typing XQuery Using Rho Calculus Type: extend the type definition in Rho calculus to meet the requirement of XQuery types fs:Type mapped rho:Type The definition of fs:Type Based on the six node types in XML document: document, element, attribute, comment, processing-instruction, text

13 Typing XQuery Using Rho Calculus Types Accordingly, we define fs:Type mapped rho:Type

14 Typing XQuery Using Rho Calculus

15 Typing XQuery Using Rho Calculus We extend the rho:Type definition as

16 Typing XQuery Using Rho Calculus Our approach:  Element definition: define element elemName of type typeName elemName: typeName  Attribute definition: define attribute attrName of type typeName {attrName: typeName}  Type definition: define type typeName {fs:Type} 『 fs:Type 』 → typeName fs:Definitions Mapped to judgments Rho term Rho Calculus’s typing system [xq:Expr] FS = core:Expr XML Schema import

17 Typing XQuery Using Rho Calculus Example: doc(“CTL.xml”)/catalogue catalogue.xsd

18 Typing XQuery Using Rho Calculus fs:Definitions Mapped to judgments Rho term Rho Calculus’s typing system [xq:Expr] FS = core:Expr XML Schema import

19 Typing XQuery Using Rho Calculus fs:Definitions Mapped to judgments Rho term Rho Calculus’s typing system [xq:Expr] FS = core:Expr XML Schema import Some variables used in the following slides : Currently we focus on  Path expressions: the key syntax in XQuery

20 Typing XQuery Using Rho Calculus XQuery Grammar XQuery Core Grammar Function calls FLWOR Expr (for-let-where- order by-return Expr) StepExpr

21 Typing XQuery Using Rho Calculus FLWOR Expr: for-let-where-order by-return In Core Grammar: ForClause + Return

22 Typing XQuery Using Rho Calculus FLWOR Expr: for-let-where-order by-return ForClause + Return

23 Typing XQuery Using Rho Calculus XQuery Grammar XQuery Core Grammar Function calls FLWOR Expr StepExpr

24 Typing XQuery Using Rho Calculus StepExpr in Core Grammar:

25 Typing XQuery Using Rho Calculus StepExpr Example: Child::NameTest, Child::KindTest Mapped to some function calls:

26 Typing XQuery Using Rho Calculus

27 Typing XQuery Using Rho Calculus XQuery Grammar XQuery Core Grammar Function calls FLWOR Expr StepExpr

28 Typing XQuery Using Rho Calculus Example: doc(“CTL.xml”)/catalogue catalogue.xsd

29 Typing XQuery Using Rho Calculus fs:Definitions Mapped to judgments Rho term Rho Calculus’s typing system [xq:Expr] FS = core:Expr XML Schema import

30 Typing XQuery Using Rho Calculus fs:Definitions Mapped to judgments Rho term Rho Calculus’s typing system [xq:Expr] FS = core:Expr XML Schema import [doc(“CTL.xml”)/catalogue] FS = Example: doc(“CTL.xml”)/catalogue

31

32 Conclusion and Future Work We analysis the current research work on STA for XML Query languages, specially XQuery Problems  The typing system is too complicated to be fully implemented  It’s not easy to maintain the implementation so that it can keep up with the update of the rules Solution: use Rho Calculus to express XQuery expressions, since the calculus  is designed to define and maintain rules easily.  provides “reasonable” and “safe” typing system Future work:  Analysis other syntax of XQuery using Rho Calculus  Analysis the property of the typing system under our extension

33