1 COS 425: Database and Information Management Systems XML and information exchange.

Slides:



Advertisements
Similar presentations
XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
Advertisements

XML Examples. Bank Information Basic structure: A-101 Downtown 500 … Johnson Alma Surrey … A-101 Johnson …
XML: Extensible Markup Language
1 XQuery Web and Database Management System. 2 XQuery XQuery is to XML what SQL is to database tables XQuery is designed to query XML data What is XQuery?
Agenda from now on Done: SQL, views, transactions, conceptual modeling, E/R, relational algebra. Starting: XML To do: the database engine: –Storage –Query.
1 Lecture 10 XML Wednesday, October 18, XML Outline XML (4.6, 4.7) –Syntax –Semistructured data –DTDs.
Winter 2002Arthur Keller – CS 18018–1 Schedule Today: Mar. 12 (T) u Semistructured Data, XML, XQuery. u Read Sections Assignment 8 due. Mar. 14.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
XMLII XSchema XSchema XQuery XQuery. XML Schema XML Schema is a more sophisticated schema language which addresses the drawbacks of DTDs. Supports XML.
4/20/2017.
Computing & Information Sciences Kansas State University Monday. 20 Oct 2008CIS 560: Database System Concepts Lecture 21 of 42 Monday, 20 October 2008.
Lecture 7 of Advanced Databases XML Querying & Transformation Instructor: Mr.Ahmed Al Astal.
Lecture 21 XML querying. 2 XSL (eXtensible Stylesheet Language) In HTML, default styling is built into browsers as tag set for HTML is predefined and.
1 COS 425: Database and Information Management Systems XML and information exchange continued Last time: XML document structure XML querying with XQuery.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake.
Maziar Sanaii Ashtiani – SCT – EMU, Fall 2011/12.
XML and XPath. Web Services: XML+XPath2 EXtensible Markup Language (XML) a W3C standard to complement HTML A markup language much like HTML origins: structured.
TDDD43 XML and RDF Slides based on slides by Lena Strömbäck and Fang Wei-Kleiner 1.
Lecture 6 of Advanced Databases XML Querying & Transformation Instructor: Mr.Eyad Almassri.
Computing & Information Sciences Kansas State University Friday, 17 Oct 2007CIS 560: Database System Concepts Lecture 21 of 42 Friday, 17 October 2008.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
Introduction to XML Eugenia Fernandez IUPUI. What is XML? From the World Wide Web Consortium (W3C) The Extensible Markup Language (XML) is the universal.
WORKING WITH XSLT AND XPATH
An Introduction to XML Presented by Scott Nemec at the UniForum Chicago meeting on 7/25/2006.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Company LOGO OODB and XML Database Management Systems – Fall 2012 Matthew Moccaro.
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
Winter 2006Keller, Ullman, Cushing18–1 Plan 1.Information integration: important new application that motivates what follows. 2.Semistructured data: a.
Computing & Information Sciences Kansas State University Thursday, 15 Mar 2007CIS 560: Database System Concepts Lecture 24 of 42 Thursday, 15 March 2007.
Database Systems Part VII: XML Querying Software School of Hunan University
XML Name: Niki Sardjono Class: CS 157A Instructor : Prof. S. M. Lee.
[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
1 XML eXtensible Markup Language. 2 XML vs. HTML HTML is a HyperText Markup language HTML is a HyperText Markup language Designed for a specific application,
The Semistructured-Data Model Programming Languages for XML Spring 2011 Instructor: Hassan Khosravi.
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
1 Indexing The syntax for creating a index is: CREATE [UNIQUE] INDEX index_name ON table_name (column1, column2,... column_n) [ COMPUTE STATISTICS ]; Why.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
+ 1 XML eXtensible Markup Language. + 2 XML Lecture Adapted from the work of Dr. Praveen Madiraju of Marquette University.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
XML Query: xQuery Reference: Xquery By Priscilla Walmsley, Published by O’Reilly.
Computing & Information Sciences Kansas State University Friday, 20 Oct 2006CIS 560: Database System Concepts Lecture 24 of 42 Friday, 20 October 2006.
Martin Kruliš by Martin Kruliš (v1.1)1.
Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML.
Chapter 5 The Semantic Web 1. The Semantic Web  Initiated by Tim Berners-Lee, the inventor of the World Wide Web.  A common framework that allows data.
Querying XML, Part II Zachary G. Ives University of Pennsylvania CIS 455 / 555 – Internet and Web Systems February 5, 2008.
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
SEMI-STRUCTURED DATA (XML) 1. SEMI-STRUCTURED DATA ER, Relational, ODL data models are all based on schema Structure of data is rigid and known is advance.
XML – Basic Concepts (modified version from Dr. Praveen Madiraju) 2015, Fall Pusan National University Ki-Joune Li.
XML Extensible Markup Language
ADT 2010 Introduction to (XML, XPath &) XQuery Chapter 10 in Silberschatz, Korth, Sudarshan “Database System Concepts” Stefan Manegold
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
XML: Extensible Markup Language
Querying and Transforming XML Data
XML QUESTIONS AND ANSWERS
CS 480: Database Systems Lecture 28 March 22, 2013.
XML in Web Technologies
eXtensible Markup Language (XML)
Lecture 9: XML Monday, October 17, 2005.
More XML XML schema, XPATH, XSLT
Presentation transcript:

1 COS 425: Database and Information Management Systems XML and information exchange

2 XML eXtensible Markup Language History 1988 SGML: Standard Generalized Markup Language –Annotate text with structure 1992 HTML: Hypertext Mark-up Language –Documents that are linked pieces –Simple structure of language 1996 XML –General-purpose description of content of a document –Includes namespaces → linking across the Web –Designed by working group of W3C (WorldWide Web Consortium) Define standard

3 XML On surface looks much like HTML: Tags: title of document Structure: tags within tags … … –Must be nested → hierarchy Tags have attributes But Tags are User-defined General metadata

4 XML Originally tags generalized description of document display– allow flexibility in markup Now tags can have any meaning –parties using agree in advance as to meaning Can use as data specification XML has become major vehicle of exchanging data among unrelated, heterogeneous parties –Internet major vehicle of distribution

5 Example XML 2007 Joe Jones … cos 425 cos 432 eng 331 etc. ……… ….

6 Important XML concepts Information/data contained in a document –Document = Database Tags contain text and other tags Tags can be repeated arbitrary number of times Tags may or may not appear –Example for : … football … Attributes of tags (strings) may or may not appear Tags need not appear in rigid order

7 Benefits of XML representation Self documenting by tag names Flexible formatting –Can introduce new tags or values Format can evolve without invalidating old Can have multi-valued components –e.g. courses of student, authors of book Wide variety of tools can process –Browsers –DB tools

8 Undesirable properties of XML representation Verbose representation: repetition of tag names Inefficient Redundant representation –Document contains all info, even if much does not change eg document containing employee info: basic name, address, etc. repeated even if only assignment changes Compare one table in relational DB

9 Board Example

10 Specification Need exchange syntax (semantics?) as well as XML document: XSL – eXtensible Style Language –How display information DTD = Document Type Declaration –User specifies own tags and attributes –User-defined grammar for syntax  XML Schema – similar to but more general than DTD

11 Semistructured Data Model XML gives structure, but not fully or rigidly specified Tag <> … defines XML element - Elements may contain sub-elements - Elements may contain values - Elements may have attributes Use labeled tree model - Element → node: atomic or compound object - Leaves: values and attributes

12 Example 2005 Joe Jones … cos 425 eng 331 etc. ……… ….

13 students studentstudent ….. student year name address course1 course2 … coursek 2005fn ln … cos425 deptal eng331 elective psy255 … Joe Jones type

14 XML Tools Display –Very flexible what and how display Convert to different represenation –Example: put in relational database? Extract information from XML document  Querying

15 Querying XML Storing data in XML; want to query Could map to relational model, but then must restructure data Several querying languages –XPath : now building block –Quilt : historic –XQuery –XSLT : designed for style sheets but general

16 XQUERY Specified by W3C working group –Circa 2000 Derived from older languages Modeled after SQL

17 Brief look at XQUERY FLWOR (flower) expression: FOR path expression – anal. to SQL “FROM” LET variable name = path expression – anal. To SQL “AS” WHERE condition – anal. to SQL “WHERE” ORDER BY – anal. to SQL “ORDER BY” RETURN – constructs XML result – anal to SQL “SELECT” XQUERY returns XML fragment –XML → XML Compare: relations → relation XQuery SQL

18 Path expression Traverse paths of tree –Use element names to name path Take all matching branches Returns sequence of nodes of tree –Node = XML elements Doc. Identifier // element name / e.g. URL indicates element indicates immed. root of tree nested anywhere- child of path so jump down tree far at this point in path e.g. /students/student/course

19 students studentstudent ….. student year name address course1 course2 … coursek 2005fn ln … cos425 deptal eng331 elective psy255 … Joe Jones type

20 Path expressions – some details Returns sequence of matching elements –Includes tags of those elements –Sequence ordered by appearance in document Attributes can be … /* denotes all children of elements …/ Predicates at any point in path –Prunes out paths –e.g. Doc( document name) returns root of a named document –File name –URL (URI)

21 XQuery FOR … For $x in path expression 1, $y in path expression 2, … $ precedes variable name Each variable ranges over sequence of elements returned by its path expression Multiple variables => Cartesian product

22 XQuery Let … Let $z := path expression1 Let $q := path expression2 … Value of variable (e.g. $z) is entire sequence if path expression returns sequence

23 XQuery WHERE … WHERE predicate Predicate on set defined in FOR FOR $b IN /students/student WHERE $b/year=‘2007’ Rich set of functions, comparison operations

24 XQuery RETURN … Constructs XML result Give explicit tags for result Give expressions to be evaluated {expression} Example FOR $b IN doc_id/students/student WHERE $b/year=‘2005’ RETURN {$b/name/fn $b/name/ln} Gives: Joe … etc.

25 Example FOR $x IN doc_id//name/ln RETURN {$x} Gives: ? For : 2007 Joe Jones … 2008 Jane Smith …

26 Examples FOR $x IN doc_id//name/ln RETURN {$x} Gives: Jones Smith

27 Examples FOR $x IN doc_id//name/ln RETURN {$x/text()} Gives: Jones Smith Many functions

28 XQuery: A very incomplete list of features Are aggregation operations Can nest XQuery expressions in RETURN clause –Can get nested elements in result not nested in original Get joins: conditions in WHERE coordinate paths expressions over variables in FOR Can have if…then...else within RETURN clause Can have quantification within WHERE clause –SOME $e IN path expression SATISFIES predicate with $e free –EVERY $e IN …