1 XDO2: A Deductive Object-Oriented Query Language for XML Wei Zhang 1, Tok Wang Ling 1, Zhuo Chen 1, and Gillian Dobbie 2 School of Computing National.

Slides:



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

XML: Extensible Markup Language
1 CHAPTER 4 RELATIONAL ALGEBRA AND CALCULUS. 2 Introduction - We discuss here two mathematical formalisms which can be used as the basis for stating and.
CSE 6331 © Leonidas Fegaras XML and Relational Databases 1 XML and Relational Databases Leonidas Fegaras.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
TIMBER A Native XML Database Xiali He The Overview of the TIMBER System in University of Michigan.
XQUERY. What is XQuery? XQuery is the language for querying XML data The best way to explain XQuery is to say that XQuery is to XML what SQL is to database.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
A Graphical Environment to Query XML Data with XQuery
1 COS 425: Database and Information Management Systems XML and information exchange.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
1 The ORA-SS Approach for Designing Semistructured Databases Xiaoying Wu, Tok Wang Ling, Mong Li Lee National University of Singapore Gillian Dobbie University.
Tok Wang Ling1 Mong Li Lee1 Gillian Dobbie2
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
4/20/2017.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Programming Languages
DEDUCTIVE DATABASE.
1 Designing Valid XML Views Ya Bing Chen, Tok Wang Ling, Mong Li Lee Department of Computer Science National University of Singapore.
Ontology Development Kenneth Baclawski Northeastern University Harvard Medical School.
CS848: Topics in Databases: Foundations of Query Optimization Topics Covered  Databases  QL  Query containment  More on QL.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
TDDD43 XML and RDF Slides based on slides by Lena Strömbäck and Fang Wei-Kleiner 1.
1 XTree for Declarative XML Querying Zhuo Chen, Tok Wang Ling, Mengchi Liu, and Gillian Dobbie January 2004.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XQuery.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XQuery.
1 Understanding Inheritance COSC 156 C++ Programming Lecture 8.
1 XML-KSI, 2004 XML- : an extendible framework for manipulating XML data Jaroslav Pokorny Charles University Praha.
1 Maintaining Semantics in the Design of Valid and Reversible SemiStructured Views Yabing Chen, Tok Wang Ling, Mong Li Lee Department of Computer Science.
A Z Approach in Validating ORA-SS Data Models Scott Uk-Jin Lee Jing Sun Gillian Dobbie Yuan Fang Li.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
DASWIS NF-SS: A Normal Form for Semistructured Schemata Xiaoying Wu, Tok Wang Ling, Sin Yeung Lee, Mong Li Lee National University of Singapore.
1 XSLT An Introduction. 2 XSLT XSLT (extensible Stylesheet Language:Transformations) is a language primarily designed for transforming the structure of.
Computing & Information Sciences Kansas State University Thursday, 15 Mar 2007CIS 560: Database System Concepts Lecture 24 of 42 Thursday, 15 March 2007.
CSE314 Database Systems The Relational Algebra and Relational Calculus Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Database Systems Part VII: XML Querying Software School of Hunan University
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL.
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.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
1 Automatic Generation of XQuery View Definitions from ORA-SS Views Ya Bing Chen Tok Wang Ling Mong Li Lee School of Computing National University of Singapore.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
1 M ATERIALIZED V IEW M AINTENANCE FOR THE X ML D OCUMENTS Yuan Fa, Yabing Chen, Tok Wang Ling, Ting Chen Yuan Fa, Yabing Chen, Tok Wang Ling, Ting Chen.
Sept. 27, 2002 ISDB’02 Transforming XPath Queries for Bottom-Up Query Processing Yoshiharu Ishikawa Takaaki Nagai Hiroyuki Kitagawa University of Tsukuba.
CS848: Topics in Databases: Information Integration Topics covered  Databases  QL  Query containment  An evaluation of QL.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Relational Algebra p BIT DBMS II.
Deriving Relation Keys from XML Keys by Qing Wang, Hongwei Wu, Jianchang Xiao, Aoying Zhou, Junmei Zhou Reviewed by Chris Ying Zhu, Cong Wang, Max Wang,
CSE 6331 © Leonidas Fegaras XQuery 1 XQuery Leonidas Fegaras.
LINQ to DATABASE-2.  Creating the BooksDataContext  The code combines data from the three tables in the Books database and displays the relationships.
1 Storing and Maintaining Semistructured Data Efficiently in an Object- Relational Database Mo Yuanying and Ling Tok Wang.
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.
1 Efficient Processing of Partially Specified Twig Queries Junfeng Zhou Renmin University of China.
Wenyue Du, Mong Li Lee, Tok Wang Ling Department of Computer Science School of Computing National University of Singapore {duwenyue, leeml,
XML: Extensible Markup Language
Querying and Transforming XML Data
Instructor: Craig Duckett Lecture 09: Tuesday, April 25th, 2017
Chapter 2: Entity-Relationship Model
LINQ to DATABASE-2.
LINQ to DATABASE-2.
XQuery Leonidas Fegaras.
Presentation transcript:

1 XDO2: A Deductive Object-Oriented Query Language for XML Wei Zhang 1, Tok Wang Ling 1, Zhuo Chen 1, and Gillian Dobbie 2 School of Computing National University of Singapore 1 Department of Computer Science University of Auckland New Zealand 2

2 Outline Background and Motivation XDO2 Database Example XDO2 Language Features  Simple and compact  Compact query return format  Multi-valued variables and aggregate functions  Separating structure and value  Not-predicate negation  Recursion querying Comparison with Related Work Conclusion and Future Work

3 Background - XTree XTree [1] is a generalization of and has advantages over XPath  XTree uses [ ] to group same level attributes and elements together  One XPath expression defines one variable vs one XTree expression defines multiple variables  XPath cannot define return format. However, XTree can define return format  Multi-valued variables expressed explicitly in XTree using { } vs no syntactic difference in XPath  Element tags (attribute names) separated from values in XTree using stru  value vs use of functions to separate structure and value pairs in XPath In short, XTree is designed to have a tree structure while XPath does not [1] Z. Chen, T.W. Ling, M.C. Liu, and G. Dobbie. XTree for declarative XML querying. In Proceedings of DASFAA, pages , Korea, 2004

4 Motivation Our proposed XDO2 is a novel XML query language which is based on XTree and has deductive features such as deductive rules and negation, and some object-oriented features such as inheritance and methods Major contributions of XDO2  Negation: supported using not-predicate instead of conventional logical negation as used in XQuery  Derived attributes/methods: implemented as (recursive) deductive rules to deduce new properties  (Multiple) Inheritance: enables a subclass object to inherit the properties from its superclass objects  Multiple variables in one expression, compact return format, explicitly expresses multi-valued variables, and separates structure from value

5 XDO2 Database Example – Company XML data John King Street Ottawa 1975 Male Mike Albert Ottawa 1954 Male Mary Albert Ottawa 1958 Female Star 6000 Tennis Soccer 4000 Tennis

6 XDO2 Database Example – ORA-SS Schema Diagram Fig 1: ORA-SS schema diagram

7 XDO2 Database Example - Schema Features Two derived attributes using rules  age derived attribute in person class  bachelor derived attribute in person class Inheritance  Employee class is a subclass of person class and inherits all the properties of person class (attributes and derived attributes)

8 XDO2 Database Example – Derived Attribute Age Rule R1 defines that the age of a person is 2005 minus his/her birthyear. (R1) $p/age : $a :- /root/person : $p/birthyear : $b, $a = $b.  Notation “ :- ” is to specify if the right hand side (body) is true, then the left hand side (head) is true.  Notation “ : ” assigns the value of left hand side to the right hand side. If the left hand side is an object class, then the right hand side binds to the object identifier, such as person.  Single-valued variables are denoted by “ $ ” followed by a string literal.

9 XDO2 Database Example – Derived Attribute Bachelor Rule R2 defines that a person is a bachelor if he is a male and without spouse. (R2) $p/bachelor : true :- /root/person : $p/ [sex : “ Male ”, not(spouse : $s)].  Notation “ [ ] ” is to group the same level properties (attributes, derived attributes) together which are defined under the same parent object  Notation “ not ” is to negate the existence of enclosed term  Two Boolean values true and false are reserved [2] T.W. Ling. The prolog not-predicate and negation as failure rule. New Generation Computing, 8(1):5-31, 1990

10 XDO2 Database Example – Inheritance The following statement defines that employee object class is a subclass of person object class. employee ISA person by employee.pno ISA person.pno  Notice the first part of the statement defines the class inheritance while the second part of the statement defines the object inheritance

11 XDO2 Database Example – Query (Eg1) Find the age and salary of all employees who are bachelors, with age less than 30, and salary larger than /db/youngRichBachelor : $e/[age : $a, payroll : $s]  /root/company/ employee : $e/[age : $a, bachelor : true, salary : $s], $a  Notation “” is to specify the left hand side is used to construct the XML result and the right hand side is the query and the conditional parts  Derived attributes age and bachelor specified in rule R1 and rule R2 are used directly in the query  age and bachelor properties are inherited from the person class by employee being a subclass of person class

12 XDO2 Database Example – Query Result Using the LHS result construction expression of example 1, we can generate the following XML data result Note: $e which binds to the object identifier of employee, is used as the value of the result element youngRichBachelor

13 XDO2 Language Features Simple and compact query expression (Eg2) Find the year and title of each book, and its authors’ last name and first name. XDO2 expression: : $y, title : $t, author/[last : $l, first : $f]] XPath expressions: $book in /bib/book, $y in $t in $book/title, $author in $book/author, $last in $author/last, $first in $author/first  One XDO2 expression corresponding to 6 XPath expressions  Using [ ] to group the same level attributes, elements, and/or methods together to have a tree structure.  $book and $author are needed in XPath expressions

14 XDO2 Language Features Compact result format (Eg3) List the titles and publishers of books which are published after XDO2 query expression: /result/recentbook/[title : $t, publisher : $p]  : $y, title : $t, publisher : $p], $y > XQuery expression: for $book in /bib/book, $y in $t in $book/title, $p in $book/publisher where $y > 2000 return {$t} {$p}  One XDO2 expression is used for query result format while XML element tags is mixed with the XPath expressions in XQuery

15 XDO2 Language Features Multi-valued variables and aggregate functions (Eg4) List the titles of the book which has more than 1 author. XDO2 query expression: /result/multiAuthorBook/title : $t  /bib/book/[title : $t, author : ],.count() > 1. XQuery expression: for $book in /bib/book, $t in $book/title let $a in $book/author where count($a) >1 return {$t}  Multi-valued variables are denoted by (list-valued) or { } (set- valued)  Object-oriented fashion built-in aggregate functions instead of function based fashion

16 XDO2 Language Features Separating structure from value (Eg5) Get sub-element with value “John” in some person element. XDO2 query expression: $ele  /root/person/$ele : “John”. XQuery expression: for $b in /root/person/* where string($b) = “John” return local-name($b)  Using stru : value to separate the structure from the value naturally  In XQuery, built-in functions string() and local-name() have to be used to get values and structures respectively

17 XDO2 Language Features Not-predicate negation (nested) (Eg6) To retrieve the name of the company where every employee has hobby “Tennis”. XDO2 query expression: /db/allLikeTennisCom : $n  /root/company : $c/name : $n, $c/not(employee/not(hobby : “Tennis”)). XQuery expression: for $c in /root/company where EVERY $e IN $c/employee SATISFIES SOME $h IN $e/hobby SATISFIES string($h) = “Tennis” return {string($c/name)}  XDO2 query expression is much simpler and more compact using the not-predicate compared with XQuery, which needs keyword “EVERY”, “SOME”, “IN”, SATISFIES”

18 XDO2 Language Features Not-predicate negation (sub-tree) (Eg7) To retrieve the companies which do not have an employee who has sex “Male” and birthyear [2] T.W. Ling. The prolog not-predicate and negation as failure rule. New Generation Computing, 8(1):5-31, 1990 XDO2 query expression: /db/company : $c  /root/company : $c/not(employee/ [sex : “Male”, birthyear : 1975]). XQuery expression: for $c in /root/company where NOT (SOME $e IN $c/employee SATISFIES ($e/sex = “Male” AND $e/birthyear = 1975)) return {$c}  Using the not-predicate on a subtree structure, XDO2 expression is more compact while XQuery needs “NOT”, “SOME”, “IN”, “SATISFIES”, “AND”.

19 XDO2 Language Features Recursion querying (Eg8) Suppose there is a sub-element child directly under the person element. The following deductive rules define descendants of person. $p/descendant : $c :- /root/person : $p/child : $c. $p/descendant : $d :- /root/person : $p/child : $c, $c/descendant : $d. To retrieve all the descendants of a person with pno ‘p1’. /db/person_p1/descendant : $d  /root/person : ‘p1’/descendant : $d.  for each descendant of person with pno value ‘p1’, single-valued variable $d will bind to the descendant’s identifier and output the result. The recursive rules are recursively used to infer all the person’s descendants.

20 Comparison with Related Work XDO2XQueryXTreeQueryF-logic [9]XML_RL [8] Underlying dataXML tree ObjectXML tree Path expressionXTreeXPathXTree Path expression XTree-like expression Deductive ruleYesNo YesPartial Recursion Recursive rule Recursive function Recursive query Recursive rule Recursive query Negation Not- predicate Logical negation QuantificationNo needYes Multi-valued variable YesNoYesNoYes Direct structure querying YesNoYes Object-oriented features YesNo YesNo [8] M.C. Liu. A logical foundation for XML. In CAiSE, pages , [9] M. Kifer, G. Lausen, and J. Wu. Logical foundations of object-oriented and frame-based languages. Journal of ACM, 42(4): , 1995.

21 Conclusion A novel new XML query language XDO2 which is based on XTree and has deductive and object- oriented features. The relationship between XDO2 and XQuery is similar to the relationship between Datalog and SQL XDO2 queries are simpler and more compact than current XML query languages such as XQuery because XDO2 is based on XTree, and supports (recursive) deductive rules and the not-predicate.

22 Conclusion – Cont’d Important features and contributions of XDO2  Negation: supported using not-predicate instead of conventional logical negation as used in XQuery  Derived attributes/methods: implemented as (recursive) deductive rules to deduce new properties  (Multiple) Inheritance: enables a subclass object to inherit the properties from its superclass objects  Multiple variables in one expression, compact return format, explicit multi-valued variables, and separating structure from value are supported naturally due to XTree

23 Future Work How to evaluate the XDO2 queries efficiently? Especially those queries involving recursive deductive rules and not-predicate. Approaches for XDO2 queries evaluation? Datalog like bottom-up approach Prolog like top-down approach Combining both

24 References [1] Z.Chen, T.W. Ling, M.C. Liu, and G.Dobbie. XTree for declarative XML querying. In Proceedings of DASFAA, pages , Korea, [2] T.W. Ling. The prolog not-predicate and negation as failure rule. New Generation Computing, 8(1):5-31, [3] T.W. Ling and M.L. Lee and G. Dobbie. Semistructured Database Design. Springer, [4] T.W. Ling and W.B.T. Lee. DO2: A deductive object-oriented database system. In proceedings of the 9 th International Conference on Database and Expert System Applications, pages 50-59, [5] M.C. Liu and T.W. Ling. Towards declarative XML querying. In Proceedings of WISE, pages , Singapore, [6] M.C. Liu, G. Dobbie, and T.W. Ling. A logical foundation for deductive object-oriented databases. ACM Transactions Database Systems, 27(1): , [7] M. Kifer, G. Lausen, and J. Wu. Logical foundations of object-oriented and frame- based languages. Journal of ACM, 42(4): , [8] M.C. Liu. A logical foundation for XML. In CAiSE, pages , [9] M. Kifer, G. Lausen, and J. Wu. Logical foundations of object-oriented and frame- based languages. Journal of ACM, 42(4): , [10]M.C. Liu and T.W. Ling. Towards declarative XML quering. In Proceedings of WISE, pages , Singapore, 2002.

25 The End Thank You! Any Questions?