1 / 14

Sheet 8

Sheet 8. XQuery. Organization. Exam will be on Tue. 17.07.2007 from 10-12 Room TBA Please register via email I will post old exams. xquery version "1.0"; //flight[@to = "Rom"]. xquery version "1.0"; for $flight in //flight where $flight[@to = "Rom"] order by $flight/@start ascending

blake
Télécharger la présentation

Sheet 8

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sheet 8 XQuery

  2. Organization • Exam will be on Tue. 17.07.2007 from 10-12 • Room TBA • Please register via email • I will post old exams

  3. xquery version "1.0"; //flight[@to = "Rom"] xquery version "1.0"; for $flight in //flight where $flight[@to = "Rom"] order by $flight/@start ascending return $flight

  4. xquery version "1.0"; let $flights:=//flight for $to in $flights[@to ="Rom"], $from in $flights[@from ="Baden-Baden"] where $to/@from eq $from/@to return <flights> { <from>{$from}</from>, <to>{$to}</to> } </flights>

  5. xquery version "1.0"; declare namespace f= "http://www.cgnm.de/xml/xquery/functions"; declare function f:search($des as xs:string, $dep as xs:string) { for $a in //flight where $a/@to = $des return if(data($a/@from)=$dep) then <start>{$a}</start> <transits>{ <transit>{$a }</transit>,f:search(data($a/@from), $dep) }</transits> }; <html> {f:search("Rom", "Baden-Baden")} </html>

  6. Validating & Static Type checking • Confer slides 28-31 • Validating: • Output doc check by normal validation • Output doc check by some test examples • Done at runtime

  7. Static Type Checking • Done at query compile time • Use validate expressions

  8. <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT uni (student+, session+)> <!ELEMENT student (name, take+)> <!ELEMENT take (grade)> <!ATTLIST takeIDREF #REQUIRED > <!ELEMENT session (courseno,semester,instructor) > <!ATTLIST session sessionNo ID #REQUIRED > <!ELEMENT name (#PCDATA)> <!ELEMENT courseno (#PCDATA)> <!ELEMENT semester (#PCDATA)> <!ELEMENT instructor (#PCDATA)> <!ELEMENT grade (#PCDATA)>

More Related