Advanced Database Technologies XQuery

Size: px
Start display at page:

Download "Advanced Database Technologies XQuery"

Transcription

1 Advanced Database Technologies XQuery Christian Grün Database & Information Systems Group

2 Introduction What is XQuery? query language (more than a) counterpart to SQL functional language general purpose language? information processing language Alternatives XPath: subset XSLT: comparable features, but specialized on transformations; more verbose SQL 2005: combines SQL and XQuery 2

3 Introduction Features browsing, selecting and filtering data sorting, grouping, aggregating contents working across many documents (collections) XQuery Update: modify collections XQuery Full Text: information retrieval in XML corpora brings databases and information retrieval closer together 3

4 Introduction Functional Language prominent examples: Scheme, Haskell, OCAML, R based on the evaluation of functions: one input, one output no side effects (that would change the state of a program) higher-order functions: functions as arguments iteration recursion XQuery 3.0 is a fully functional language (although some extensions break the rules) 4

5 XQuery Data Model Sequences all XQuery expressions evaluate to sequences lists of items with zero or more values: ("different",2,"types"); <H>U</H>; () sequences without values: empty sequences sequences are ordered: (1,2) (2,1) may contain duplicates (in contrast to XPath) cannot be nested: (1,(2,3),4) (1,2,3,4) 5

6 XQuery Data Model Data Types items: atomic values or nodes nodes: XML constructs elements, attributes,... atomic values: integer, double, string,... sequences: ordered lists of zero or more items Brundage [2004] 6

7 XQuery Data Model XML Node Types document nodes <element> elements <e id="0">text</e> <!-- important --> attributes <?php echo "pi";?> texts </element> comments processing instructions text test.xml element e <! > <?...?> id="0" 7

8 XQuery Data Model Atomic Values the complete picture... in practice, a few types suffice: xs:integer, xs:decimal, xs:double xs:string xs:boolean xs:date, xs:time xs:duration what is xs:untypedatomic? XQuery Data Model,

9 XQuery Data Model Untyped Data no schema information is available no explicit type has been assigned: data(<xml>text</xml>), data(doc("doc.xml")) Typed Data XQuery primitives, explicit assignment: xs:decimal: xs:string: "!" xs:date: xs:date(" ") 9

10 XQuery Data Model Creating Atomic Values literals (see later): "string", 0.98 explicit type assignment: xs:string("string"), xs:byte(127), xs:datetime(" t23:59:59") resulting from function call: true() xs:boolean max((1, 2, 5, 10, 20, 50, 100)) xs:integer 10

11 Expressions Primary Expressions literals, variables, function calls, parentheses Arithmetics, Comparisons numeric and date comparisons comparisons based on values or document order Logical Expressions Boolean operators Sequence Operators set-based operations Constructors direct and computed node construction 11

12 Primary Expressions Literals (Constants) string: "example" integer: 1234 decimal: double: 12.3e4 Variables dollar syntax with optional prefixes: $a, $pf:b Function Calls function name, arguments: doc("input.xml") local:function(99) Comments enclosed by (: smileys (: can be nested :) :) 12

13 Arithmetic Expressions Addition, Subtraction numbers: dates: date(" ") + xs:duration("p9y") strings: concat("and ","some ","more") Multiplication, (Integer) Division, Modulo 4 * 5 div 6, 7 idiv 8, 9 mod 10 13

14 Comparison Expressions Value Comparisons operators: eq, ne, lt, le, gt, ge always compares single atomic values () is returned if either operand is empty sequence operands need to have the same type Examples 3 gt 4 () ne () "a" le "b" "123" eq 123 <x>1</x> lt 2 (1,2,3) eq (1,2,3) 14

15 Comparison Expressions General Comparisons operators: =,!=, <, <=, >, >= compares all sequence values to each other returns true if at least one combination yields true untyped values are implicitly cast to relevant type Examples 3 > 4 () = () ()!= () "a" <= "b" "123" = 123 <x>1</x> < 2 (1,2,3) > (3,2,1) 15

16 Comparison Expressions Node Comparisons operators: is, <<, >> compares nodes based on their identity, which represents the node order document can be opened multiple times identity differs for constructors Examples doc("input.xml") is doc("input.xml") doc("input.xml")/a << doc("input.xml")/b doc("x") >> doc("x") <x/> is <x/> <x/> << <x/> <x/> >> <x/> 16

17 Conditional Expressions If/then/else Expression Syntax: if(test) then expr1 else expr2 nested syntax: if(test1) then expr1 else if(test2) then expr1 else expr2 Effective Boolean Value Test is evaluated as boolean: strings: string length > 0 numbers: different to 0 boolean: adopted as is empty sequence:false node sequences: true other items/sequences: 17

18 Conditional Expressions Switch Expression introduced with XQuery 3.0 Syntax: switch(test) case case1 return expr1... default return defaultexpr Typeswitch Expression tests type of input value Syntax: typewitch(test) case type return expr1... default return defaultexpr 18

19 Sequence Types Type Cast convert types to another type: "1" cast as xs:integer xs:integer("1") = 1 "0815" cast as xs:byte Type Cast Test check if cast is possible: "0815" castable as xs:byte Instance Check check types: (1,2,3) instance of xs:integer+ 19

20 Logical Expressions And/or Expressions Syntax: expr1 and expr2 expr1 or expr2 performs boolean tests expressions can be arbitrarily nested Functions true() / false() creates boolean value boolean(expr) converts expr to effective boolean value not(expr) inverses boolean empty(expr) / exists(expr) checks if sequence contains items 20

21 Sequence Expressions Quantifiers Syntax: some var in expr satisfies test every var in expr satisfies test Example some $v in (0, 2, 4, 5) satisfies $v mod 2 = 1 Combining Sequences Syntax: seq1 union seq2 seq1 intersect seq2 seq1 except seq2 Range Expression Syntax: min to max reverse(1 to 100) 21

22 Filters and Predicates Predicates [...] used to filter expressions evaluated as effective boolean values applied from left to right Context Item. references currently processed item (one by one) Examples "A"["will be true"] //X[text = "relevant"] (1 to 10)[. mod 2 = 1] (1 to 10)[.*. > 20] [.+. < 20] (1 to 20)[.*. > 20 and.+. < 20] 22

23 Filters and Predicates Positional Predicates filters items based on current context position comparable to array offsets predicate order is important! Functions position() yields current pos. last() chooses last position Examples (1 to 10)[1] (1 to 10)[2][1] (1 to 10)[1][2]...[position() = 1]...[position() = 1 to 5]...[last()] 23

24 FLWOR Expressions clauses: For, Let, Where, Order by, Return step by step evaluation of sequences iterative binding of variables Examples for $n in reverse(1 to 10) for $n in 1 to 10 let $p := $n * $n where $n * $n > 40 where $p > 40 order by $n descending return $p return $n * $n What is the output of the two expressions? 24

25 FLWOR Expressions Nested FLWOR Expressions for $a in 1 to 4 for $b in 1 to 3 where $a * $b > 8 return for $c in 1 to 2 let $d := ($a, $b, $c) return <hit>{ $d }</hit> TIMTOWTDI (Larry Wall) Equivalent Example for $c in 1 to 2 for $b in 1 to 3 for $a in 1 to 4 where $a * $b > 8 order by $a, $b, $c return <hit>{ ($a, $b, $c) }</hit> 25

26 FLWOR Expressions XQuery vs XPath XQuery for $movie in doc("library.xml")//movie return $movie XPath doc("library.xml")//movie XQuery XPath for $movie in doc("library.xml")//movie let $title := $movie/title where $title = "Juha" return $movie doc("library.xml")//movie[title = "Juha"] 26

27 FLWOR Expressions XQuery vs XPath XQuery for $movie in doc("library.xml")//movie let $title := $movie/title where starts-with($title, "La ") order by $title return <hit id="{ }">{ $title }</hit> XPath... doc("library.xml")//movie[starts-with(title, "La ")] No XPath equivalent for order/group by, node construction,... 27

28 Variable Assignments Global Variables defined in the query header: declare variable $var := expr; may also be defined as external Local Variables part of FLWOR, quantifier, typeswitch and someother expressions Shadowing variables are always final variables with the same name will be shadowed Example declare variable $a:= 1; let $a:= 12 return ( (let $a := $a * $a return $a), $a), $a 28

29 Try/Catch Expression Handling Errors supported since XQuer y 3.0 provides error handling Generic Case try { expr1 } catch * { expr2 } Catching Specific Errors try { expr1 } catch code { expr2 } Catching Additional Information try { expr1 } catch code($code, $desc) { expr2 } 29

30 Constructors Direct Constructors XML nodes can be constructed on-the-fly iterative binding of variables simple XML snippets (without prolog and CDATA blocks) are valid XQuery expressions Example creation of an element, attribute, and text node: <node1 id="0">direct Constructor</node1> 30

31 Constructors Embedding XQuery Expressions arbitrary XQuery expressions can be embedded in curly brackets Example <result>{ for $n in 1 to 10 return <counter id="{ $n }">{ format-integer($n, "w") }</counter> }</result> 31

32 Constructors Computed Constructors more verbose syntax used for constructing dynamic XML contents Example creation of an element, attribute and text node: element { concat("node", 1) } { attribute { "id" } { "0" }, text { "Computed Constructor" } } 32

33 Functions Function Libraries XQuery core is extended by function libraries by default, about 150 functions are available default functions use (optional) fn prefix: fn:true() true() BaseX offers appr. 70 additional functions, which use custom prefixes: Java binding can be used to access arbitrary Java functions 33

34 Input Functions Open document node doc("doc.xml") Open collection (sequence of document nodes) collection("docs") Open docs from database db:open("database") Convert XML string to node parse-xml("<xml/>") Parse text file file:read-text("file.txt") Parse binary file file:read-binary( "file.bin") Open zipped XML document zip:xml-entry( "archive.zip", "doc.xml") 34

35 Output Functions Serialize XML to string serialize(//product) Write to file file:write( "doc.xml", <xml/>) file:write( "range.txt", 1 to 100) file:write-binary( "file.bin", xs:base64binary("selq")) Measure performance util:ms(1 to ) util:mb(1 to 1000,true()) Show debugging output for $i in 1 to 10 return trace($i,"debug:") Raise error if ($n > 1000) then error() else $n 35

36 String Functions Find substrings contains("chekhov", "hek") Return string length string-length("camus") Change case lower-case("dostoyevsky") upper-case("bukowski") Concatenate strings concat("nie","tz","sche") Regex match matches("kafka","kaf.*") Replace with regex replace("axb","[a-z]","") Tokenize via regex tokenize("a b c","\s") Join strings string-join( ("a","b","c")," ") 36

37 Sequence Functions Remove duplicates distinct-values(//year) Find index positions index-of( ("o","x","o"), "X") Remove items remove(("o","x","o"), "X") Return subsequence subsequence((4,5,6), 2, 1) Reverse sequence reverse(1 to 100) Return first item (used in recursive functions) head(1 to 100) Second and following items tail(1 to 100) In XQuery, numbering always starts from 1! 37

38 Numeric Functions Count sequence length count(//title) Minimum/maximum values min(//title/year) Calculate sum sum(1 to 2345) Calculate average avg(for $p in //person return Absolute number abs(-1) Rounded number round(2.345, 2) Square root math:sqrt(100) Random number xs:int(math:random() * 5) Number π math:pi() 38

39 Functions User-defined Functions existing functions can be extended by declaring your own functions makes the code better readable and reusable by default, the local prefix is reserved used for user-defined functions Example declare function local:double($d as xs:double) { $d * 2 }; local:double(2.0) 39

40 40 References XQuery: Search Across a Variety of XML Data Priscilla Walmsley, 2007 XQuery: The XML Query Language Michael Brundage, 2004 XQuery From the Experts Howard Katz (ed.), 2004 XQuery Data Model. W3C, XQuery 3.0. W3C, XQuery Functions

Big Data 12. Querying

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 information

Big Data 10. Querying

Big Data 10. Querying Ghislain Fourny Big Data 10. Querying pinkyone / 123RF Stock Photo 1 Declarative Languages What vs. How 2 Functional Languages for let order by if + any else = then every while where return exit with Expression

More information

XQuery. 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 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 information

Introduction to XQuery. Overview. Basic Principles. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar..

Introduction 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 information

Progress Report on XQuery

Progress 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 information

XML 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 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 information

XQ: An XML Query Language Language Reference Manual

XQ: 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 information

Navigating Input Documents Using Paths4

Navigating 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 information

Big Data Exercises. Fall 2016 Week 9 ETH Zurich

Big 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 information

The XQuery Data Model

The 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 information

Part 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 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 information

Introduction to XQuery and XML Databases

Introduction 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 information

Pre-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. 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 information

Documentation 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 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 information

Overview: XQuery 3.0

Overview: 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 information

Parte IV: XPATH. Prof. Riccardo Torlone

Parte 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 information

XML 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, 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 information

Part X. XQuery Querying XML Documents

Part 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 information

Shell programming. Introduction to Operating Systems

Shell programming. Introduction to Operating Systems Shell programming Introduction to Operating Systems Environment variables Predened variables $* all parameters $# number of parameters $? result of last command $$ process identier $i parameter number

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

BASI DI DATI II 2 modulo

BASI 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 information

XPath Expression Syntax

XPath 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 information

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

Part 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 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 information

Anders Møller & Michael I. Schwartzbach 2006 Addison-Wesley

Anders 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 information

MarkLogic Server. XQuery and XSLT Reference Guide. MarkLogic 9 May, Copyright 2017 MarkLogic Corporation. All rights reserved.

MarkLogic Server. XQuery and XSLT Reference Guide. MarkLogic 9 May, Copyright 2017 MarkLogic Corporation. All rights reserved. XQuery and XSLT Reference Guide 1 MarkLogic 9 May, 2017 Last Revised: 9.0-2, July, 2017 Copyright 2017 MarkLogic Corporation. All rights reserved. Table of Contents Table of Contents XQuery and XSLT Reference

More information

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going

More information

CS251 Programming Languages Handout # 29 Prof. Lyn Turbak March 7, 2007 Wellesley College

CS251 Programming Languages Handout # 29 Prof. Lyn Turbak March 7, 2007 Wellesley College CS5 Programming Languages Handout # 9 Prof. Lyn Turbak March, 00 Wellesley College Postfix: A Simple Stack Language Several exercises and examples in this course will involve the Postfix mini-language.

More information

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Macro Programming Reference Guide. Copyright 2005 Scott Martinez Macro Programming Reference Guide Copyright 2005 Scott Martinez Section 1. Section 2. Section 3. Section 4. Section 5. Section 6. Section 7. What is macro programming What are Variables What are Expressions

More information

Next Generation Query and Transformation Standards. Priscilla Walmsley Managing Director, Datypic

Next Generation Query and Transformation Standards. Priscilla Walmsley Managing Director, Datypic Next Generation Query and Transformation Standards Priscilla Walmsley Managing Director, Datypic http://www.datypic.com pwalmsley@datypic.com 1 Agenda The query and transformation landscape Querying XML

More information

XQuery 1.0: An XML Query Language

XQuery 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 information

Advanced Model development

Advanced Model development Advanced Model development Expressions The XPath functions available in Monitor are a subset of the XPath specification. The functions supported are shown in the following lists. Data functions String

More information

Author: Irena Holubová Lecturer: Martin Svoboda

Author: 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 information

A Modular modular XQuery implementation

A 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 information

Table of Contents. Preface... xvii

Table of Contents. Preface... xvii Table of Contents Preface...................................................................... xvii 1. Introduction to XQuery....................................................... 1 What Is XQuery? 1

More information

The PCAT Programming Language Reference Manual

The 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 information

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Introduction to Typed Racket The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Getting started Find a machine with DrRacket installed (e.g. the

More information

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4. Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Arithmetic Expression Using Arithmetic Expression Calculations

More information

Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives

Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives CS 6A Scheme Fall 208 Discussion 8: October 24, 208 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write

More information

XML Path Language (XPath)

XML 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 information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

BEAWebLogic. Integration. Transforming Data Using XQuery Mapper

BEAWebLogic. 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 information

1/16/2013. Program Structure. Language Basics. Selection/Iteration Statements. Useful Java Classes. Text/File Input and Output.

1/16/2013. Program Structure. Language Basics. Selection/Iteration Statements. Useful Java Classes. Text/File Input and Output. Program Structure Language Basics Selection/Iteration Statements Useful Java Classes Text/File Input and Output Java Exceptions Program Structure 1 Packages Provide a mechanism for grouping related classes

More information

XPath. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University

XPath. 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 information

XML. Semi-structured data (SSD) SSD Graphs. SSD Examples. Schemas for SSD. More flexible data model than the relational model.

XML. 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 information

Module 4. Implementation of XQuery. Part 1: Overview of Compiler, Runtime System

Module 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 information

The Warhol Language Reference Manual

The Warhol Language Reference Manual The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming

More information

H2 Spring B. We can abstract out the interactions and policy points from DoDAF operational views

H2 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 information

Functional programming with Common Lisp

Functional programming with Common Lisp Functional programming with Common Lisp Dr. C. Constantinides Department of Computer Science and Software Engineering Concordia University Montreal, Canada August 11, 2016 1 / 81 Expressions and functions

More information

XML Databases 6. XML Query Languages II

XML 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 information

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017 SCHEME 8 COMPUTER SCIENCE 61A March 2, 2017 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.asp...

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.asp... 1 of 8 8/27/2014 2:15 PM Units: Teacher: ProgIIIAPCompSci, CORE Course: ProgIIIAPCompSci Year: 2012-13 Computer Systems This unit provides an introduction to the field of computer science, and covers the

More information

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015 SCHEME 7 COMPUTER SCIENCE 61A October 29, 2015 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

Chapter 15 Functional Programming Languages

Chapter 15 Functional Programming Languages Chapter 15 Functional Programming Languages Fundamentals of Functional Programming Languages Introduction to Scheme A programming paradigm treats computation as the evaluation of mathematical functions.

More information

Data types for mcrl2

Data types for mcrl2 Data types for mcrl2 Aad Mathijssen April 5, 2018 We provide a syntax for the standard data types of the mcrl2 language. This syntax is intended to be a practical mix between standard mathematical notation

More information

XSLT 2.0: More power, less hassle

XSLT 2.0: More power, less hassle XSLT 2.0: More power, less hassle Doug Tidwell IBM Corporation dtidwell@us.ibm.com Doug Tidwell XSLT 2.0: More Power, Less Hassle Slide 1 Our agenda A brief history of XSLT Changes in XPath 2.0 Parameters,

More information

MarkLogic Server XQuery and XSLT Reference Guide

MarkLogic Server XQuery and XSLT Reference Guide XQuery and XSLT Reference Guide 1 MarkLogic 8 February, 2015 Last Revised: 8.0-7, August, 2017 Table of Contents Table of Contents XQuery and XSLT Reference Guide 1.0 About This XQuery and XSLT Guide...6

More information

Outline 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. 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 information

6/3/2016 8:44 PM 1 of 35

6/3/2016 8:44 PM 1 of 35 6/3/2016 8:44 PM 1 of 35 6/3/2016 8:44 PM 2 of 35 2) Background Well-formed XML HTML XSLT Processing Model 6/3/2016 8:44 PM 3 of 35 3) XPath XPath locates items within an XML file It relies on the XML

More information

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines. Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

Semantic Web. Querying on the Web: XQuery, RDQL, SparQL. Morteza Amini. Sharif University of Technology Fall 94-95

Semantic Web. Querying on the Web: XQuery, RDQL, SparQL. Morteza Amini. Sharif University of Technology Fall 94-95 ه عا ی Semantic Web Querying on the Web: XQuery, RDQL, SparQL Morteza Amini Sharif University of Technology Fall 94-95 Outline XQuery Querying on XML Data RDQL Querying on RDF Data SparQL Another RDF query

More information

A First Look at ML. Chapter Five Modern Programming Languages, 2nd ed. 1

A First Look at ML. Chapter Five Modern Programming Languages, 2nd ed. 1 A First Look at ML Chapter Five Modern Programming Languages, 2nd ed. 1 ML Meta Language One of the more popular functional languages (which, admittedly, isn t saying much) Edinburgh, 1974, Robin Milner

More information

Control Structures. CIS 118 Intro to LINUX

Control 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 information

Chapter 15. Functional Programming Languages

Chapter 15. Functional Programming Languages Chapter 15 Functional Programming Languages Copyright 2009 Addison-Wesley. All rights reserved. 1-2 Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages

More information

Scheme Tutorial. Introduction. The Structure of Scheme Programs. Syntax

Scheme 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 information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

TDDD43. Theme 1.2: XML query languages. Fang Wei- Kleiner h?p:// TDDD43

TDDD43. 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 information

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Modern Programming Languages. Lecture LISP Programming Language An Introduction Modern Programming Languages Lecture 18-21 LISP Programming Language An Introduction 72 Functional Programming Paradigm and LISP Functional programming is a style of programming that emphasizes the evaluation

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

CPS 506 Comparative Programming Languages. Programming Language Paradigm

CPS 506 Comparative Programming Languages. Programming Language Paradigm CPS 506 Comparative Programming Languages Functional Programming Language Paradigm Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming

More information

Programming for the Web with PHP

Programming for the Web with PHP Aptech Ltd Version 1.0 Page 1 of 11 Table of Contents Aptech Ltd Version 1.0 Page 2 of 11 Abstraction Anonymous Class Apache Arithmetic Operators Array Array Identifier arsort Function Assignment Operators

More information

Seleniet XPATH Locator QuickRef

Seleniet 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 information

Functional Programming. Pure Functional Programming

Functional Programming. Pure Functional Programming Functional Programming Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends only on the values of its sub-expressions (if any).

More information

Oracle Database 11g: SQL and PL/SQL Fundamentals

Oracle Database 11g: SQL and PL/SQL Fundamentals Oracle University Contact Us: +33 (0) 1 57 60 20 81 Oracle Database 11g: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn In this course, students learn the fundamentals of SQL and PL/SQL

More information

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

It is better to have 100 functions operate one one data structure, than 10 functions on 10 data structures. A. Perlis

It is better to have 100 functions operate one one data structure, than 10 functions on 10 data structures. A. Perlis Chapter 14 Functional Programming Programming Languages 2nd edition Tucker and Noonan It is better to have 100 functions operate one one data structure, than 10 functions on 10 data structures. A. Perlis

More information

Functional Programming Languages (FPL)

Functional Programming Languages (FPL) Functional Programming Languages (FPL) 1. Definitions... 2 2. Applications... 2 3. Examples... 3 4. FPL Characteristics:... 3 5. Lambda calculus (LC)... 4 6. Functions in FPLs... 7 7. Modern functional

More information

Oracle Database: SQL and PL/SQL Fundamentals Ed 2

Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals

More information

Scheme Quick Reference

Scheme Quick Reference Scheme Quick Reference COSC 18 Fall 2003 This document is a quick reference guide to common features of the Scheme language. It is not intended to be a complete language reference, but it gives terse summaries

More information

Final-Term Papers Solved MCQS with Reference

Final-Term Papers Solved MCQS with Reference Solved MCQ(S) From FinalTerm Papers BY Arslan Jan 14, 2018 V-U For Updated Files Visit Our Site : Www.VirtualUstaad.blogspot.com Updated. Final-Term Papers Solved MCQS with Reference 1. The syntax of PHP

More information

La Mesa Language Reference Manual COMS 4115: Programming Languages and Translators Professor Stephen Edwards

La Mesa Language Reference Manual COMS 4115: Programming Languages and Translators Professor Stephen Edwards La Mesa Language Reference Manual COMS 4115: Programming Languages and Translators Professor Stephen Edwards Michael Vitrano Matt Jesuele Charles Williamson Jared Pochtar 1. Introduction La Mesa is a language

More information

ECE 122 Engineering Problem Solving with Java

ECE 122 Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 3 Expression Evaluation and Program Interaction Outline Problem: How do I input data and use it in complicated expressions Creating complicated expressions

More information

Scheme Quick Reference

Scheme Quick Reference Scheme Quick Reference COSC 18 Winter 2003 February 10, 2003 1 Introduction This document is a quick reference guide to common features of the Scheme language. It is by no means intended to be a complete

More information

An introduction to Scheme

An introduction to Scheme An introduction to Scheme Introduction A powerful programming language is more than just a means for instructing a computer to perform tasks. The language also serves as a framework within which we organize

More information

20761 Querying Data with Transact SQL

20761 Querying Data with Transact SQL Course Overview The main purpose of this course is to give students a good understanding of the Transact-SQL language which is used by all SQL Server-related disciplines; namely, Database Administration,

More information

Querying XML Documents. Organization of Presentation

Querying 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 information

XML and Semi-structured Data

XML and Semi-structured Data XML and Semi-structured Data Krzysztof Trawiński Winter Semester 2008 slides 1/27 Outline 1. Introduction 2. Usage & Design 3. Expressions 3.1 Xpath 3.2 Datatypes 3.3 FLWOR 4. Functions 5. Summary 6. Questions

More information

Relational Databases

Relational Databases Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 49 Plan of the course 1 Relational databases 2 Relational database design 3 Conceptual database design 4

More information

Reasoning About Programs Panagiotis Manolios

Reasoning About Programs Panagiotis Manolios Reasoning About Programs Panagiotis Manolios Northeastern University March 22, 2012 Version: 58 Copyright c 2012 by Panagiotis Manolios All rights reserved. We hereby grant permission for this publication

More information

XML and Semantic Web Technologies. II. XML / 6. XML Query Language (XQuery)

XML and Semantic Web Technologies. II. XML / 6. XML Query Language (XQuery) XML and Semantic Web Technologies XML and Semantic Web Technologies II. XML / 6. XML Query Language (XQuery) Prof. Dr. Dr. Lars Schmidt-Thieme Information Systems and Machine Learning Lab (ISMLL) Institute

More information

Optional SQL Feature Summary

Optional SQL Feature Summary Optional SQL Feature Summary The following table lists all optional features included in the SQL standard, from SQL- 2003 to SQL-2016. It also indicates which features that are currently supported by Mimer

More information

Chapter 17. Fundamental Concepts Expressed in JavaScript

Chapter 17. Fundamental Concepts Expressed in JavaScript Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program

More information

Course: The XPath Language

Course: 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 information

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Lesson 6 - Defining a Programming Language Bottom Up Collaboration and Management - Elements of Programming Dana Fisman 1 What we accomplished

More information

6. XML Query Languages II. 6.1 Introduction. 6.1 Introduction. 6.1 Introduction. 6.1 Introduction. XML Databases. 6. XML Query Languages II

6. XML Query Languages II. 6.1 Introduction. 6.1 Introduction. 6.1 Introduction. 6.1 Introduction. XML Databases. 6. XML Query Languages II XML Databases Silke Eckstein Andreas Kupfer Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de XML Databases Silke Eckstein Institut fürinformationssysteme

More information

Basic Structure Set Operations Aggregate Functions Null Values Nested Subqueries Derived Relations Views Modification of the Database Data Definition

Basic Structure Set Operations Aggregate Functions Null Values Nested Subqueries Derived Relations Views Modification of the Database Data Definition Chapter 4: SQL Basic Structure Set Operations Aggregate Functions Null Values Nested Subqueries Derived Relations Views Modification of the Database Data Definition Language 4.1 Schema Used in Examples

More information