Presentation is loading. Please wait.

Presentation is loading. Please wait.

About XML/Xquery/RDF 4/1. Why XML XML is the confluence of several factors: –The Web needed a more declarative format for data, trying to describe the.

Similar presentations


Presentation on theme: "About XML/Xquery/RDF 4/1. Why XML XML is the confluence of several factors: –The Web needed a more declarative format for data, trying to describe the."— Presentation transcript:

1 about XML/Xquery/RDF 4/1

2 Why XML XML is the confluence of several factors: –The Web needed a more declarative format for data, trying to describe the meaning of the data –Documents needed a mechanism for extended tags –Database people needed a more flexible interchange format Original expectation: –The whole web would go to XML instead of HTML Today’s reality: –Not so… But XML is used all over “under the covers” TEXT Structured (relational) Data XML Less Structure More Structure

3 TEXT Structured (relational) Data XML Less Structure More Structure

4 An XML Document Example Fugitive, The Roger Ebert gives two thumbs up ! A fun action movie, Harrison Ford at his best. The standard &hollywood; summer movie strikes back. 183,752,965 X Files,The 4 Start Tag End Tag Attribute Element Mixed Content

5 XML Terminology tags: book, title, author, … start tag:, end tag: elements: …, … elements are nested empty element: abbrv. an XML document: single root element well formed XML document: if it has matching tags

6 More XML: Attributes Foundations of Databases Abiteboul … 1995 Attributes are single-valued --No guidance on when to use them

7 More XML: Oids and References Jane Mary John oids and references in XML are just syntax Object identifiers

8 HTML vs. XML Bibliography Foundations of Databases Abiteboul, Hull, Vianu Addison Wesley, 1995 Data on the Web Abiteoul, Buneman, Suciu Morgan Kaufmann, 1999 Foundations… Abiteboul Hull Vianu Addison Wesley 1995 … “Self-describing” -Schema info part of the data -Good for data exchange (albeit baroque for storage)

9 Bibliography Foundations of Databases Abiteboul, Hull, Vianu Addison Wesley, 1995 Data on the Web Abiteoul, Buneman, Suciu Morgan Kaufmann, 1999 Foundations… Abiteboul Hull Vianu Addison Wesley 1995 … HTML describes presentation XML describes content

10 Why are Database folks so excited about XML? XML is just a syntax for (self- describing) data This is still exciting because –No standard syntax for relational data –With XML, we can Translate any legacy data to XML Can exchange data in XML format –Ship over the web, input to any application

11 XML  machine accessible meaning This is what a web-page in natural language looks like for a machine Jim Hendler

12 XML  machine accessible meaning CV name education work private XML allows “meaningful tags” to be added to parts of the text Jim Hendler

13 XML  machine accessible meaning CV name education work private But to your machine, the tags look like this…. Jim Hendler

14 XML  machine accessible meaning Schemas help…. …by relating common terms between documents  Jim Hendler

15 But other people use other schemas CV name education work private   >  Someone else has one like this…. Jim Hendler

16 But other people use other schemas …which don’t fit in  Moral: There is still need for ontology mapping.. Jim Hendler

17 The X-standards… XML: an on-the-wire representation for data –Xquery: a query language for XML –Xschema: a schema description language for XML data RDF: a language for meta- data description WSDL/SOAP/UDDI: languages for describing services

18 Bibliography Foundations of Databases Abiteboul, Hull, Vianu Addison Wesley, 1995 Data on the Web Abiteoul, Buneman, Suciu Morgan Kaufmann, 1999 Foundations… Abiteboul Hull Vianu Addison Wesley 1995 … HTML describes presentation XML describes content

19 XML Dialect “pot pourri” Extensible Financial Reporting Markup Language (XFRML), eXtensible Business Reporting Language (XBRL), MusicXML, Spacecraft Markup Language (SML), Bank Internet Payment System (BIPS), Bioinformatic Sequence Markup Language (BSML), Biopolymer Markup Language (BIOML), Open Catalog Format (OCF), Chemical Markup Language (CML), Electronic Business XML Initiative (ebXML), Open Trading Protocol (OTP), FinXML, Financial Information eXchange protocol (FIX), RecipeML, CVML, XML Bookmark Exchange Language (XBEL), Scalable Vector Graphics (SVG), NewsML, DocBook, Real Estate Listing Markup Language (RELML),...

20 XML vs. Relational Data XML is meant as a language that supports both Text and Structured Data –Conflicting demands... XML supports semi-structured data –In essence, the schema can be union of multiple schemas Easy to represent books with or without prices, books with any number of authors etc. XML supports free mixing of text and data –using the #PCDATA type XML is ordered (while relational data is unordered) TEXT Structured (relational) Data XML Less Structure More Structure

21 XML Data Model “two...” imdb show title review “Fugitive, The” review suntimes reviewer rating nyt “Roger Ebert” “gives” @year “1993” … Check http://www.w3.org/XML/ for more detailshttp://www.w3.org/XML/

22 DTDs <!DOCTYPE paper [ ]> <!DOCTYPE paper [ ]> … Notice that DTD is not In XML syntax…  Semi- structured

23 XML Schemas More recent proposal (with XML syntax) unifies previous schema proposals generalizes DTDs uses XML syntax two documents: structure and datatypes –http://www.w3.org/TR/xmlschema-1 –http://www.w3.org/TR/xmlschema-2

24 XML Schema

25 RDF: Meta-data Standard for Web birds, butterflies, snakes John Smith Good’ol semantic networks..?

26 XQuery 1.0: An XML Query Language –W3C Working Draft 20 December 2001 XML Query Use Cases –W3C Working Draft 20 December 2001 Microsoft.Net Xquery Language Demo –http://131.107.228.20/http://131.107.228.20/ –http://support.x- hive.com/xquery/index.ht ml –Supports querying on the documents described in the W3C Use Cases Xquery Tutorial by Fankhauser & Wadler –www.research.avayalabs.com/ user/wadler/papers/xquery- tutorial/ xquery-tutorial.pdf Xquery Resources

27 10/24 --Exam 1 returned (both versions) --Project 2 due on Wednesday --Homework 3 started (will be closed shortly) --Approximate schedule of topics put up Today: Xquery discussion Semantic Web standards

28 Exam 1 Stats In-class Avg: 44; Max: 62; Min: 32; Stdev: 12.7 Grads: 49/62/33/9.8 UG: 34/53/16/12.6 At-home Avg: 53;Max: 63; Min: 32.5; Stdev: 8.18 Grads: 56.8/63/49/4.75 UG: 48.4/59/32.5/9.69 All happy families are happy alike, each unhappy family is unhappy in its own way All correct answers are correct alike, each incorrect answer is incorrect in its own way

29 Querying XML Requirements: –Need to handle lack of schema. We may not know much about the data, so we need to navigate the XML. –Need to support both “information retrieval” and “SQL- style” queries. Ordered vs. un-ordered XML –“Human readable” like SQL? Candidates –Many… based on conflicting requirements XSL: Makes IR folks happy XML-QL: Makes DB folks happy Xquery : W3C’s attempt to make everybody (un)happy

30 http://support.x-hive.com/xquery/index.html You will be asked to play with it in homework 3 qn 4

31 FLoWeR Expressions Xquery queries are made up of FLWR expressions that work on “paths” For binds variables to nodes Let computes aggregates Where applies a formula to find matching elements Return constructs the output elements Path expressions are of the form: element//element/element[attrib=value]

32 Comparison to SQL Look at the use case description on Xquery manual Supports all (?) SQL style queries (with different syntax of course) [default queries in the demo] Has support for –“construction”—outputting the answers in arbitrary XML formats (use case “XMP” ) –“path expressions” --- navigating the XML tree (use case “seq”) –Simple text queries [use case “text”] –Allows queries on “Tag” elements Removes the “data/meta-data” barrier in queries –For each book that has at least one author, list the title and first two authors, and an empty "et-al" element if the book has additional authors. [XMP use case 6]

33 DTD for http://www.bn.com/bib.xml

34 Example Query { for $b in /bib/book where $b/publisher = "Addison- Wesley" and $b/@year > 1991 return { $b/title } } “For all books after 1991, return with Year changed from a tag to an attribute” TCP/IP Illustrated Advanced Programming in the Unix environment Result Query

35 Example Query (2) Return the books that cost more at amazon than fatbrain Let $amazon := document(http://www.amazon.com/books.xml),http://www.amazon.com/books.xml Let $fatbrain := document(http://www.fatbrain.com/books.xml)http://www.fatbrain.com/books.xml For $am in $amazon/books/book, $fat in $fatbrain/books/book Where $am/isbn = $fat/isbn and $am/price > $fat/price Return { $am/title, $am/price, $fat/price } Join

36 XML frenzy in the DB Community Now that XML is there, what can we do with it? –Convert all databases from Relational to XML? Or provide XML views of relational databases? –Develop theory of native XML databases? Or assume that XML data will be stored in relational databases.. –Issues: What sort of storage mechanisms? What sort of indices?

37 XML middleware for Databases XML adapters (middle-ware) received significant attention in DB community –SilkRoute (AT&T) –Xperanto (IBM) Issues: – Need to convert relational data into XML Tagging (easy) –Need to convert Xquery queries into equivalent SQL queries Trickier as Xquery supports schema querying On the internet, nobody needs to know that you are a dog RDBMS


Download ppt "About XML/Xquery/RDF 4/1. Why XML XML is the confluence of several factors: –The Web needed a more declarative format for data, trying to describe the."

Similar presentations


Ads by Google