CSCC43 Introduction to Databases. XML Query Languages CSCC43

Size: px
Start display at page:

Download "CSCC43 Introduction to Databases. XML Query Languages CSCC43"

Transcription

1 Introduction to Databases XML Query Languages 1

2 Outline Semistructured data Introduction to XML Introduction to DTDs XPath core query language for XML XQuery full-featured query language for XML 2

3 Semistructured Data An HTML document to be displayed on the Web: <dt>name: John Doe <dd>id: s <dd>address: <ul> <li>number: 123</li> <li>street: Main</li> </ul> </dt> <dt>name: Joe Public <dd>id: s </dt> HTML does not distinguish between attributes and values 3

4 Why study XML? Huge demands for data exchange across platforms across enterprises Huge demands for data integration heterogeneous data sources data sources distributed across different locations XML (extensible Markup Language) has become the prime standard for data exchange on the Web and a uniform data model for integrated data. RDB OODB 4

5 Why not HTML? An Example Amazon publishes a catalog for books on sale Data source: a relational database Publishing: HTML pages generated from the relational database Customers want to query the catalog data: They can only access the published Web pages (and hence need a parser) They are only interested in information about books on Databases -- in SQL: select B from book B where B.title LIKE Database% 5

6 What is wrong with HTML? <h3> Books </h3> Databases <ol> <li> <b>database Design for Mere Mortals </b>michael J. Hernandez<br> <i>mar </i> <li> <b>beginning Database Design: From Novice to Professional </b> Clare Churcher <br> </ol> 6

7 What is wrong with HTML? A minor format change to the HTML document may break the parser and yield wrong answer to the query Why? HTML tags are predefined and fixed describing display format rather than structure of data HTML is good for presentation (human friendly), but does not help automatic data extraction by means of programs (queries) 7

8 An XML solution <books> <book > <title>database Design for Mere Mortals </title> <author>michael J. Hernandez</author> <date>13/03/2003 </date> </book> <book id = B2 > <title>beginning Database Design: From Novice to Professional</title> <author>clare Churcher</author> </book> </books> 8

9 Semistructured Data cont d To make the previous student list suitable for machine consumption on the Web, it should have these characteristics: Be object-like Be schemaless (not guaranteed to conform exactly to any schema, but different objects have some commonality among themselves) Be self-describing (some schema-like information, like attribute names, is part of data itself) Data with these characteristics are referred to as semistructured. 9

10 What is Self-describing Data? Non-self-describing (relational, object-oriented): Data part: (#123, [ Students, {[ John, s , [123, Main St ]], [ Joe, s , [321, Pine St ]] } ] ) Schema part: PersonList[ ListName: String, Contents: [ Name: String, Id: String, Address: [Number: Integer, Street: String] ] ] 10

11 What is Self-Describing Data? cont d Self-describing: Attribute names embedded in the data itself, but are distinguished from values Doesn t need schema to figure out what is what (but schema might be useful nonetheless) (#12345, [ListName: Students, Contents: { [ Name: John Doe, Id: s , Address: [Number: 123, Street: Main St. ] ], [Name: Joe Public, Id: s , Address: [Number: 321, Street: Pine St. ] ] } ] ) 11

12 Overview of XML Like HTML, but any number of different tags can be used (up to the document author) extensible Unlike HTML, no semantics behind the tags For instance, HTML s <table> </table> means: render contents as a table; in XML: doesn t mean anything special Some semantics can be specified using XML Schema (types); some using stylesheets (browser rendering) Unlike HTML, is intolerant to bugs Browsers will render buggy HTML pages XML processors are not supposed to process buggy XML documents 12

13 Root Root element elements Example <?xml version= 1.0?> attributes <PersonList Type= Student Date= > <Title Value= Student List /> <Person> </Person> <Person> </Person> </PersonList> Empty element Element (or tag) names Elements are nested Root element contains all others 13

14 More Terminology Opening tag <Person Name = John Id = s > Content of Person John is a nice fellow <Address> <Number>21</Number> <Street>Main St.</Street> </Address> </Person> standalone text, not very useful as data, non-uniform Child of Address, Descendant of Person Nested element, child of Person Parent of Address, Ancestor of number Closing tag: What is open must be closed 14

15 Well-formed XML Documents Must have a root element Every opening tag must have matching closing tag Elements must be properly nested <foo><bar></foo></bar> is a no-no An attribute name can occur at most once in an opening tag. If it occurs, It must have an explicitly specified value (Boolean attrs, like in HTML, are not allowed) The value must be quoted (with or ) XML processors are not supposed to try and fix illformed documents (unlike HTML browsers) 15

16 Tree Structure of XML <bookstore> <book category="cooking"> <title lang="en">everyday Italian</title> <author>giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">harry Potter</title> <author>j K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="web"> <title lang="en">learning XML</title> <author>erik T. Ray</author> <year>2003</year> <price>39.95</price> </book> </bookstore> 16

17 Identifying and Referencing with Attributes An attribute can be declared to have type: ID unique identifier of an element If attr1 & attr2 are both of type ID, then it is illegal to have <something attr1= abc > <somethingelse attr2= abc > within the same document IDREF references a unique element with matching ID attribute If attr1 has type ID and attr2 has type IDREF then we can have: <something attr1= abc > <somethingelse attr2= abc > IDREFS a list of references, if attr1 is ID and attr2 is IDREFS, then we can have <something attr1= abc > <somethingelse attr1= cde >...<someotherthing attr2= abc cde > 17

18 Document Type Definition (DTD) A DTD is a grammar specification for an XML document DTDs are optional don t need to be specified If specified, DTD can be part of the document (at the top), or it can be given as a URL A document that conforms (i.e., parses) w.r.t. its DTD is said to be valid XML processors are not required to check validity, even if DTD is specified But they are required to test well-formedness 18

19 DTDs (cont d) DTD specified as part of a document: <?xml version= 1.0?> <!DOCTYPE Book [ ]> <Book> </Book> DTD specified as a standalone thing <?xml version= 1.0?> <!DOCTYPE Book > <Book> </Book> 19

20 DTD Components <!ELEMENT elt-name ( contents )/EMPTY/ANY > <!ATTLIST elt-name attr-name CDATA/ID/IDREF/IDREFS #IMPLIED/#REQUIRED > Optional/mandatory Element s contents An attr for elt Type of attribute Can define other things, like macros (called entities in the XML jargon) 20

21 DTD Example <!DOCTYPE Report [ <!ELEMENT Report (Students, Classes, Courses)> <!ELEMENT Students (Student*)> <!ELEMENT Classes (Class*)> <!ELEMENT Courses (Course*)> <!ELEMENT Student (Name, Status, CrsTaken*)> <!ELEMENT Name (First,Last)> <!ELEMENT First (#PCDATA)> <!ELEMENT CrsTaken EMPTY> <!ELEMENT Class (CrsCode, Semester, ClassRoster)> <!ELEMENT Course (CrsName)> <!ATTLIST Report Date CDATA #IMPLIED> <!ATTLIST Student StudId ID #REQUIRED> <!ATTLIST Course CrsCode ID #REQUIRED> <!ATTLIST CrsTaken CrsCode IDREF #REQUIRED Semester CDATA #REQUIRED > <!ATTLIST ClassRoster Members IDREFS #IMPLIED> ]> Zero or more Has text content Empty element, no content Same attribute in different elements 21

22 Example: Report Document with Cross-References <?xml version= 1.0?> <Report Date= > <Students> <Student StudId= s > <Name><First>John</First><Last>Doe</Last></Name> <Status>U2</Status> <CrsTaken CrsCode= CS308 Semester= F1997 /> <CrsTaken CrsCode= MAT123 Semester= F1997 /> </Student> <Student StudId= s > <Name><First>Joe</First><Last>Public</Last></Name> <Status>U3</Status> <CrsTaken CrsCode= CS308 Semester= F1994 /> <CrsTaken CrsCode= MAT123 Semester= F1997 /> </Student> <Student StudId= s > IDREF <Name><First>Bart</First><Last>Simpson</Last></Name> <Status>U4</Status> <CrsTaken CrsCode= CS308 Semester= F1994 /> </Student> </Students> continued ID 22

23 Report Document (cont d) <Classes> <Class> <CrsCode>CS308</CrsCode> <Semester>F1994</Semester> <ClassRoster Members= s /> </Class> <Class> <CrsCode>CS308</CrsCode> <Semester>F1997</Semester> <ClassRoster Members= s /> </Class> <Class> <CrsCode>MAT123</CrsCode> <Semester>F1997</Semester> <ClassRoster Members= s s /> </Class> </Classes> continued IDREFS 23

24 Report Document cont d ID <Courses> <Course CrsCode = CS308 > <CrsName>Market Analysis</CrsName> </Course> <Course CrsCode = MAT123 > <CrsName>Market Analysis</CrsName> </Course> </Courses> </Report> 24

25 Limitations of DTDs Don t understand namespaces Very limited assortment of data types (just strings) Very weak w.r.t. consistency constraints (ID/IDREF/IDREFS only) Can t express unordered contents conveniently All element names are global: can t have one Name type for people and another for companies: <!ELEMENT Name (Last, First)> <!ELEMENT Name (#PCDATA)> both can t be in the same DTD 25

26 XML Schema Came to rectify some of the problems with DTDs Advantages: Integrated with namespaces Many built-in types User-defined types Has local element names Powerful key and referential constraints Disadvantages: Unwieldy much more complex than DTDs 26

27 XML Query Languages XPath core query language. Very limited, a glorified selection operator. Very useful, though: used in XML Schema, XSLT, XQuery, many other XML standards XSLT a functional style document transformation language. Very powerful, very complicated XQuery W3C standard. Very powerful, fairly intuitive, SQL-style SQL/XML attempt to marry SQL and XML, part of SQL:

28 Why Query XML? Need to extract parts of XML documents Need to transform documents into different forms Need to relate join parts of the same or different documents 28

29 XPath Analogous to path expressions in object-oriented languages (e.g., OQL) Extends path expressions with query facility XPath views an XML document as a tree Root of the tree is a new node, which doesn t correspond to anything in the document Internal nodes are elements Leaves are either Attributes Text nodes Comments Other things that we didn t discuss (processing instructions, ) 29

30 XPath Document Tree Root of XML tree Root of XML document 30

31 Document Corresponding to the Tree A fragment of the report document from earlier <?xml version= 1.0?> <!-- Some comment --> <Students> <Student StudId= > <Name><First>John</First><Last>Doe</Last></Name> <Status>U2</Status> <CrsTaken CrsCode= CS308 Semester= F1997 /> <CrsTaken CrsCode= MAT123 Semester= F1997 /> </Student> <Student StudId= > <Name><First>Bart</First><Last>Simpson</Last></Name> <Status>U4</Status> <CrsTaken CrsCode= CS308 Semester= F1994 /> </Student> </Students> <!-- Some other comment --> 31

32 Terminology Parent/child nodes, as usual Child nodes (that are of interest to us) are of types: text, element, attribute. Ancestor/descendant nodes as usual in trees 32

33 XPath Basics An XPath expression takes a document tree as input and returns a multi-set of nodes of the tree Expressions that start with / are absolute path expressions / /Students/Student /Student 33

34 XPath Basics An XPath expression takes a document tree as input and returns a multi-set of nodes of the tree Expressions that start with / are absolute path expressions / returns root node of XPath tree /Students/Student returns all Student-elements that are children of Students elements, which in turn must be children of the root /Student returns empty set (no such children at root) 34

35 XPath Basics cont d Current (or context node) exists during the evaluation of XPath expressions (and in other XML query languages). denotes the current node;.. denotes the parent foo/bar./foo/bar../abc/cde Expressions that don t start with / are relative (to the current node) 35

36 XPath Basics cont d Current (or context node) exists during the evaluation of XPath expressions (and in other XML query languages). denotes the current node;.. denotes the parent foo/bar returns all bar-elements that are children of foo nodes, which in turn are children of the current node./foo/bar same../abc/cde all cde e-children of abc e-children of the parent of the current node Expressions that don t start with / are relative (to the current node) 36

37 Attributes, Text, etc. Denotes an attribute StudentId /Students/Student/Name/Last/text( text( ) XPath provides means to select other document components as well 37

38 Attributes, Text, etc. Denotes an attribute StudtId returns all StudentId a-children of Student, which are e-children of Students, which are children of the root /Students/Student/Name/Last/text( text( ) returns all t- children of Last e-children of XPath provides means to select other document components as well 38

39 Overall Idea and Semantics An XPath expression is: locationstep1/locationstep2/ Location step: Axis::nodeSelector[predicate] Navigation axis: child, parent have seen This is called full syntax. We used abbreviated syntax before. Full syntax is better for describing meaning. Abbreviated syntax is better for programming. ancestor, descendant, ancestor-or-self, descendant-or-self will see later some other Node selector: node name or wildcard; e.g.,./child::student (we used./student, which is an abbreviation)./child::* any e-child (abbreviation:./*) Predicate: a selection condition; e.g., Students/Student[CourseTaken/@CrsCode = CSC343 ] 39

40 XPath Semantics The meaning of the expression locationstep1/locationstep2/ is the set of all document nodes obtained as follows: Find all nodes reachable by locationstep1 from the current node For each node N in the result, find all nodes reachable from N by locationstep2; take the union of all these nodes For each node in the result, find all nodes reachable by locationstep3, etc. The value of the path expression on a document is the set of all document nodes found after processing the last location step in the expression 40

41 Overall Idea of the Semantics cont d locationstep1/locationstep2/ means: Find all nodes specified by locationstep1 For each such node N: sfind all nodes specified by locationstep2 using N as the current node Take union For each node returned by locationstep2 do the same locationstep = axis::node[predicate] Find all nodes specified by axis::node Select only those that satisfy predicate 41

42 More on Navigation Primitives 2 nd CrsTaken child of 1 st Student child of Students: /Students/Student[1]/CrsTaken[2] All last CourseTaken elements within each Student element: /Students/Student/CrsTaken[last( )] 42

43 Wildcards Wildcards are useful when the exact structure of document is not known Descendant-or-self axis, // : allows to descend down any number of levels (including 0) //CrsTaken all CrsTaken nodes under the root Students//@Name all Name attribute nodes under the elements Students, who are children of the current node The * wildcard: * any element: any attribute: Students//@* 43

44 XPath Queries (selection predicates) Recall: Location step = Axis::nodeSelector[predicate predicate] Predicate: XPath expression = const built-in function XPath expression XPath expression built-in predicate a Boolean combination thereof Axis::nodeSelector[predicate predicate] Axis::nodeSelector but contains only the nodes that satisfy predicate Built-in predicate: special predicates for string matching, set manipulation, etc. Built-in function: large assortment of functions for string manipulation, aggregation, etc. 44

45 XPath Queries Examples Students who have taken CSC343: CSC343 ] True if : CSC343 //Student/CrsTaken/@CrsCode Complex example: //Student[Status= U3 and starts-with(.//last, A ) and contains(concat(.//@crscode, ), ESE ) and not(.//last =.//First) ] Aggregation: sum( ), count( ) //Student[sum(.//@Grade) div count(.//@grade) > 3.5] 45

46 Xpath Queries cont d Testing whether a subnode exists: //Student[CrsTaken/@Grade] students who have a grade (for some course) //Student[Name/First or CrsTaken/@Semester or Status/text() = U4 ] students who have either a first name or have taken a course in some semester or have status U4 Union operator, : //CrsTaken[@Semester= F2001 ] //Class[Semester= F1990 ] union lets us define heterogeneous collections of nodes 46

47 XQuery XML Query Language Integrates XPath with earlier proposed query languages: XQL, XML-QL SQL-style, not functional-style 2007: XQuery

48 XQuery Basics: FLOWR Expression General structure: FOR variable declarations LET variable declarations WHERE condition ORDER BY list RETURN document XQuery expression 48

49 XQuery Basics: FLOWR Expression Example: (: students who took MAT123 :) FOR $t IN doc( transcript.xml )//Transcript WHERE = MAT123 RETURN $t/student Result: comment This document on next slides <Student StudId= Name= John Doe /> <Student StudId= Name= Joe Blow /> 49

50 transcript.xml <Transcripts> <Transcript> <Student StudId= Name= John Doe /> <CrsTaken CrsCode= CS308 Semester= F1997 Grade= B /> <CrsTaken CrsCode= MAT123 Semester= F1997 Grade= B /> <CrsTaken CrsCode= EE101 Semester= F1997 Grade= A /> <CrsTaken CrsCode= CS305 Semester= F1995 Grade= A /> </Transcript> <Transcript> <Student StudId= Name= Bart Simpson /> <CrsTaken CrsCode= CS305 Semester= F1995 Grade= C /> <CrsTaken CrsCode= CS308 Semester= F1994 Grade= B /> </Transcript> cont d 50

51 transcript.xml (cont d) <Transcript> <Student StudId= Name= Joe Blow /> <CrsTaken CrsCode= CS315 Semester= S1997 Grade= A /> <CrsTaken CrsCode= CS305 Semester= S1996 Grade= A /> <CrsTaken CrsCode= MAT123 Semester= S1996 Grade= C /> </Transcript> <Transcript> <Student StudId= Name= Homer Simpson /> <CrsTaken CrsCode= EE101 Semester= F1995 Grade= B /> <CrsTaken CrsCode= CS305 Semester= S1996 Grade= A /> </Transcript> </Transcripts> 51

52 XQuery Basics (cont d) Previous query doesn t produce a well-formed XML document; the following does: <StudentList> { FOR $t IN doc( transcript.xml )//Transcript WHERE $t/crstaken/@crscode = MAT123 RETURN $t/student } </StudentList> Query inside XML 52

53 Document Restructuring with XQuery Reconstruct lists of students taking each class using the Transcript records: FOR $c IN doc( transcript.xml )//CrsTaken ORDER BY RETURN <ClassRoster > { FOR $t IN doc( transcript.xml )//Transcript WHERE $t/crstaken[@crscode = $c/@crscode = $c/@semester] ORDER BY $t/student/@studid RETURN $t/student } </ClassRoster> Query inside RETURN 53

54 Document Restructuring (cont d) Output elements have the form: <ClassRoster CrsCode= CS305 Semester= F1995 > <Student StudId= Name= John Doe /> <Student StudId= Name= Bart Simpson /> </ClassRoster> Problem: the above element will be output twice: once when $c is bound to <CrsTaken CrsCode= CS305 Semester= F1995 Grade= A /> and once when $c is bound to <CrsTaken CrsCode= CS305 Semester= F1995 Grade= C /> Bart Simpson s John Doe s Note: grades are different distinct-values( ) won t eliminate transcript records that refer to same class! 54

55 Document Restructuring cont d Solution: instead of for $c in doc( transcript.xml )//CrsTaken use for $c in doc( classes.xml )//Class Document on next slide where classes.xml lists course offerings (course code/semester) explicitly (no need to extract them from transcript records). Then $c is bound to each class exactly once, so each class roster will be output exactly once 55

56 <Classes> <Class CrsCode= CS308 Semester= F1997 > <CrsName>SE</CrsName> <Instructor>Adrian Jones</Instructor> </Class> <Class CrsCode= EE101 Semester= F1995 > <CrsName>Circuits</CrsName> <Instructor>David Jones</Instructor> </Class> <Class CrsCode= CS305 Semester= F1995 > <CrsName>Databases</CrsName> <Instructor>Mary Doe</Instructor> </Class> <Class CrsCode= CS315 Semester= S1997 > <CrsName>TP</CrsName> <Instructor>John Smyth</Instructor> </Class> <Class CrsCode= MAR123 Semester= F1997 > <CrsName>Algebra</CrsName> <Instructor>Ann White</Instructor> </Class> </Classes> 56

57 Document Restructuring (cont d) More problems: the above query will list classes with no students. Reformulation that avoids this: FOR $c IN doc( classes.xml )//Class Test that classes WHERE doc( transcripts.xml = aren t empty = $c/@semester] ORDER BY $c/@crscode RETURN <ClassRoster CrsCode = {$c/@crscode} Semester = {$c/@semester} > { FOR $t IN doc( transcript.xml )//Transcript WHERE $t/crstaken[@crscode = $c/@crscode = $c/@semester] ORDER BY $t/student/@studid RETURN $t/student } </ClassRoster> 57

58 XQuery Semantics So far the discussion was informal XQuery semantics defines what the expected result of a query is Defined analogously to the semantics of SQL 58

59 XQuery Semantics cont d Step 1: 1 Produce a list of bindings for variables The FOR clause binds each variable to a list of nodes specified by an XQuery expression. The expression can be: An XPath expression An XQuery query A function that returns a list of nodes End result of a FOR clause: Ordered list of tuples of document nodes Each tuple is a binding for the variables in the FOR clause 59

60 XQuery Semantics cont d Example (bindings): Let FOR declare $A and $B Bind $A to document nodes {v,w}; $B to {x,y,z} Then FOR clause produces the following list of bindings for $A and $B: $A/v, $B/x $A/v, $B/y $A/v, $B/z $A/w, $B/x $A/w, $B/y $A/w, $B/z 60

61 XQuery Semantics cont d Step 2: 2 filter the bindings via the WHERE clause Use each tuple binding to substitute its components for variables; retain those bindings that make WHERE true Example: WHERE $A/CrsTaken/@CrsCode = $B/Class/@CrsCode Binding: $A/w, where w = <CrsTaken CrsCode= CS308 /> $B/x, where x = <Class CrsCode= CS308 /> Then w/crstaken/@crscode = x/class/@crscode, so the WHERE condition is satisfied & binding retained 61

62 XQuery Semantics cont d Step 3: 3 Construct result For each retained tuple of bindings, instantiate the RETURN clause This creates a fragment of the output document Do this for each retained tuple of bindings in sequence 62

63 Grouping and Aggregation Does not use separate grouping operator Uses built-in aggregate functions count, avg, sum, etc. (some borrowed from XPath) 63

64 Aggregation Example Produce a list of students along with the number of courses each student took: FOR $t IN fn:doc( transcripts.xml )//Transcript, $s IN $t/student LET $c := $t/crstaken RETURN <StudentSummary StudId = {$s/@studid} Name = {$s/@name} TotalCourses = {fn:count(fn:distinct-values($c))} /> The grouping effect is achieved because $c is bound to a new set of nodes for each binding of $t 64

65 Quantification in XQuery XQuery supports explicit quantification: SOME ( ) and EVERY ( ) Example: FOR $t IN fn:doc( transcript.xml )//Transcript WHERE SOME $ct IN $t/crstaken SATISFIES $ct/@crscode = MAT123 RETURN $t/student Almost equivalent to: FOR $t IN fn:doc( transcript.xml )//Transcript, $ct IN $t/crstaken WHERE $ct/@crscode = MAT123 RETURN $t/student Not equivalent, if students can take same course twice! 65

66 Implicit Quantification Note: in SQL, variables that occur in FROM, but not SELECT are implicitly quantified with In XQuery, variables that occur in FOR, but not RETURN are similar to those in SQL. However: In XQuery variables are bound to document nodes In SQL a variable can be bound to the same value only once; identical tuples are not output twice (in theory) This is why the two queries in the previous slide are not equivalent 66

67 Quantification cont d Retrieve all classes (from classes.xml) where each student took MAT123 Hard to do in SQL (before SQL-99) because of the lack of explicit quantification FOR $c IN fn:doc(classes.xml)//class LET $g := { (: Transcript records that correspond to class $c :) FOR $t IN fn:doc( transcript.xml )//Transcript WHERE $t/crstaken/@semester = $c/@semester AND $t/crstaken/@crscode = $c/@crscode RETURN $t } WHERE EVERY $tr IN $g SATISFIES NOT fn:empty($tr[crstaken/@crscode= MAT123 ]) RETURN $c ORDER BY $c/@crscode 67

68 XQuery Functions: Example Count the number of e-children recursively: Function signature DECLARE FUNCTION countnodes($e AS element()) AS integer { } RETURN IF empty($e/*) THEN 0 ELSE sum(for $n IN $e/* RETURN countnodes($n)) + count($e/*) XQuery expression Built-in functions sum, count, empty 68

69 User-defined Functions Can define functions, even recursive ones Functions can be called from within an XQuery expression Body of function is an XQuery expression Result of expression is returned Result can be a primitive data type (integer, string), an element, a list of elements, a list of arbitrary document nodes, 69

Weeks 7 and 9: XML Data and Query Processing. Hypertext

Weeks 7 and 9: XML Data and Query Processing. Hypertext Weeks 7 and 9: XML Data and Query Processing Semistructured Data, HTML XML and DTDs XPath, XQuery XML -- 1 Hypertext Most human knowledge exists today in document format (books etc.) Need technologies

More information

Outline. Semistructured data and XML introduction DTD Schema XML Schema Xpath core query language for XML XQuery full-featured query language for XML

Outline. Semistructured data and XML introduction DTD Schema XML Schema Xpath core query language for XML XQuery full-featured query language for XML XML and Databases 1 Outline Semistructured data and XML introduction DTD Schema XML Schema Xpath core query language for XML XQuery full-featured query language for XML 2 Semistructured Data A typical

More information

EMERGING TECHNOLOGIES

EMERGING TECHNOLOGIES EMERGING TECHNOLOGIES XML (Part 2): Data Model for XML documents and XPath Outline 1. Introduction 2. Structure of XML data 3. XML Document Schema 3.1. Document Type Definition (DTD) 3.2. XMLSchema 4.

More information

Semistructured data, XML, DTDs

Semistructured data, XML, DTDs Semistructured data, XML, DTDs Introduction to Databases Manos Papagelis Thanks to Ryan Johnson, John Mylopoulos, Arnold Rosenbloom and Renee Miller for material in these slides Structured vs. unstructured

More information

Describing, Transforming, and Querying Semistructured Data

Describing, Transforming, and Querying Semistructured Data What s in This Part? Describing, Transforming, and Querying Semistructured Data From relational model to OO model to semistructured data and XML XML & DTD introduction XML Schema user-defined data types,

More information

Course: Introduction to XQuery and Static Type-Checking

Course: Introduction to XQuery and Static Type-Checking 1 / 23 Course: Introduction to XQuery and Static Type-Checking Pierre Genevès CNRS (Some examples are inspired from the XQuery tutorial by Peter Fankhauser and Philip Wadler, the slides by Rajshekhar Sunderraman,

More information

Overview. Structured Data. The Structure of Data. Semi-Structured Data Introduction to XML Querying XML Documents. CMPUT 391: XML and Querying XML

Overview. Structured Data. The Structure of Data. Semi-Structured Data Introduction to XML Querying XML Documents. CMPUT 391: XML and Querying XML Database Management Systems Winter 2004 CMPUT 391: XML and Querying XML Lecture 12 Overview Semi-Structured Data Introduction to XML Querying XML Documents Dr. Osmar R. Zaïane University of Alberta Chapter

More information

XML. Extensible Markup Language

XML. Extensible Markup Language XML Extensible Markup Language Acknowledgements and copyrights: these slides are a result of combination of notes and slides with contributions from: Michael Kiffer, Arthur Bernstein, Philip Lewis, Hanspeter

More information

11. EXTENSIBLE MARKUP LANGUAGE (XML)

11. EXTENSIBLE MARKUP LANGUAGE (XML) 11. EXTENSIBLE MARKUP LANGUAGE (XML) Introduction Extensible Markup Language is a Meta language that describes the contents of the document. So these tags can be called as self-describing data tags. XML

More information

XML: Extensible Markup Language

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

The Semi-Structured Data Model. csc343, Introduction to Databases Diane Horton originally based on slides by Jeff Ullman Fall 2017

The Semi-Structured Data Model. csc343, Introduction to Databases Diane Horton originally based on slides by Jeff Ullman Fall 2017 The Semi-Structured Data Model csc343, Introduction to Databases Diane Horton originally based on slides by Jeff Ullman Fall 2017 Recap: Data models A data model is a notation for describing data, including:

More information

XML (Extensible Markup Language)

XML (Extensible Markup Language) Basics of XML: What is XML? XML (Extensible Markup Language) XML stands for Extensible Markup Language XML was designed to carry data, not to display data XML tags are not predefined. You must define your

More information

EMERGING TECHNOLOGIES. XML Documents and Schemas for XML documents

EMERGING TECHNOLOGIES. XML Documents and Schemas for XML documents EMERGING TECHNOLOGIES XML Documents and Schemas for XML documents Outline 1. Introduction 2. Structure of XML data 3. XML Document Schema 3.1. Document Type Definition (DTD) 3.2. XMLSchema 4. Data Model

More information

XML and information exchange. XML extensible Markup Language XML

XML and information exchange. XML extensible Markup Language XML COS 425: Database and Information Management Systems XML and information exchange 1 XML extensible Markup Language History 1988 SGML: Standard Generalized Markup Language Annotate text with structure 1992

More information

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1 Slide 27-1 Chapter 27 XML: Extensible Markup Language Chapter Outline Introduction Structured, Semi structured, and Unstructured Data. XML Hierarchical (Tree) Data Model. XML Documents, DTD, and XML Schema.

More information

E-Applications. XML and DOM in Javascript. Michail Lampis

E-Applications. XML and DOM in Javascript. Michail Lampis E-Applications XML and DOM in Javascript Michail Lampis michail.lampis@dauphine.fr Acknowledgment Much of the material on these slides follows the tutorial given in: http://www.w3schools.com/dom/ XML XML

More information

Querying XML. COSC 304 Introduction to Database Systems. XML Querying. Example DTD. Example XML Document. Path Descriptions in XPath

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

XML Technologies. Doc. RNDr. Irena Holubova, Ph.D. Web pages:

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

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

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

Bioinforma)cs Resources XML / Web Access

Bioinforma)cs Resources XML / Web Access Bioinforma)cs Resources XML / Web Access Lecture & Exercises Prof. B. Rost, Dr. L. Richter, J. Reeb Ins)tut für Informa)k I12 XML Infusion (in 10 sec) compila)on from hkp://www.w3schools.com/xml/default.asp

More information

XPath and XQuery. Introduction to Databases CompSci 316 Fall 2018

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

INTERNET & WEB APPLICATION DEVELOPMENT SWE 444. Fall Semester (081) Module 4 (VII): XML DOM

INTERNET & WEB APPLICATION DEVELOPMENT SWE 444. Fall Semester (081) Module 4 (VII): XML DOM INTERNET & WEB APPLICATION DEVELOPMENT SWE 444 Fall Semester 2008-2009 (081) Module 4 (VII): XML DOM Dr. El-Sayed El-Alfy Computer Science Department King Fahd University of Petroleum and Minerals alfy@kfupm.edu.sa

More information

Web Programming Paper Solution (Chapter wise)

Web Programming Paper Solution (Chapter wise) What is valid XML document? Design an XML document for address book If in XML document All tags are properly closed All tags are properly nested They have a single root element XML document forms XML tree

More information

XML, DTD, and XPath. Announcements. From HTML to XML (extensible Markup Language) CPS 116 Introduction to Database Systems. Midterm has been graded

XML, DTD, and XPath. Announcements. From HTML to XML (extensible Markup Language) CPS 116 Introduction to Database Systems. Midterm has been graded XML, DTD, and XPath CPS 116 Introduction to Database Systems Announcements 2 Midterm has been graded Graded exams available in my office Grades posted on Blackboard Sample solution and score distribution

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 11: XML and XPath 1 XML Outline What is XML? Syntax Semistructured data DTDs XPath 2 What is XML? Stands for extensible Markup Language 1. Advanced, self-describing

More information

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013 Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013 2 Outline Introduction XML Structure Document Type Definition (DTD) XHMTL Formatting XML CSS Formatting XSLT Transformations

More information

M359 Block5 - Lecture12 Eng/ Waleed Omar

M359 Block5 - Lecture12 Eng/ Waleed Omar Documents and markup languages The term XML stands for extensible Markup Language. Used to label the different parts of documents. Labeling helps in: Displaying the documents in a formatted way Querying

More information

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML Chapter 7 XML 7.1 Introduction extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML Lax syntactical rules Many complex features that are rarely used HTML

More information

Query Languages for XML

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

Chapter 1: Getting Started. You will learn:

Chapter 1: Getting Started. You will learn: Chapter 1: Getting Started SGML and SGML document components. What XML is. XML as compared to SGML and HTML. XML format. XML specifications. XML architecture. Data structure namespaces. Data delivery,

More information

COMP9321 Web Application Engineering. Extensible Markup Language (XML)

COMP9321 Web Application Engineering. Extensible Markup Language (XML) COMP9321 Web Application Engineering Extensible Markup Language (XML) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 4 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

More information

Chapter 1: Semistructured Data Management XML

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

XML: Introduction. !important Declaration... 9:11 #FIXED... 7:5 #IMPLIED... 7:5 #REQUIRED... Directive... 9:11

XML: Introduction. !important Declaration... 9:11 #FIXED... 7:5 #IMPLIED... 7:5 #REQUIRED... Directive... 9:11 !important Declaration... 9:11 #FIXED... 7:5 #IMPLIED... 7:5 #REQUIRED... 7:4 @import Directive... 9:11 A Absolute Units of Length... 9:14 Addressing the First Line... 9:6 Assigning Meaning to XML Tags...

More information

10/24/12. What We Have Learned So Far. XML Outline. Where We are Going Next. XML vs Relational. What is XML? Introduction to Data Management CSE 344

10/24/12. What We Have Learned So Far. XML Outline. Where We are Going Next. XML vs Relational. What is XML? Introduction to Data Management CSE 344 What We Have Learned So Far Introduction to Data Management CSE 344 Lecture 12: XML and XPath A LOT about the relational model Hand s on experience using a relational DBMS From basic to pretty advanced

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

Data Presentation and Markup Languages

Data Presentation and Markup Languages Data Presentation and Markup Languages MIE456 Tutorial Acknowledgements Some contents of this presentation are borrowed from a tutorial given at VLDB 2000, Cairo, Agypte (www.vldb.org) by D. Florescu &.

More information

Introduction to Semistructured Data and XML. Overview. How the Web is Today. Based on slides by Dan Suciu University of Washington

Introduction to Semistructured Data and XML. Overview. How the Web is Today. Based on slides by Dan Suciu University of Washington Introduction to Semistructured Data and XML Based on slides by Dan Suciu University of Washington CS330 Lecture April 8, 2003 1 Overview From HTML to XML DTDs Querying XML: XPath Transforming XML: XSLT

More information

Introduction to Database Systems CSE 414

Introduction to Database Systems CSE 414 Introduction to Database Systems CSE 414 Lecture 13: XML and XPath 1 Announcements Current assignments: Web quiz 4 due tonight, 11 pm Homework 4 due Wednesday night, 11 pm Midterm: next Monday, May 4,

More information

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML 7.1 Introduction extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML Lax syntactical rules Many complex features that are rarely used HTML is a markup language,

More information

XML extensible Markup Language

XML extensible Markup Language extensible Markup Language Eshcar Hillel Sources: http://www.w3schools.com http://java.sun.com/webservices/jaxp/ learning/tutorial/index.html Tutorial Outline What is? syntax rules Schema Document Object

More information

Software Engineering Methods, XML extensible Markup Language. Tutorial Outline. An Example File: Note.xml XML 1

Software Engineering Methods, XML extensible Markup Language. Tutorial Outline. An Example File: Note.xml XML 1 extensible Markup Language Eshcar Hillel Sources: http://www.w3schools.com http://java.sun.com/webservices/jaxp/ learning/tutorial/index.html Tutorial Outline What is? syntax rules Schema Document Object

More information

Chapter 1: Semistructured Data Management XML

Chapter 1: Semistructured Data Management XML Chapter 1: Semistructured Data Management XML 2006/7, Karl Aberer, EPFL-IC, Laboratoire de systèmes d'informations répartis XML - 1 The Web has generated a new class of data models, which are generally

More information

SDPL : XML Basics 2. SDPL : XML Basics 1. SDPL : XML Basics 4. SDPL : XML Basics 3. SDPL : XML Basics 5

SDPL : XML Basics 2. SDPL : XML Basics 1. SDPL : XML Basics 4. SDPL : XML Basics 3. SDPL : XML Basics 5 2 Basics of XML and XML documents 2.1 XML and XML documents Survivor's Guide to XML, or XML for Computer Scientists / Dummies 2.1 XML and XML documents 2.2 Basics of XML DTDs 2.3 XML Namespaces XML 1.0

More information

CSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML

CSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards Representing Web Data: XML XML Example XML document: An XML document is one that follows certain syntax rules (most of which we followed for XHTML) Guy-Vincent

More information

XML Data Management. 6. XPath 1.0 Principles. Werner Nutt

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

XML in Databases. Albrecht Schmidt. al. Albrecht Schmidt, Aalborg University 1

XML in Databases. Albrecht Schmidt.   al. Albrecht Schmidt, Aalborg University 1 XML in Databases Albrecht Schmidt al@cs.auc.dk http://www.cs.auc.dk/ al Albrecht Schmidt, Aalborg University 1 What is XML? (1) Where is the Life we have lost in living? Where is the wisdom we have lost

More information

Data formats. { "firstname": "John", "lastname" : "Smith", "age" : 25, "address" : { "streetaddress": "21 2nd Street",

Data formats. { firstname: John, lastname : Smith, age : 25, address : { streetaddress: 21 2nd Street, Data formats { "firstname": "John", "lastname" : "Smith", "age" : 25, "address" : { "streetaddress": "21 2nd Street", "city" : "New York", "state" : "NY", "postalcode" : "10021" }, CSCI 470: Web Science

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

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

XML. Document Type Definitions. Database Systems and Concepts, CSCI 3030U, UOIT, Course Instructor: Jarek Szlichta

XML. Document Type Definitions. Database Systems and Concepts, CSCI 3030U, UOIT, Course Instructor: Jarek Szlichta XML Document Type Definitions 1 XML XML stands for extensible Markup Language. XML was designed to describe data. XML has come into common use for the interchange of data over the Internet. 2 Well-Formed

More information

Semistructured Data and XML

Semistructured Data and XML Semistructured Data and XML Computer Science E-66 Harvard University David G. Sullivan, Ph.D. Structured Data The logical models we've covered thus far all use some type of schema to define the structure

More information

Chapter 13 XML: Extensible Markup Language

Chapter 13 XML: Extensible Markup Language Chapter 13 XML: Extensible Markup Language - Internet applications provide Web interfaces to databases (data sources) - Three-tier architecture Client V Application Programs Webserver V Database Server

More information

Introduction to XML (Extensible Markup Language)

Introduction to XML (Extensible Markup Language) Introduction to XML (Extensible Markup Language) 1 History and References XML is a meta-language, a simplified form of SGML (Standard Generalized Markup Language) XML was initiated in large parts by Jon

More information

Relational Algebra. Relational Query Languages

Relational Algebra. Relational Query Languages Relational Algebra Davood Rafiei 1 Relational Query Languages Languages for describing queries on a relational database Three variants Relational Algebra Relational Calculus SQL Query languages v.s. programming

More information

XML. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior

XML. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior XML Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior XML INTRODUCTION 2 THE XML LANGUAGE XML: Extensible Markup Language Standard for the presentation and transmission of information.

More information

Semi-structured Data. 8 - XPath

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

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Extensible

More information

XML CSC 443: Web Programming

XML CSC 443: Web Programming 1 XML CSC 443: Web Programming Haidar Harmanani Department of Computer Science and Mathematics Lebanese American University Byblos, 1401 2010 Lebanon What is XML? 2 XML: a "skeleton" for creating markup

More information

XML: extensible Markup Language

XML: extensible Markup Language Datamodels XML: extensible Markup Language Slides are based on slides from Database System Concepts Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use Many examples are from

More information

Introduction to Semistructured Data and XML. Contents

Introduction to Semistructured Data and XML. Contents Contents Overview... 106 What is XML?... 106 How the Web is Today... 108 New Universal Data Exchange Format: XML... 108 What is the W3C?... 108 Semistructured Data... 110 What is Self-describing Data?...

More information

Extensible Markup Language (XML) What is XML? Structure of an XML document. CSE 190 M (Web Programming), Spring 2007 University of Washington

Extensible Markup Language (XML) What is XML? Structure of an XML document. CSE 190 M (Web Programming), Spring 2007 University of Washington Page 1 Extensible Markup Language (XML) CSE 190 M (Web Programming), Spring 2007 University of Washington Reading: Sebesta Ch. 8 sections 8.1-8.3, 8.7-8.8, 8.10.3 What is XML? a specification for creating

More information

Why do we need an XML query language? XQuery: An XML Query Language CS433. Acknowledgment: Many of the slides borrowed from Don Chamberlin.

Why do we need an XML query language? XQuery: An XML Query Language CS433. Acknowledgment: Many of the slides borrowed from Don Chamberlin. Why do we need an XML query language? XQuery: n XML Query Language S433 cknowledgment: Many of the slides borrowed from Don hamberlin XML emerging as dominant standard for data representation and exchange

More information

Introduction to Database Systems CSE 414

Introduction to Database Systems CSE 414 Introduction to Database Systems CSE 414 Lecture 14-15: XML CSE 414 - Spring 2013 1 Announcements Homework 4 solution will be posted tomorrow Midterm: Monday in class Open books, no notes beyond one hand-written

More information

XML. extensible Markup Language. ... and its usefulness for linguists

XML. extensible Markup Language. ... and its usefulness for linguists XML extensible Markup Language... and its usefulness for linguists Thomas Mayer thomas.mayer@uni-konstanz.de Fachbereich Sprachwissenschaft, Universität Konstanz Seminar Computerlinguistik II (Miriam Butt)

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

XML: a "skeleton" for creating markup languages you already know it! <element attribute="value">content</element> languages written in XML specify:

XML: a skeleton for creating markup languages you already know it! <element attribute=value>content</element> languages written in XML specify: 1 XML What is XML? 2 XML: a "skeleton" for creating markup languages you already know it! syntax is identical to XHTML's: content languages written in XML specify:

More information

Extensible Markup Language (XML) What is XML? An example XML file. CSE 190 M (Web Programming), Spring 2008 University of Washington

Extensible Markup Language (XML) What is XML? An example XML file. CSE 190 M (Web Programming), Spring 2008 University of Washington Extensible Markup Language (XML) CSE 190 M (Web Programming), Spring 2008 University of Washington Except where otherwise noted, the contents of this presentation are Copyright 2008 Marty Stepp and Jessica

More information

Introduction Syntax and Usage XML Databases Java Tutorial XML. November 5, 2008 XML

Introduction Syntax and Usage XML Databases Java Tutorial XML. November 5, 2008 XML Introduction Syntax and Usage Databases Java Tutorial November 5, 2008 Introduction Syntax and Usage Databases Java Tutorial Outline 1 Introduction 2 Syntax and Usage Syntax Well Formed and Valid Displaying

More information

Advances in Programming Languages

Advances in Programming Languages T O Y H Advances in Programming Languages APL17: XML processing with CDuce David Aspinall (see final slide for the credits and pointers to sources) School of Informatics The University of Edinburgh Friday

More information

Introduction. " Documents have tags giving extra information about sections of the document

Introduction.  Documents have tags giving extra information about sections of the document Chapter 10: XML Introduction! XML: Extensible Markup Language! Defined by the WWW Consortium (W3C)! Originally intended as a document markup language not a database language " Documents have tags giving

More information

Manipulating XML Trees XPath and XSLT. CS 431 February 18, 2008 Carl Lagoze Cornell University

Manipulating XML Trees XPath and XSLT. CS 431 February 18, 2008 Carl Lagoze Cornell University Manipulating XML Trees XPath and XSLT CS 431 February 18, 2008 Carl Lagoze Cornell University XPath Language for addressing parts of an XML document XSLT Xpointer XQuery Tree model based on DOM W3C Recommendation

More information

EMERGING TECHNOLOGIES

EMERGING TECHNOLOGIES EMERGING TECHNOLOGIES XML (Part 3): XQuery Outline 1. Introduction 2. Structure of XML data 3. XML Document Schema 3.1. Document Type Definition (DTD) 3.2. XMLSchema 4. Data Model for XML documents. 5.

More information

Marker s feedback version

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

Introduction. " Documents have tags giving extra information about sections of the document

Introduction.  Documents have tags giving extra information about sections of the document Chapter 10: XML Introduction! XML: Extensible Markup Language! Defined by the WWW Consortium (W3C)! Originally intended as a document markup language not a database language " Documents have tags giving

More information

Introduction to XML. XML: basic elements

Introduction to XML. XML: basic elements Introduction to XML XML: basic elements XML Trying to wrap your brain around XML is sort of like trying to put an octopus in a bottle. Every time you think you have it under control, a new tentacle shows

More information

CSS, Cascading Style Sheets

CSS, Cascading Style Sheets CSS, Cascading Style Sheets HTML was intended to define the content of a document This is a heading This is a paragraph This is a table element Not how they look (aka style)

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

CSE 880. Advanced Database Systems. Semistuctured Data and XML

CSE 880. Advanced Database Systems. Semistuctured Data and XML CSE 880 Advanced Database Systems Semistuctured Data and XML S. Pramanik 1 Semistructured Data 1. Data is self describing with schema embedded to the data itself. 2. Theembeddedschemacanchangewithtimejustlike

More information

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

The concept of DTD. DTD(Document Type Definition) Why we need DTD

The concept of DTD. DTD(Document Type Definition) Why we need DTD Contents Topics The concept of DTD Why we need DTD The basic grammar of DTD The practice which apply DTD in XML document How to write DTD for valid XML document The concept of DTD DTD(Document Type Definition)

More information

Structured documents

Structured documents Structured documents An overview of XML Structured documents Michael Houghton 15/11/2000 Unstructured documents Broadly speaking, text and multimedia document formats can be structured or unstructured.

More information

extensible Markup Language

extensible Markup Language extensible Markup Language XML is rapidly becoming a widespread method of creating, controlling and managing data on the Web. XML Orientation XML is a method for putting structured data in a text file.

More information

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

Delivery Options: Attend face-to-face in the classroom or remote-live attendance. XML Programming Duration: 5 Days Price: $2795 *California residents and government employees call for pricing. Discounts: We offer multiple discount options. Click here for more info. Delivery Options:

More information

ADT 2005 Lecture 7 Chapter 10: XML

ADT 2005 Lecture 7 Chapter 10: XML ADT 2005 Lecture 7 Chapter 10: XML Stefan Manegold Stefan.Manegold@cwi.nl http://www.cwi.nl/~manegold/ Database System Concepts Silberschatz, Korth and Sudarshan The Challenge: Comic Strip Finder The Challenge:

More information

EXtensible Markup Language XML

EXtensible Markup Language XML EXtensible Markup Language XML 1 What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data XML tags are not predefined.

More information

Query Engines for Web-Accessible XML Data

Query Engines for Web-Accessible XML Data Query Engines for Web-Accessible XML Data Leonidas Fegaras Ramez Elmasri University of Texas at Arlington Fegaras & Elmasri CSE @ UTA 1 I will present: Adding XML Support to an OODB an extension to ODMG

More information

CSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0

CSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0 CSI 3140 WWW Structures, Techniques and Standards Markup Languages: XHTML 1.0 HTML Hello World! Document Type Declaration Document Instance Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson

More information

Author: Irena Holubová Lecturer: Martin Svoboda

Author: Irena Holubová Lecturer: Martin Svoboda NPRG036 XML Technologies Lecture 1 Introduction, XML, DTD 19. 2. 2018 Author: Irena Holubová Lecturer: Martin Svoboda http://www.ksi.mff.cuni.cz/~svoboda/courses/172-nprg036/ Lecture Outline Introduction

More information

Part 2: XML and Data Management Chapter 6: Overview of XML

Part 2: XML and Data Management Chapter 6: Overview of XML Part 2: XML and Data Management Chapter 6: Overview of XML Prof. Dr. Stefan Böttcher 6. Overview of the XML standards: XML, DTD, XML Schema 7. Navigation in XML documents: XML axes, DOM, SAX, XPath, Tree

More information

Introduction to Database Systems CSE 444

Introduction to Database Systems CSE 444 Introduction to Database Systems CSE 444 Lecture 25: XML 1 XML Outline XML Syntax Semistructured data DTDs XPath Coverage of XML is much better in new edition Readings Sections 11.1 11.3 and 12.1 [Subset

More information

Using UML To Define XML Document Types

Using UML To Define XML Document Types Using UML To Define XML Document Types W. Eliot Kimber ISOGEN International, A DataChannel Company Created On: 10 Dec 1999 Last Revised: 14 Jan 2000 Defines a convention for the use of UML to define XML

More information

Querying XML Data. Querying XML has two components. Selecting data. Construct output, or transform data

Querying XML Data. Querying XML has two components. Selecting data. Construct output, or transform data Querying XML Data Querying XML has two components Selecting data pattern matching on structural & path properties typical selection conditions Construct output, or transform data construct new elements

More information

Introduction to XSLT. Version 1.0 July nikos dimitrakas

Introduction to XSLT. Version 1.0 July nikos dimitrakas Introduction to XSLT Version 1.0 July 2011 nikos dimitrakas Table of contents 1 INTRODUCTION... 3 1.1 XSLT... 3 1.2 PREREQUISITES... 3 1.3 STRUCTURE... 3 2 SAMPLE DATA... 4 3 XSLT... 6 4 EXAMPLES... 7

More information

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0 WEB TECHNOLOGIES A COMPUTER SCIENCE PERSPECTIVE CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0 Modified by Ahmed Sallam Based on original slides by Jeffrey C. Jackson reserved. 0-13-185603-0 HTML HELLO WORLD! Document

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

Data Exchange. Hyper-Text Markup Language. Contents: HTML Sample. HTML Motivation. Cascading Style Sheets (CSS) Problems w/html

Data Exchange. Hyper-Text Markup Language. Contents: HTML Sample. HTML Motivation. Cascading Style Sheets (CSS) Problems w/html Data Exchange Contents: Mariano Cilia / cilia@informatik.tu-darmstadt.de Origins (HTML) Schema DOM, SAX Semantic Data Exchange Integration Problems MIX Model 1 Hyper-Text Markup Language HTML Hypertext:

More information

XML. Jonathan Geisler. April 18, 2008

XML. Jonathan Geisler. April 18, 2008 April 18, 2008 What is? IS... What is? IS... Text (portable) What is? IS... Text (portable) Markup (human readable) What is? IS... Text (portable) Markup (human readable) Extensible (valuable for future)

More information

XML. COSC Dr. Ramon Lawrence. An attribute is a name-value pair declared inside an element. Comments. Page 3. COSC Dr.

XML. COSC Dr. Ramon Lawrence. An attribute is a name-value pair declared inside an element. Comments. Page 3. COSC Dr. COSC 304 Introduction to Database Systems XML Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca XML Extensible Markup Language (XML) is a markup language that allows for

More information

Part II: Semistructured Data

Part II: Semistructured Data Inf1-DA 2011 2012 II: 22 / 119 Part II Semistructured Data XML: II.1 Semistructured data, XPath and XML II.2 Structuring XML II.3 Navigating XML using XPath Corpora: II.4 Introduction to corpora II.5 Querying

More information