Introduction to XQuery and eXist XQuery workshop April 2006.

Slides:



Advertisements
Similar presentations
XML Data Management 8. XQuery Werner Nutt. Requirements for an XML Query Language David Maier, W3C XML Query Requirements: Closedness: output must be.
Advertisements

Querying on the Web: XQuery, RDQL, SparQL Semantic Web - Spring 2006 Computer Engineering Department Sharif University of Technology.
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
Introduction to ETL Using Microsoft Tools By Dr. Gabriel.
Java Script Session1 INTRODUCTION.
XQuery John Annechino Steven Pow. Agenda What is XQuery? Uses of XQuery XQuery vs. XSLT Syntax –Built-In Functions –FLWOR –if-then-else –User-Defined.
XQUERY. What is XQuery? XQuery is the language for querying XML data The best way to explain XQuery is to say that XQuery is to XML what SQL is to database.
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?
Introduction to XQuery and eXist Week 21 DSA. DSA - XQuery2 Refresher on XPath XML databases XQuery Applications –Whiskies (again) –A simple blog The.
XSLT XML DBs, and Schemas Week 18 DSA. The Whisky Case study XSLT can be applied in the client. –Add a xml processing instruction to the xml to bind to.
A simple PHP application We are going to develop a simple PHP application with a Web interface. The user enters two numbers and the application returns.
DSA Semester 2. XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation.
Native XML Database for Information Systems Chris Wallace IS School Research Seminar Feb 2006.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Week 23 - Revision1 Week 23 Revision DSA. Week 23 - Revision2 Agenda Section A: Multiple choice Section B: Problem-oriented questions Topics for revision.
Introduction to XQuery and eXist DSA. XSLT Tutorial Problems Bad language : – No ! – for XML schema –Some XSLT engines tolerant of extra tags (permissive),
INTRODUCTION The Group WEB BROWSER FOR RELATION Goals.
Introduction to XQuery and eXist Week 17 DSA. DSA - XQuery2 XPath. Hierarchical file systems have been navigable with path expression since Unix –/abc/cde/../../efg.
XML Workshop XSLT. XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation.
1 COS 425: Database and Information Management Systems XML and information exchange.
Multiple Tiers in Action
Lecture 4: Introduction to PHP 3 PHP & MySQL
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
Simple PHP application. A simple application We are going to develop a simple PHP application with a Web interface. The user enters two numbers and the.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
UFCEKG-20-2 Data, Schemas & Applications Lecture 4 Server Side Scripting & PHP.
JSP Standard Tag Library
Server-side Scripting Powering the webs favourite services.
Web Application Development. Define ER model in QSEE Generate SQL Create Database mySQL Write Script to use TableEditor class Process to create A simple.
Web Application Development. Tools to create a simple web- editable database QSEE MySQL (or PHPMyAdmin) PHP TableEditor.
DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New.
XP New Perspectives on XML, 2 nd Edition Tutorial 10 1 WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10.
An Introduction to XML Presented by Scott Nemec at the UniForum Chicago meeting on 7/25/2006.
Session II Chapter 2 – Chapter 2 – XSLhttp://
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
Client side web programming Introduction Jaana Holvikivi, DSc. School of ICT.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Transforming Documents „a how-to of transforming xml documents“ Lecture on Walter Kriha.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
1 Overview of XSL. 2 Outline We will use Roger Costello’s tutorial The purpose of this presentation is  To give a quick overview of XSL  To describe.
Mike Jackson EPCC OGSA-DAI Architecture + Extensibility OGSA-DAI Tutorial GGF17, Tokyo.
CS 157B: Database Management Systems II February 20 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
CSC 405: Web Application Engineering II8.1 Web programming using PHP What have we learnt? What have we learnt? Underlying technologies of database supported.
XML Databases. XML Like HTML –Tags –Fixed vocabulary of tags and fixed structure –Tags indicate formatting, not semantics Strict HTML – XHTML –Always.
Display Page (HTML/CSS)
Visual Database Creation with MySQL Workbench 도시정보시스템 설계
Apache Cocoon – XML Publishing Framework 데이터베이스 연구실 박사 1 학기 이 세영.
Generating XML Data from a Database Eugenia Fernandez IUPUI.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
1 XSLT XSLT (extensible stylesheet language – transforms ) is another language to process XML documents. Originally intended as a presentation language:
Session IV Chapter 14 – Chapter 14 – XSLThttp://
XML: Extensible Markup Language
Session IV Chapter 16 – XQuery
Querying XML XQuery.
Web Browser server client 3-Tier Architecture Apache web server PHP
Querying XML XQuery.
Web DB Programming: PHP
8 6 MySQL Special Topics A Guide to MySQL.
Lecture 5: Functions and Parameters
Getting Started With Solr
Presentation transcript:

Introduction to XQuery and eXist XQuery workshop April 2006

Whisky Case study Starting point is the Collins Gem Whisky book. Based on extracts, students construct a schema. Schema diagrammed using QSEE. XML Schema generated by QSEE. InfoPath used to build an input form based on the XML schema. Sample data entered using the InfoPath form interface. Data loaded into eXist for querying.

<?mso-infoPathSolution productVersion=" " PIVersion=" " href="file:whisky.xsn" name="urn:schemas-microsoft-com:office:infopath:whisky:" language="en- gb" solutionVersion=" " ?> 132 Glen Garioch Glengarioch Distillery, Oldemldrum, Aberdeenshire Blend true This medium-bodied whisky, with its light texture and smoky flavour, is an ideal after-dinner dram. Set in the Aberdeenshire market town of Oldmeldrum, Glengarioch was reputedly founded in the 1790's. By_Appointment Running false

Executing an XQuery eXist DB a.xql XQuery Engine parameters html Client Browser eXist: Server Get a.xql parameters servlet fetch a.xql render User clicks link

Simple XQuery xquery version "1.0"; Name Address {for $w in doc('/db/whisky/data_raw.xml')/Whisky/Distillery return {data($w/Name)} {data($w/Address)} } addressList.xql

XQuery as HTML xquery version "1.0"; Name Address {for $w in doc('/db/whisky/data_raw.xml')/Whisky/Distillery return {data($w/Name)} {data($w/Address)} } XQuery ‘variable’ xQuery header XPath expression to select nodes Xquery inside XML addressList.xql

Executing an XQuery with XSLT eXist DB a.xql XQuery Engine parameters.xml XSLT Engine html Client Browser eXist: Server Get a.xql parameters servlet fetch a.xql render User clicks link xslt

Simplest XQuery -XSLT xquery version "1.0"; declare namespace transform = " let $stylesheet := doc('/db/whisky/whisky.xslt'), $whiskySet := doc('/db/whisky/data_raw.xml') return transform:transform($whiskySet,$stylesheet,()) allWhiskys.xql

Simplest XQuery -XSLT namespace prefix Retrieve this document a FLWOR expression Comma separator allWhiskys.xql xquery version "1.0"; declare namespace transform = " let $stylesheet := doc('/db/whisky/whisky.xslt'), $whiskySet := doc('/db/whisky/data_raw.xml') return transform:transform($whiskySet,$stylesheet,())

XQuery with parameter selectWhiskys.xql xquery version=“1.0”; declare namespace transform = " declare namespace request=" let $whiskyType := request:request-parameter ("whiskyType",""), $stylesheet := doc('/db/whisky/whisky.xslt'), $whiskySet := {doc('/db/whisky/data_raw.xml')/Whisky/Distillery [WhiskyType = $whiskyType]} return transform:transform($whiskySet,$stylesheet,())

XQuery with parameter xquery version=“1.0”; declare namespace transform = " declare namespace request=" let $whiskyType := request:request-parameter ("whiskyType",""), $stylesheet := doc('/db/whisky/whisky.xslt'), $whiskySet := {doc('/db/whisky/data_raw.xml')/Whisky/Distillery [WhiskyType = $whiskyType]} return transform:transform($whiskySet,$stylesheet,()) Get the value of the request parameter with this name Create an XML node XPath filter selectWhiskys.xql

XQuery is bi-lingual XML and XQuery XML node (with a single root) h XML Sequence of nodes (,, ) XQuery construct variable value $var function evaluation – see Function list concat($var,’.xm’) for loop FLWOR if-then-else if (cond) then expression else expression Mixed expressions – need { } around XQuery to distinguish – {if.. } {$x} –if (cond) then Fred else ()

FLWOR expression FLWOR for $x in sequence let $a := expression, $b := expression where condition order by $var return expression –Returns a Sequence of nodes Compare with SQL select columns from tables where condition order by –Returns a Relation (table)

An XQuery sticky form The script here has several shifts between XML to XQuery Whole interface in one script –Equivalent to PHP + MySQL XSLT revised to process a sequence of Distillery nodes into a sequence of HTML nodes.

Tools for XQuery on stocks Use a text editor (PFE32) or Dreamweaver Use the admin interface with guest/guest login to create a directory and load all the files – including the XQuery files To run a script, just click on the script in the directory listing – this will run the script (but with no parameters – you can add these in the Browser This will show you the URL to execute it – you can then use this to link from any HTML outside the eXist database. Use the test query interface to test small bits of XQuery and XPath

eXist on your own machine Use the Java client to –load files –move, copy,rename files –edit files in situ (but no Save-as) –execute queries –backup