Big Data 10. Querying
|
|
- Marvin Griffith
- 5 years ago
- Views:
Transcription
1 Ghislain Fourny Big Data 10. Querying pinkyone / 123RF Stock Photo 1
2 Declarative Languages What vs. How 2
3 Functional Languages for let order by if + any else = then every while where return exit with Expression 3
4 Ever played Lego? 4
5 Ever played Lego? if( ) then else 5
6 Ever played Lego? if( ) my:func( ) then else 6
7 Ever played Lego? if( ) my:func( ) then else 7
8 Ever played Lego? if( ) my:func( ) 2 then else 8
9 Ever played Lego? if( ) my:func( ) 2 then for $x in let $y := return else 9
10 Ever played Lego? if( ) my:func( ) 2 then for $x in let $y := return else 10
11 Ever played Lego? if( ) my:func( ) 2 then for $x in let $y := return else 11
12 Language ecosystem XML JSON Navigation XPath JSONPath JSONSelect Transform XSLT JSONT Query XQuery 1.0/3.0 XQuery 3.1, JSON Query, JSONiq Update, Scripting XQuery Update Facility & Scripting JSONiq 12
13 Try it out! 13
14 XML Navigation (XPath, XQuery) 14
15 The slash operator <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& & doc("myfile.xml")/countries/country/name 15
16 The slash operator <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">&!!!!<name>switzerland</name>! &&<country&code="f">&!!!!<name>france</name>! &&<country&code="d">&!!!!<name>germany</name>! &&<country&code="i">&!!!!<name>italy</name>! &&<country&code="a">&!!!!<name>austria</name>! </countries>& doc("myfile.xml")/countries/country/name 16
17 Axis <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">&!!!!<name>switzerland</name>! &&<country&code="f">&!!!!<name>france</name>! &&<country&code="d">&!!!!<name>germany</name>! &&<country&code="i">&!!!!<name>italy</name>! &&<country&code="a">&!!!!<name>austria</name>! doc("myfile.xml") /child::countries /child::country /child::name </countries>& 17
18 Axis <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">&!!!!<name>switzerland</name>! &&<country&code="f">&!!!!<name>france</name>! &&<country&code="d">&!!!!<name>germany</name>! &&<country&code="i">&!!!!<name>italy</name>! &&<country&code="a">&!!!!<name>austria</name>! </countries>& doc("myfile.xml") /descendant::country /child::name 18
19 All Axes Forward Axes self:: attribute:: child:: descendant:: descendant-or-self:: following-sibling:: following:: Reverse Axes parent:: ancestor:: ancestor-or-self:: preceding-sibling:: preceding:: 19
20 Axis <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country /child::name 20
21 Axis <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& doc("myfile.xml") /descendant::country /attribute::code/data() &&<country&code="a">& &&&&<name>austria</name>& </countries>& 21
22 Attribute Abbreviation <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country 22
23 Descendant-or-self Abbreviation <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") //country 23
24 Filters <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] 24
25 Implicit Context Item <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] 25
26 Joker <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country)code="ch">) ))))<name>switzerland</name>) ))</country>) &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] /parent::* 26
27 Parent Abbreviation <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country)code="ch">) ))))<name>switzerland</name>) ))</country>) &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] /.. 27
28 Alternative <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country)code="ch">) ))))<name>switzerland</name>) ))</country>) &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] 28
29 Atomization <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country)code="ch">) ))))<name>switzerland</name>) ))</country>) &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] 29
30 Atomization <name>switzerland</name>0 <name>france</name>0 <name>germany</name>0 <name>italy</name>0 <name>austria</name>0 0 data( ) Switzerland, France, Germany, Italy, Austria, 30
31 Kind test <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">&!!!!<name>switzerland</name>! &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] /child::element() 31
32 All Kinds Simplest document-node() element() attribute() text() comment() processing-instruction() namespace-node() More precise document-node(element(countries)) element(countries) element(name, xs:string) schema-element(country) attribute(*, xs:integer) schema-attribute(code) processing-instruction(excel) 32
33 Kind test <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">&!!!!<name>switzerland</name>! &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] /element() 33
34 Simpler <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">&!!!!<name>switzerland</name>! &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& /name &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] 34
35 Continued <?xml&version="1.0"&encoding="utf98"?>& <countries>& &&<country&code="ch">& &&&&<name>switzerland</name>& &&<country&code="f">& &&&&<name>france</name>& &&<country&code="d">& &&&&<name>germany</name>& &&<country&code="i">& &&&&<name>italy</name>& &&<country&code="a">& &&&&<name>austria</name>& </countries>& doc("myfile.xml") /descendant::country eq "CH"] /name/data() 35
36 Construction (XPath, XQuery) 36
37 Construction: Strings "foo" 37
38 Construction: String Escaping "This is a line and this is a new line" "This is a "quote"" 38
39 Construction: Numbers E23 39
40 Construction: Booleans true() false() 40
41 Construction: Other Simple Types date(" ") datetime(" t05:00:00z") long(" ") 41
42 Construction: XML <foo attr="value"> Text <bar/> <!-- comment --> <?target pi?> </foo> 42
43 XQuery: Basic Operations 43
44 Basic Operations: Sequences concatenation 1, true(), "foo", <bar/> range 1 to
45 Basic Operations: Arithmetics addition substraction multiplication <a>6</a> * 7 division 42.3 div 7.2 integer division 42 idiv 9 module 42 mod 9 45
46 Basic Operations: Strings concatenation "foo" "bar" concat("foo", "bar") string-join( ("foo", "bar", "foobar"), "-" ) sub-string substr("foobar", 4, 3) length string-length("foobar") 46
47 Basic Operations: Value Comparison equality eq 2 inequality 6 * 7 ne 21 * 2 greater than 234 gt ge 123 less than 42.3 lt le
48 Basic Operations: Value Comparison 1. Zero or one item for each operand (1, 2) eq 2 error! 2. Types must be compatible 1 eq "foo" error! 48
49 Basic Operations: General Comparison $doc//country/name = "Switzerland" At least one =!= < > <= <=49
50 Basic Operations: Logics conjunction 1+1 eq 2 and 2+2 eq 4 disjunction 1+1 eq 2 or 2+2 eq 4 not not(100 mod 5 eq 0) universal quantifier existential quantifier every $i in (1 to 10) satisfies $i gt 0 some $i in (1 to 10) satisfies $i eq 3*3 50
51 Basic Operations: Logics 1. It's two-valued logics 2. Non-booleans get converted not("foo") 51
52 Basic Operations: Effective Boolean Value Sequence "" false "foo" Effective Boolean Value (EBV) true 0 false 42 true (<foo/>, <bar/>, 1, "foo") true () false 52
53 Composability 53
54 Rule of Thumb Any Expression can be the operand of any other expression. 54
55 Precedence Precedence (low first) Comma Data Flow (FLWOR, if-then-else, switch...) Logic Comparison String concatenation Range Arithmetic Path expressions Filter predicates, dynamic function calls Literals, constructors and variables Function calls, named function references, inline functions Use parentheses to override or when in doubt! 55
56 XML Construction reloaded <foo attr="{string-length("foobar")}"> { string-join( for $i in 1 to 10 return string($i), "-" ) } </foo> <foo attr="6"> </foo> 56
57 Data Flow (XQuery) 57
58 Conditional Expressions if(count(doc("file.xml")//country) gt 1000) then "Large file!" else "Small file." 58
59 Switch Expressions switch($country/code) case "CH" return ("gsw", "de", "fr", "it", "rm") case "F" return "fr" case "D" return "de" case "I" return "it" default return "en" 59
60 Try Catch Expressions try { xs:integer($country/code) } catch * { "A country code is not an integer!" } 60
61 Alexander Raths / 123RF Stock Photo FLWOR Expressions (XQuery) 61
62 Let clauses let $x := 2 return $x * $x 62
63 Let clauses let $x := 2 let $y := $x + $x let $x := $y + 3 return $x * $x 63
64 For clauses for $x in (1, 2, 4) return $x * $x 64
65 Where clauses for $x in 1 to 10 where $x - 2 gt 5 return $x * $x 65
66 For clauses for $x in 1 to 10 return <square number="{$x}">{ $x * $x }</square> 66
67 Order by clauses for $x in doc("countries.xml")//country order by $x/population return $x/name/data() 67
68 Group by clauses for $x in doc("countries.xml")//country group by $continent := return <continent code="{$continent}">{ for $country in $x return $country/name }</continent> 68
69 Types 69
70 Types Simple types: by name xs:integer Complex types: by kind, similar to XPath element(foo) 70
71 Cardinality xs:integer xs:boolean? element(foo)+ document-node()* 71
72 Type usage let $x as xs:integer := 2 return $x + $x 72
73 Type usage let $x as node() := <foo>2</foo> return $x + $x 73
74 Type usage for $x as element(foo)* in ( <foo>2</foo>, <foo>3</foo> ) return $x + $x 74
75 Type usage for $x as element(foo)* in ( <foo>2</foo>, <foo>3</foo> ) return $x + $x treat as xs:integer 75
76 Type usage for $x as element(foo)* in ( <foo>2</foo>, <foo>3</foo> ) return $x + $x cast as xs:double 76
77 Type usage for $x as element(foo)* in ( <foo>2</foo>, <foo>3</foo> ) return xs:double($x + $x) 77
78 Type usage 3.14 instance of xs:integer 78
79 Type usage 3.14 castable as xs:double 79
80 Type usage declare function local:is-big-data( $threshold as xs:integer, $doc as document-node() ) as xs:boolean { count($doc//*) gt $threshold }; local:is-big-data(1000, doc("big-file.xml") 80
81 Validation import'schema'namespace'm!=! validate!{! <m:math!xmlns:m=" </m:math>! }!! 81
82 Querying JSON (XQuery 3.1 / JSONiq) 82
83 JSON Navigation: Objects let $object := { "foo": 31, "bar" : "ETH" } return $object.foo let $object := map { "foo": 31, "bar" : "ETH" } return $object?foo JSONiq XQuery
84 JSON Navigation: Arrays let $object := { "foo": 31, "bar": [ "ETH", "EPF" ] } return $object.foo[[1]] let $object := map { "foo": 31, "bar": array { "ETH", "EPF" } } return $object?foo?1 JSONiq XQuery
85 JSON Navigation: Arrays let $object := { "foo": 31, "bar": [ "ETH", "EPF" ] } return $object.foo[] let $object := map { "foo": 31, "bar": array { "ETH", "EPF" } } return $object?foo?* JSONiq XQuery
86 JSON Construction: Composability map { "Swiss people" : doc("switzerland.xml") //country/population/data() } 86
87 JSON Construction: XQuery 3.1 and arrays array { 1 to 3, (), 4 to 6 } [ 1, 2, 3, 4, 5, 6 ] [ 1 to 3, (), 4 to 6 ] [ (1, 2, 3), (), (4, 5, 6) ] 87
88 XQuery 3.1 vs. JSONiq XQuery 3.1 JSONiq Primary use case data structures (maps, arrays) document stores (JSON) Keys Any atomic types Strings only Values Any sequences of items Single items Constructor content Preserving identity Copied 88
89 Final examples 89
90 Example 90
91 Titles sorted by price for$$b!in$doc("bib.xml")//book! order$by$xs:float($b/price)!descending,!!!!!!!!!!$b/title!ascending! return$$b/title!! 91
92 Titles sorted by price for$$b!in$doc("bib.xml")//book!!!! 92
93 Titles sorted by price for$$b!in$doc("bib.xml")//book! order$by$xs:float($b/price)!descending,!!!!!!!!!!$b/title!ascending!!! 93
94 Titles sorted by price for$$b!in$doc("bib.xml")//book! order$by$xs:float($b/price)!descending,!!!!!!!!!!$b/title!ascending! return$$b/title!! 94
95 Exercise 1: How many books written by Stevens? doc("bib.xml")//book+ 95
96 How many books written by Stevens? doc("bib.xml")//book[author,=,"stevens"], 96
97 How many books written by Abiteboul? 2 count(doc("bib.xml")//book[author,=,"stevens"]), 97
98 Number of books by author doc("bib.xml")** 98
99 Number of books by author doc("bib.xml")//author
100 Number of books by author for$$a!in$doc("bib.xml")//author/data()! 100
101 Number of books by author for$$a!in$distinct' values(doc("bib.xml")//author)!!!!! 101
102 Number of books by author <?xml version="1.0" encoding="utf-8"?> <res> <name>stevens</name> </res> <res> <name>abiteboul</name> </res> <res> <name>buneman</name> </res> <res> <name>suciu</name> </res> for$$a!in$distinct' values(doc("bib.xml")//author)! return$<res>!!!<name>{$a}</name>!!!<count>!!!{!!!!!count(doc("bib.xml")//book[author!=!$a])!!!}!!!</count>! </res>!!!! 102
103 Number of books by author <?xml version="1.0" encoding="utf-8"?> <res> <name>stevens</name> <count>2</count> </res> <res> <name>abiteboul</name> <count>2</count> </res> <res> <name>buneman</name> <count>1</count> </res> <res> <name>suciu</name> <count>1</count> </res> for$$a!in$distinct' values(doc("bib.xml")//author)! return$<res>!!!<name>{$a}</name>!!!<count>!!!{!!!!!count(doc("bib.xml")//book[author!=!$a])!!!}!!!</count>! </res>!!!! 103
104 Not covered Higher-order functions Computed constructors Count clause Window clause Node comparison Errors Typeswitch 104
105 There s more XQuery Updates XQuery Full-Text XQuery Scripting insert node <foo/> into $doc/bar /books/book[@number="1"]/title contains text "improve" using stemming while ($x gt 0) { $x := $x 1; } 105
Big Data 12. Querying
Ghislain Fourny Big Data 12. Querying pinkyone / 123RF Stock Photo Declarative Languages What vs. How 2 Functional Languages for let order by if + any else = then every while where return exit with Expression
More informationProgress Report on XQuery
Progress Report on XQuery Don Chamberlin Almaden Research Center May 24, 2002 History Dec. '98: W3C sponsors workshop on XML Query Oct. '99: W3C charters XML Query working group Chair: Paul Cotton About
More informationAdvanced Database Technologies XQuery
Advanced Database Technologies XQuery Christian Grün Database & Information Systems Group Introduction What is XQuery? query language (more than a) counterpart to SQL functional language general purpose
More informationBig Data Exercises. Fall 2016 Week 9 ETH Zurich
Big Data Exercises Fall 2016 Week 9 ETH Zurich Introduction This exercise will cover XQuery. You will be using oxygen (https://www.oxygenxml.com/xml_editor/software_archive_editor.html), AN XML/JSON development
More informationXQuery. Leonidas Fegaras University of Texas at Arlington. Web Databases and XML L7: XQuery 1
XQuery Leonidas Fegaras University of Texas at Arlington Web Databases and XML L7: XQuery 1 XQuery Influenced by SQL Based on XPath Purely functional language may access elements from documents, may construct
More informationNavigating Input Documents Using Paths4
Chapter 4 CHAPTER 4 Navigating Input Documents Using Paths4 Path expressions are used to navigate input documents to select elements and attributes of interest. This chapter explains how to use path expressions
More informationParte IV: XPATH. Prof. Riccardo Torlone
BASI DI DATI II 2 modulo Parte IV: XPATH Prof. Riccardo Torlone Università Roma Tre Outline Location steps and paths Typical locations paths Abbreviations General expressions Riccardo Torlone: Basi di
More informationBASI DI DATI II 2 modulo
BASI DI DATI II 2 modulo COMPLMNTI DI BASI DI DATI Parte IV: XPATH Prof. Riccardo Torlone Università Roma Tre Outline Location steps and paths Typical locations paths Abbreviations General expressions
More informationIntroduction to XQuery. Overview. Basic Principles. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar..
.. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar.. Overview Introduction to XQuery XQuery is an XML query language. It became a World Wide Web Consortium Recommendation in January 2007,
More informationTDDD43. Theme 1.2: XML query languages. Fang Wei- Kleiner h?p:// TDDD43
Theme 1.2: XML query languages Fang Wei- Kleiner h?p://www.ida.liu.se/~ Query languages for XML Xpath o Path expressions with conditions o Building block of other standards (XQuery, XSLT, XLink, XPointer,
More informationAnders Møller & Michael I. Schwartzbach 2006 Addison-Wesley
Anders Møller & Michael I. Schwartzbach 2006 Addison-Wesley Location steps and paths Typical locations paths Abbreviations General expressions 2 Flexible notation for navigating around trees A basic technology
More informationXPath and XQuery. Introduction to Databases CompSci 316 Fall 2018
XPath and XQuery Introduction to Databases CompSci 316 Fall 2018 2 Announcements (Tue. Oct. 23) Homework #3 due in two weeks Project milestone #1 feedback : we are a bit behind, but will definitely release
More informationXML databases. Jan Chomicki. University at Buffalo. Jan Chomicki (University at Buffalo) XML databases 1 / 9
XML databases Jan Chomicki University at Buffalo Jan Chomicki (University at Buffalo) XML databases 1 / 9 Outline 1 XML data model 2 XPath 3 XQuery Jan Chomicki (University at Buffalo) XML databases 2
More informationPre-Discussion. XQuery: An XML Query Language. Outline. 1. The story, in brief is. Other query languages. XML vs. Relational Data
Pre-Discussion XQuery: An XML Query Language D. Chamberlin After the presentation, we will evaluate XQuery. During the presentation, think about consequences of the design decisions on the usability of
More informationSeleniet XPATH Locator QuickRef
Seleniet XPATH Locator QuickRef Author(s) Thomas Eitzenberger Version 0.2 Status Ready for review Page 1 of 11 Content Selecting Nodes...3 Predicates...3 Selecting Unknown Nodes...4 Selecting Several Paths...5
More informationXML Technologies. Doc. RNDr. Irena Holubova, Ph.D. Web pages:
XML Technologies Doc. RNDr. Irena Holubova, Ph.D. holubova@ksi.mff.cuni.cz Web pages: http://www.ksi.mff.cuni.cz/~holubova/nprg036/ Outline Introduction to XML format, overview of XML technologies DTD
More informationBig Data 9. Data Models
Ghislain Fourny Big Data 9. Data Models pinkyone / 123RF Stock Photo 1 Syntax vs. Data Models Physical view Syntax this is text. 2 Syntax vs. Data Models a Logical view
More informationCourse: The XPath Language
1 / 27 Course: The XPath Language Pierre Genevès CNRS University of Grenoble, 2012 2013 2 / 27 Why XPath? Search, selection and extraction of information from XML documents are essential for any kind of
More informationBig Data for Engineers Spring Data Models
Ghislain Fourny Big Data for Engineers Spring 2018 11. Data Models pinkyone / 123RF Stock Photo CSV (Comma separated values) This is syntax ID,Last name,first name,theory, 1,Einstein,Albert,"General, Special
More informationXPath. Lecture 36. Robb T. Koether. Wed, Apr 16, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, / 28
XPath Lecture 36 Robb T. Koether Hampden-Sydney College Wed, Apr 16, 2014 Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, 2014 1 / 28 1 XPath 2 Executing XPath Expressions 3 XPath Expressions
More informationIntroduction to XQuery and XML Databases
Introduction to XQuery and XML Databases TEI@Oxford July 2009 XQuery While XSLT is good for transforming XML to other formats (XML, HTML, PDF, Text, etc.) sometimes you may wish to query a large database
More informationXPath. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University
XPath Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Dept. of Computer Engineering Khon Kaen University 1 Overview What is XPath? Queries The XPath Data Model Location Paths Expressions
More informationOne of the main selling points of a database engine is the ability to make declarative queries---like SQL---that specify what should be done while
1 One of the main selling points of a database engine is the ability to make declarative queries---like SQL---that specify what should be done while leaving the engine to choose the best way of fulfilling
More informationSemi-structured Data. 8 - XPath
Semi-structured Data 8 - XPath Andreas Pieris and Wolfgang Fischl, Summer Term 2016 Outline XPath Terminology XPath at First Glance Location Paths (Axis, Node Test, Predicate) Abbreviated Syntax What is
More informationOutline of this part (I) Part IV. Querying XML Documents. Querying XML Documents. Outline of this part (II)
Outline of this part (I) Part IV Querying XML Documents Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2007/08 164 8 XPath Navigational access to XML documents Overview Context Location steps Navigation
More informationModule 4. Implementation of XQuery. Part 1: Overview of Compiler, Runtime System
Module 4 Implementation of XQuery Part 1: Overview of Compiler, Runtime System Now let us talk XQuery Compile Time + Optimizations Operator Models Query Rewrite Runtime + Query Execution XML Data Representation
More informationXML Query Languages. Yanlei Diao UMass Amherst April 22, Slide content courtesy of Ramakrishnan & Gehrke, Donald Kossmann, and Gerome Miklau
XML Query Languages Yanlei Diao UMass Amherst April 22, 2008 Slide content courtesy of Ramakrishnan & Gehrke, Donald Kossmann, and Gerome Miklau 1 Querying XML How do you query a directed graph? a tree?
More informationXML. Semi-structured data (SSD) SSD Graphs. SSD Examples. Schemas for SSD. More flexible data model than the relational model.
Semi-structured data (SSD) XML Semistructured data XML, DTD, (XMLSchema) XPath, XQuery More flexible data model than the relational model. Think of an object structure, but with the type of each object
More informationCourse: The XPath Language
1 / 30 Course: The XPath Language Pierre Genevès CNRS University of Grenoble Alpes, 2017 2018 2 / 30 Why XPath? Search, selection and extraction of information from XML documents are essential for any
More informationInformation Systems. XQuery. Nikolaj Popov
Information Systems XQuery Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at What Is XQuery The purpose of XQuery is to provide
More informationPart X. XQuery Querying XML Documents
Part X XQuery Querying XML Documents Torsten Grust (WSI) Database-Supported XML Processors Winter 2012/13 238 Outline of this part 1 XQuery Declarative querying over XML documents Introduction Preliminaries
More informationPart X. XQuery Querying XML Documents. Torsten Grust (WSI) Database-Supported XML Processors Winter 2008/09 246
Part X XQuery Querying XML Documents Torsten Grust (WSI) Database-Supported XML Processors Winter 2008/09 246 Outline of this part 1 XQuery Declarative querying over XML documents Introduction Preliminaries
More informationH2 Spring B. We can abstract out the interactions and policy points from DoDAF operational views
1. (4 points) Of the following statements, identify all that hold about architecture. A. DoDAF specifies a number of views to capture different aspects of a system being modeled Solution: A is true: B.
More informationXQuery Expressions to AST Conversion
XQuery essions to Conversion Warren Wong Chavdar Botev Feng Shao January, 2004 Copyright (C) 2003-2005 Cornell University. All Rights Reserved. Table of Contents IntegerLiteral... 4 Grammar ession... 4...
More informationDBS2: Exkursus XQuery and XML-Databases. Jan Sievers Jens Hündling Lars Trieloff
DBS2: Exkursus XQuery and XML-Databases Jan Sievers Jens Hündling Lars Trieloff Motivation XML ubiquitous data exchange format Can be used to present Object data, relational data, semi-structured data
More informationThe XQuery Data Model
The XQuery Data Model 9. XQuery Data Model XQuery Type System Like for any other database query language, before we talk about the operators of the language, we have to specify exactly what it is that
More informationNotes on XML and XQuery in Relational Databases
xquery.txt Tue Apr 04 11:29:26 2017 1 Notes on XML and XQuery in Relational Databases Owen Kaser March 22, 2016. Updated April 4, 2017 some code frags are untested! As usual, the idea is to give you a
More informationInformatics 1: Data & Analysis
T O Y H Informatics 1: Data & Analysis Lecture 11: Navigating XML using XPath Ian Stark School of Informatics The University of Edinburgh Tuesday 26 February 2013 Semester 2 Week 6 E H U N I V E R S I
More informationNavigation. 3.1 Introduction. 3.2 Paths
03Brundage_ch03.qxd 1/8/04 1:09 PM Page 63 C H A P T E R 3 Navigation 3.1 Introduction Once you ve constructed or loaded XML in a query, you need a way to navigate over that hierarchical data. In many
More informationXPath Lecture 34. Robb T. Koether. Hampden-Sydney College. Wed, Apr 11, 2012
XPath Lecture 34 Robb T. Koether Hampden-Sydney College Wed, Apr 11, 2012 Robb T. Koether (Hampden-Sydney College) XPathLecture 34 Wed, Apr 11, 2012 1 / 20 1 XPath Functions 2 Predicates 3 Axes Robb T.
More informationAuthor: Irena Holubová Lecturer: Martin Svoboda
A7B36XML, AD7B36XML XML Technologies Lecture 4 XPath, SQL/XML 24. 3. 2017 Author: Irena Holubová Lecturer: Martin Svoboda http://www.ksi.mff.cuni.cz/~svoboda/courses/2016-2-a7b36xml/ Lecture Outline XPath
More informationXML & Databases. Tutorial. 3. XPath Queries. Universität Konstanz. Database & Information Systems Group Prof. Marc H. Scholl
XML & Databases Tutorial Christian Grün, Database & Information Systems Group University of, Winter 2007/08 XPath Introduction navigational access to XML documents sub-language in XQuery, XSLT, or XPointer
More informationBig Data Fall Data Models
Ghislain Fourny Big Data Fall 2018 11. Data Models pinkyone / 123RF Stock Photo CSV (Comma separated values) This is syntax ID,Last name,first name,theory, 1,Einstein,Albert,"General, Special Relativity"
More informationBig Data 11. Data Models
Ghislain Fourny Big Data 11. Data Models pinkyone / 123RF Stock Photo CSV (Comma separated values) This is syntax ID,Last name,first name,theory, 1,Einstein,Albert,"General, Special Relativity" 2,Gödel,Kurt,"""Incompleteness""
More informationPart VII. Querying XML The XQuery Data Model. Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153
Part VII Querying XML The XQuery Data Model Marc H. Scholl (DBIS, Uni KN) XML and Databases Winter 2005/06 153 Outline of this part 1 Querying XML Documents Overview 2 The XQuery Data Model The XQuery
More informationDocumentation for Quark xquery_model and related libraries Pet-Chean Ang and Anand Bhaskar 30 th May 2005
Documentation for Quark xquery_model and related libraries Pet-Chean Ang and Anand Bhaskar 30 th May 2005 Copyright (C) 2003-2005 Cornell University. All Rights Reserved. This documentation describes the
More informationControl Structures. CIS 118 Intro to LINUX
Control Structures CIS 118 Intro to LINUX Basic Control Structures TEST The test utility, has many formats for evaluating expressions. For example, when given three arguments, will return the value true
More informationInformation Systems (Informationssysteme)
Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2013 c Jens Teubner Information Systems Summer 2013 1 Part IX XML Processing c Jens Teubner Information
More informationXPath. Mario Alviano A.Y. 2017/2018. University of Calabria, Italy 1 / 21
1 / 21 XPath Mario Alviano University of Calabria, Italy A.Y. 2017/2018 Outline 2 / 21 1 Introduction 2 XPath expressions Path expressions Value expressions Node set expressions 3 Examples 4 Exercises
More informationXML Data Management. 5. Extracting Data from XML: XPath
XML Data Management 5. Extracting Data from XML: XPath Werner Nutt based on slides by Sara Cohen, Jerusalem 1 Extracting Data from XML Data stored in an XML document must be extracted to use it with various
More informationA Modular modular XQuery implementation
A Modular modular XQuery implementation Implementation Jan Vraný, Jan Jan Vraný, Jan Žák Žák Department of Computer Science and Engineering, FEE, Czech Technical University Department of Computer in Prague,
More informationXPath Expression Syntax
XPath Expression Syntax SAXON home page Contents Introduction Constants Variable References Parentheses and operator precedence String Expressions Boolean Expressions Numeric Expressions NodeSet expressions
More informationTable of Contents Chapter 1 - Introduction Chapter 2 - Designing XML Data and Applications Chapter 3 - Designing and Managing XML Storage Objects
Table of Contents Chapter 1 - Introduction 1.1 Anatomy of an XML Document 1.2 Differences Between XML and Relational Data 1.3 Overview of DB2 purexml 1.4 Benefits of DB2 purexml over Alternative Storage
More informationXQuery 1.0: An XML Query Language
XQuery 1.0: An XML Query Language W3C Recommendation 23 January 2007 This version: Latest version: http://www.w3.org/tr/2007/rec-xquery-20070123/ http://www.w3.org/tr/xquery/ Previous version: http://www.w3.org/tr/2006/pr-xquery-20061121/
More informationTable of Contents. Preface... xvii
Table of Contents Preface...................................................................... xvii 1. Introduction to XQuery....................................................... 1 What Is XQuery? 1
More informationNavigating an XML Document
University of Dublin Trinity College Navigating an XML Document Owen.Conlan@scss.tcd.ie Athanasios.Staikopoulos@scss.tcd.ie What is XPath? Language for addressing parts of an XML document Used in XSLT,
More informationComputer Science E-259
Computer Science E-259 XML with Java Lecture 4: XPath 1.0 (and 2.0) and XSLT 1.0 (and 2.0) 21 February 2007 David J. Malan malan@post.harvard.edu 1 Computer Science E-259 Last Time DOM Level 3 JAXP 1.3
More informationScheme Tutorial. Introduction. The Structure of Scheme Programs. Syntax
Scheme Tutorial Introduction Scheme is an imperative language with a functional core. The functional core is based on the lambda calculus. In this chapter only the functional core and some simple I/O is
More informationXML Data Management. 6. XPath 1.0 Principles. Werner Nutt
XML Data Management 6. XPath 1.0 Principles Werner Nutt 1 XPath Expressions and the XPath Document Model XPath expressions are evaluated over documents XPath operates on an abstract document structure
More information2006 Martin v. Löwis. Data-centric XML. XPath
Data-centric XML XPath XPath Overview Non-XML language for identifying particular parts of XML documents First person element of a document Seventh child element of third person element ID attribute of
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationTitle:[ Variables Comparison Operators If Else Statements ]
[Color Codes] Environmental Variables: PATH What is path? PATH=$PATH:/MyFolder/YourStuff?Scripts ENV HOME PWD SHELL PS1 EDITOR Showing default text editor #!/bin/bash a=375 hello=$a #No space permitted
More informationQuerying XML. COSC 304 Introduction to Database Systems. XML Querying. Example DTD. Example XML Document. Path Descriptions in XPath
COSC 304 Introduction to Database Systems XML Querying Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Querying XML We will look at two standard query languages: XPath
More informationSolution Sheet 5 XML Data Models and XQuery
The Systems Group at ETH Zurich Big Data Fall Semester 2012 Prof. Dr. Donald Kossmann Prof. Dr. Nesime Tatbul Assistants: Martin Kaufmann Besmira Nushi 07.12.2012 Solution Sheet 5 XML Data Models and XQuery
More informationQuery Languages for XML
Query Languages for XML XPath XQuery 1 The XPath/XQuery Data Model Corresponding to the fundamental relation of the relational model is: sequence of items. An item is either: 1. A primitive value, e.g.,
More informationJSON & MongoDB. Introduction to Databases CompSci 316 Fall 2018
JSON & MongoDB Introduction to Databases CompSci 316 Fall 2018 2 Announcements (Tue. Oct. 30) Homework #3 due next Tuesday Project milestone #2 due next Thursday See email about new requirement on weekly
More informationUser s Guide for BDDs in Jython
User s Guide for BDDs in Jython Mark Greenstreet, January 29, 2013 1 Overview I ll add something here about downloading the package, running it on UBC CS department machines, etc. 2 Class SymBool Class
More informationInformatics 1: Data & Analysis
Informatics 1: Data & Analysis Lecture 11: Navigating XML using XPath Ian Stark School of Informatics The University of Edinburgh Tuesday 23 February 2016 Semester 2 Week 6 http://blog.inf.ed.ac.uk/da16
More informationXQuery. Announcements (March 21) XQuery. CPS 216 Advanced Database Systems
XQuery CPS 216 Advanced Database Systems Announcements (March 21) 2 Midterm has been graded Homework #3 will be assigned next Tuesday Reading assignment due next Wednesday XML processing in Lore (VLDB
More informationOverview: XQuery 3.0
XQuery 3.0 Overview: XQuery 3.0 Fix shortcomings of XQuery 1.0, not a radical change Better align XPath 3.0, XSLT 3.0, XQuery 3.0 (thus the version!) Properly incorporate some of the best ideas from other
More informationChapter 8 XQuery. Recent Developments for Data Models
Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 8 XQuery Recent Developments for Data Models Outline Overview
More informationXPath Basics. Mikael Fernandus Simalango
XPath Basics Mikael Fernandus Simalango Agenda XML Overview XPath Basics XPath Sample Project XML Overview extensible Markup Language Constituted by elements identified by tags and attributes within Elements
More informationA Light but Formal Introduction to XQuery
A Light but Formal Introduction to XQuery Jan Hidders, Jan Paredaens, Roel Vercammen, and Serge Demeyer University of Antwerp, Middelheimlaan 1, BE-2020 Antwerp, Belgium {jan.hidders,jan.paredaens,roel.vercammen,serge.demeyer}@ua.ac.be
More informationYFilter: an XML Stream Filtering Engine. Weiwei SUN University of Konstanz
YFilter: an XML Stream Filtering Engine Weiwei SUN University of Konstanz 1 Introduction Data exchange between applications: use XML Messages processed by an XML Message Broker Examples Publish/subscribe
More informationXML Path Language (XPath)
2.0 W3C Recommendation 23 January 2007 This version: Latest version: http://www.w3.org/tr/2007/rec-xpath20-20070123/ http://www.w3.org/tr/xpath20/ Previous version: http://www.w3.org/tr/2006/pr-xpath20-20061121/
More informationBEAWebLogic. Integration. Transforming Data Using XQuery Mapper
BEAWebLogic Integration Transforming Data Using XQuery Mapper Version: 10.2 Document Revised: March 2008 Contents Introduction Overview of XQuery Mapper.............................................. 1-1
More informationMarker s feedback version
Two hours Special instructions: This paper will be taken on-line and this is the paper format which will be available as a back-up UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Semi-structured Data
More informationXQuery Update. An Update Copyright 2008, Oracle Corp. 1
XQuery Update An Update 2008-05-07 Copyright 2008, Oracle Corp. 1 Your Humble Presenter Editor, all part of SQL standard, > 20 years Co-Chair W3C XML Query WG [Co-]Editor of ½-dozen XQuery-related docs
More informationESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 1 IDL Operators
ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 1 IDL Operators ARITHMATIC OPERATORS The assignment operator in IDL is the equals sign, =. IDL uses all the familiar arithmetic operators
More informationXPath and XSLT. Overview. Context. Context The Basics of XPath. XPath and XSLT. Nodes Axes Expressions. Stylesheet templates Transformations
XPath and XSLT Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu/~spring Context The Basics of XPath Nodes
More informationTranscript of Abel Braaksma's Talk on XSLT Streaming at XML Prague 2014
Transcript of Abel Braaksma's Talk on XSLT Streaming at XML Prague 2014 The video of Abel's talk is here: http://www.youtube.com/watch?v=kaupzeew4xg&t=318m25s Abel's slides are here: http://exselt.net/portals/1/streaming%20for%20the%20masses.zip
More informationExample using multiple predicates
XPath Example using multiple predicates //performance[conductor][date] L C C C C p c s p p s o t d p p c p p Peter Wood (BBK) XML Data Management 162 / 366 XPath Further examples with predicates //performance[composer='frederic
More informationXML: Extensible Markup Language
XML: Extensible Markup Language CSC 375, Fall 2015 XML is a classic political compromise: it balances the needs of man and machine by being equally unreadable to both. Matthew Might Slides slightly modified
More informationFOXpath - an expression language for selecting files and folders
Link to the Balisage Proceedings Home Page at http://www.balisage.net/proceedings Link to this paper (entry page with links) at http://www.balisage.net/proceedings/vol17/html/rennau01/balisagevol17-rennau01.html
More informationVariable Scope The Main() Function Struct Functions Overloading Functions Using Delegates Chapter 7: Debugging and Error Handling Debugging in Visual
Table of Contents Title Page Introduction Who This Book Is For What This Book Covers How This Book Is Structured What You Need to Use This Book Conventions Source Code Errata p2p.wrox.com Part I: The OOP
More informationCOPYRIGHTED MATERIAL. Contents. Part I: Introduction 1. Chapter 1: What Is XML? 3. Chapter 2: Well-Formed XML 23. Acknowledgments
Acknowledgments Introduction ix xxvii Part I: Introduction 1 Chapter 1: What Is XML? 3 Of Data, Files, and Text 3 Binary Files 4 Text Files 5 A Brief History of Markup 6 So What Is XML? 7 What Does XML
More informationXML Databases 6. XML Query Languages II
XML Databases 6. XML Query Languages II Silke Eckstein Andreas Kupfer Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de 6. XML Query Languages II 6.1 Introduction
More informationXQ: An XML Query Language Language Reference Manual
XQ: An XML Query Language Language Reference Manual Kin Ng kn2006@columbia.edu 1. Introduction XQ is a query language for XML documents. This language enables programmers to express queries in a few simple
More informationQuerying XML Documents. Organization of Presentation
Querying XML Documents Paul Cotton, Microsoft Canada University of Waterloo Feb 1, 2002 1 Organization of Presentation XML query history XML Query WG history, goals and status XML Query working drafts
More informationSemantic Characterizations of XPath
Semantic Characterizations of XPath Maarten Marx Informatics Institute, University of Amsterdam, The Netherlands CWI, April, 2004 1 Overview Navigational XPath is a language to specify sets and paths in
More informationChapter 1: Semistructured Data Management XML
Chapter 1: Semistructured Data Management XML XML - 1 The Web has generated a new class of data models, which are generally summarized under the notion semi-structured data models. The reasons for that
More informationMixed Integer Linear Programming
Mixed Integer Linear Programming Part I Prof. Davide M. Raimondo A linear program.. A linear program.. A linear program.. Does not take into account possible fixed costs related to the acquisition of new
More informationXML and Databases. Lecture 10 XPath Evaluation using RDBMS. Sebastian Maneth NICTA and UNSW
XML and Databases Lecture 10 XPath Evaluation using RDBMS Sebastian Maneth NICTA and UNSW CSE@UNSW -- Semester 1, 2009 Outline 1. Recall pre / post encoding 2. XPath with //, ancestor, @, and text() 3.
More informationReading XML: Introducing XPath. Andrew Walker
Reading XML: Introducing XPath Andrew Walker Why? Makes writing analysis scripts for your XML encoded results easy. Is used by many other XML technologies. XSLT, XPointer etc. A Fortran XPath API is in
More informationLanguage Specification 0.4 JSONiq
Language Specification 0.4 JSONiq XQuery for JSON, JSON for XQuery Jonathan Robie Ghislain Fourny Matthias Brantner Daniela Florescu Till Westmann Markos Zaharioudakis JSONiq Language Specification 0.4
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationPart XII. Mapping XML to Databases. Torsten Grust (WSI) Database-Supported XML Processors Winter 2008/09 321
Part XII Mapping XML to Databases Torsten Grust (WSI) Database-Supported XML Processors Winter 2008/09 321 Outline of this part 1 Mapping XML to Databases Introduction 2 Relational Tree Encoding Dead Ends
More informationSyntax of Eiffel: a Brief Overview
Syntax of Eiffel: a Brief Overview EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG Escape Sequences Escape sequences are special characters to be placed in your program text. In Java, an escape sequence
More informationThe PCAT Programming Language Reference Manual
The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language
More informationXPath. Web Data Management and Distribution. Serge Abiteboul Philippe Rigaux Marie-Christine Rousset Pierre Senellart
XPath Web ata Management and istribution Serge Abiteboul Philippe Rigaux MarieChristine Rousset Pierre Senellart INRIA Saclay, Univ. Parisauphine, Univ. Grenoble, TELECOM ParisTech http://gemo.futurs.inria.fr/wdmd
More information