W3c world wide web consortium
Download
1 / 8

W3C - PowerPoint PPT Presentation


  • 252 Views
  • Uploaded on

Get title of books published by Addison-Wesley after 1993. ... Get titles of books published after 1994, but. NOT published by Addison-Wesley. Order the ...

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'W3C' - Kelvin_Ajay


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
W3c world wide web consortium l.jpg
W3C(World Wide Web Consortium)

  • What is W3C?

    • An industry consortium, best known for standardizing HTML and XML.

    • Working Groups create or adopt new “recommendations”

  • www.w3.org


Xml extensible markup language l.jpg
XML(eXtensible Markup Language)

<bib>

<book year="1994">

<title>TCP/IP Illustrated</title>

<author>

<last>Stevens</last>

<first>W.</first>

</author>

<publisher>Addison Wesley</publisher>

<price>65.95</price>

</book>

<book year="1992">

<title> …

</bib>


Xquery example 1 l.jpg
XQuery – Example 1

Get title of books published by Addison-Wesley after 1993.

for $b in doc("XMP/bib.xml")/bib/book

where $b/publisher = "Addison-Wesley"

and $b/@year > 1993

return $b/title

<title>TCP/IP Illustrated</title>


Flwor expressions l.jpg
FLWOR Expressions

  • Basic FLWOR Expression:

    • For – consider (introduce a variable)

    • Let – introduce additional variables

    • Where – filter by conditions

    • Order by – order the output

    • Return – build results

  • Xquery is compositional: any place XML data can go, another { FLWOR } expression can go.


Xquery example 2 l.jpg
XQuery – Example 2

Get titles of books published after 1994, but

NOT published by Addison-Wesley.

Order the result in descending order by title.

for $b in doc("XMP/bib.xml")/bib/book

let $c := $b/publisher

where $c != "Addison-Wesley"

and $b/@year > 1994

order by $b/title descending

return $b/title

<title>The Economics of Technology and Content of Digital TV</title><title>Data on the Web</title>


Xquery example 3 l.jpg
XQuery – Example 3

Join <bib> and <reviews> on <title> and print the title and price.

for $b in doc("XMP/bib.xml")/bib/book,

$e in doc("XMP/reviews.xml")/reviews/entry

where $e/title = $b/title

return

<titlelist>

{ $b/title, $e/price }

</titlelist>

<titlelist>

<title>TCP/IP Illustrated</title>

<price>65.95</price>

</titlelist>


Xquery example 4 l.jpg
XQuery – Example 4

Get the average price of the books.

<results>{

let $prices := doc("XMP/bib.xml")/bib/book/price

return

<avgprice>{ avg($prices) }</avgprice>

}</results>

<results>

<avgprice>75.45</avgprice>

</results>


Xquery example 5 l.jpg
XQuery – Example 5

Get year (as an attribute) and title of book. (Use a predicate to

limit the books to those published by Addison-Wesley.)

for $b in doc("XMP/bib.xml")/bib/book,

$c in $b[publisher = "Addison-Wesley"]

return

<book>

{ $c/@year }

{ $c/title }

</book>

<book year="1994">

<title>TCP/IP Illustrated</title>

</book><book year="1992">

<title>Advanced Programming in the Unix environment</title>

</book>


ad