Introduction to XQuery and eXist DSA. XSLT Tutorial Problems Bad language : – No ! – for XML schema –Some XSLT engines tolerant of extra tags (permissive),

Slides:



Advertisements
Similar presentations
XML: Extensible Markup Language
Advertisements

Java Script Session1 INTRODUCTION.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
XSL XSLT and XPath 11-Apr-17.
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?
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
Languages for Dynamic Web Documents
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.
Native XML Database for Information Systems Chris Wallace ISD3 March 2006.
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 XQuery workshop April 2006.
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
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
UFCEKG-20-2 Data, Schemas & Applications Lecture 4 Server Side Scripting & PHP.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
ITD 3194 Web Application Development Chapter 4: Web Programming Language.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
Server-side Scripting Powering the webs favourite services.
DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New.
Introduction technology XSL. 04/11/2005 Script of the presentation Introduction the XSL The XSL standard Tools for edition of codes XSL Necessary resources.
WORKING WITH XSLT AND XPATH
XP New Perspectives on XML, 2 nd Edition Tutorial 10 1 WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10.
Session II Chapter 2 – Chapter 2 – XSLhttp://
NetTech Solutions Working with Web Elements Lesson 6.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
OXygen XML Editor Support for eXist DB XQuery debugging. Stefan Vasile
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
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.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
Transforming Documents „a how-to of transforming xml documents“ Lecture on Walter Kriha.
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.
Using oXygen 12 with XQuery Using oXygen to build and execute XQuery XQuery applications on eXist Date: April 2011 Dan McCreary President Dan McCreary.
CS 157B: Database Management Systems II February 20 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
XSLT. XSLT stands for Extensible Stylesheet Language Transformations XSLT is used to transform XML documents into other kinds of documents. XSLT can produce.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH ( ) SOMYA SHRIVASTAV ( ) SONAM JINDAL ( )
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Apache Cocoon – XML Publishing Framework 데이터베이스 연구실 박사 1 학기 이 세영.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
Session IV Chapter 14 – Chapter 14 – XSLThttp://
XML: Extensible Markup Language
Tutorial 10 Programming with JavaScript
Querying and Transforming XML Data
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.
Web Application Development Using PHP
Presentation transcript:

Introduction to XQuery and eXist DSA

XSLT Tutorial Problems Bad language : – No ! – for XML schema –Some XSLT engines tolerant of extra tags (permissive), others fail Mime type table on our servers not set up –Should be an entry for file suffices.xsl,.xslt –To set the MIME type application/xml Variations in server and browser configurations

Solution: server-side XSLT Several XSLT engines –Xalan ( a free Java application) –SAXON The Native XML Database eXists includes a command to apply a stylesheet to an XML file and get the results – uses Xalan

eXist Native XML Database Open source Wolfgang Meier is the chief architect Written in Java Deployable in different ways –Embedded in a Java application –Part of a Cocoon pipeline –As web application in Apache/Tomcat –With embedded Jetty HTTPserver (as on stocks) Multiple Interfaces –REST – to Java servlet –SOAP –XML:RPC

Native XML database Well-formed XML documents can be added to the database They are stored in an efficient, searchable B+ tree structure Documents (files) are organised into collections in a filestore Non-XML resources (XQuery, CSS, JPEG..), etc can be stored as binary

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.

Suggested Suffices XQuery.xql XSLT.xslt XML.xml CSS.css JPEG.jpg

Tools for XQuery on stocks Use a text editor (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