29
Webmasters’ Guild Workgroup Friday, April 2, 2010 Welcome These presentation slides will be available on the NYS Forum Web site at www.nysforum.org http://www.nysforum.org/committees/webmastersguild/ resources.aspx

Webmasters’ Guild Workgroup Friday, April 2, 2010 Welcome These presentation slides will be available on the NYS Forum Web site at

Embed Size (px)

Citation preview

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Welcome

These presentation slides will be available on the NYS Forum Web site at

www.nysforum.org

http://www.nysforum.org/committees/webmastersguild/resources.aspx

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Agenda

Opening Remarks (5 mins)

OCIO/OFT Update (5 mins)

XML Databases and XQuery (30 mins)

Brainstorming Planning Session (60 mins)

Webmasters’ Guild WorkgroupFriday, April 2, 2010

XML Databases and XQuery

A Brief Introduction

Jim Costello

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Components of XML

• XML - encoding documents electronically• XSL - transforming and rendering XML documents• XPath - addressing the parts of an XML document• XML Database – storing collections of XML data• XQuery - querying collections of XML data• SQL/XML - querying XML within SQL• XForms - interfacing with XML data• XRX - XForms-REST-XML Database (All XML)

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Common Uses of XML

• Data exchange - XML enables platform-independent data exchange among applications.

• Web content management - usually implemented as a Web application, for creating and managing HTML content. Content is frequently, but not universally, stored as XML.

• RSS - a simple XML format used to syndicate headlines.

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Data and Databases Relational vs. XML

Relational• no hierarchy or significant

order; • based on two-dimensional

tables. • Used for storing and querying

data. • Data is stored in columns and

rows with key fields that join data together from separate tables;

• schema necessary.

XML • hierarchical and sequential; • based on trees in which order

matters. • Used for exchanging and

displaying data. • Data is stored as XML

documents; can be highly structured, semi-structured, or unstructured;

• schema not necessary.

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Relational Database

(tables, columns, rows, keys)

Webmasters’ Guild WorkgroupFriday, April 2, 2010

XML Database(collections, files)

Webmasters’ Guild WorkgroupFriday, April 2, 2010

From Web Form to Relational Database

“shredding”

Webmasters’ Guild WorkgroupFriday, April 2, 2010

From Web Form to XML Database“as is”

Webmasters’ Guild WorkgroupFriday, April 2, 2010

The Real Difference

"XML is by definition self-describing data. Build the database around that structure not the other way around. The

implementation is far from being that simplistic. This basic concept however – leverage XML’s self-describing and

hierarchical nature to manage it – is the very foundation of an XML database."

(from http://bigmenoncontent.com/2009/05/28/xdb-matters/ )

Webmasters’ Guild WorkgroupFriday, April 2, 2010

When and Why to Use an XML Database

• Got XML? (If you have more than a handful of XML documents to store, consider using an XML database.)

• Storing and querying document-centric XML, integrating data, and storing and querying semi-structured data.

• Handling rapidly evolving schemas, working with very large documents, querying hierarchical data, and running Web sites (content management).

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Two Immediate Benefits

By storing XML data as XML in XML database:

• Simplified storage

• New query capabilities

Webmasters’ Guild WorkgroupFriday, April 2, 2010

XQuery

FLWOR Syntax:• For – iterates through an input sequence• Let – declares a variable and gives it a value• Where – filters the selection • Order by – sorts• Return – defines the result

Somewhat similar to Select statement in SQL:• SELECT * FROM locationsTable WHERE city =

“Albany” ORDER BY zip;

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Retrieving Data from DatabasePerform query to select all registrations for a specific course and sort them by date

<class><className>Using XML for Web Site Management</className><location>Main Office</location><date>2010-01-21</date><timeStart>08:30:00</timeStart><timeEnd>12:30:00</timeEnd><firstName>James</firstName><lastName>Costello</lastName><organization>CTG</organization><phone>765-4321</phone><email>[email protected]</email>

</class><class>

<className>Using XML for Web Site Management</className> <location>Microknowledge</location><date>2010-06-04</date><timeStart>08:30:00</timeStart><timeEnd>16:30:00</timeEnd><firstName>Liz</firstName><lastName>Weaver</lastName><organization>Advocates for Homeless</organization><phone>518-777-1234</phone><email>[email protected]</email>

</class>

<class><className>Using XML for Web Site Management</className><location>Microknowledge</location><date>2010-06-04</date><timeStart>08:30:00</timeStart><timeEnd>16:30:00</timeEnd><firstName>Franklin</firstName><lastName>Parker</lastName><organization>Advocates for Homeless</organization><phone>518-777-4321</phone><email>[email protected]</email></class>

<class><className>Using XML for Web Site Management</className><location>00034</location><date>2010-08-11</date><timeStart>08:30:00</timeStart><timeEnd>12:30:00</timeEnd><firstName>James</firstName><lastName>Costello</lastName><organization>CTG</organization><phone>765-4321</phone><email>[email protected]</email>

</class>

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Simple FLWOR Statement

xquery version "1.0";for $registrations in

collection("classRegistrations")/classRegistrations/classlet $date := $registrations/date/text()where $registrations/className = "Using XML for Web Site Management"order by $datereturn $registrations

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Similar Statement in SQL

SELECT course.courseName, class.location, class.date, class.timeStart, class.timeEnd, student.firstName, student.lastName, student.organization, student.phone, student.email

FROM course,class,student,classStudent

WHERE course.courseName="Using XML for Web Site Management" and

course.courseID = class.courseID and

classStudent.classID = class.classID and

classStudent.studentID = student.studentID

ORDER BY class.date;

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Similar Statement in XSL/XPath<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="classRegistrations"><xsl:for-each select="class"><xsl:sort select="date"/><xsl:variable name="cName"><xsl:value-of select="className"/></xsl:variable>

<xsl:if test="$cName='Using XML for Web Site Management'"><class>

<className><xsl:value-of select="className"/></className><location><xsl:value-of select="location"/></location><date><xsl:value-of select="date"/></date><timeStart><xsl:value-of select="timeStart"/></timeStart><timeEnd><xsl:value-of select="timeEnd"/></timeEnd><firstName><xsl:value-of select="firstName"/></firstName><lastName><xsl:value-of select="lastName"/></lastName><organization><xsl:value-of select="organization"/></organization><phone><xsl:value-of select="phone"/></phone><email><xsl:value-of select="email"/></email>

</class></xsl:if>

</xsl:for-each></xsl:template></xsl:stylesheet>

Webmasters’ Guild WorkgroupFriday, April 2, 2010

New Query CapabilityQueryCreate a personalizedRSS feed based on keyword(s) that anindividual wants totrack within CTG’sWebsite.

How?Since all content on website is stored in XML database, it is all available to query. An XForms interface would enable visitors to submit their own terms of interest for building a personalized RSS.

Webmasters’ Guild WorkgroupFriday, April 2, 2010

New Query Resultshttp://www.ctg.albany.edu/about/fulltextsearchRSS?param1=collaboration

Webmasters’ Guild WorkgroupFriday, April 2, 2010

New Query Capability

QueryCreate a list of CTG publicationsgrouped by main author.

How?Since all content on website is stored in XML database, individual documents can be queried at the node level and combined, grouped and sorted into results that are difficult if not impossible to achieve without XQuery.

Webmasters’ Guild WorkgroupFriday, April 2, 2010

New Query Resultshttp://www.ctg.albany.edu/publications/authorsList?sub=working

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Articles1. XML Databases - The Business Case

http://www.cfoster.net/articles/xmldb-business-case/

2. Introduction to Native XML Databaseshttp://www.xml.com/pub/a/2001/10/31/nativexmldb.html

3. Ronald Bourret, Consulting, writing, and research in XML and databaseshttp://www.rpbourret.com/xml/

4. Going Native: Making the Case for XML Databaseshttp://www.xml.com/pub/a/2005/03/30/native.html

5. A comparison of XML-enabled and native XML data management techniqueshttp://xml.sys-con.com/node/104980?page=0,0

6. Feature Comparison: EMC Documentum xDB vs. Oracle XML DB & IBM DB2 pureXML https://community.emc.com/docs/DOC-2999

7. XRX: Simple, Elegant, Disruptivehttp://www.oreillynet.com/xml/blog/2008/05/xrx_a_simple_elegant_disruptiv_1.html

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Tutorials1. Michael Kay’s XQuery Tutorials on Stylus Studio site

http://www.stylusstudio.com/xquery_primer.html

2. XQuery Wikibookhttp://en.wikibooks.org/wiki/XQuery

3. XForms Wikibookhttp://en.wikibooks.org/wiki/XForms

4. XRX Wikibookhttp://en.wikibooks.org/wiki/XRX

5. w3Schools Tutorialhttp://www.w3schools.com/xquery/default.asp

6. Various XQuery Linkshttp://delicious.com/jimcost/xquery

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Linkedin Groups1. eXist-db Open Source Native XML Database

2. Gov 2.0 XQuery, XForms and RESTful Services

3. XForms

4. XML and Related Technologies Network

5. XML Databases

6. XML-in-Practice

7. XQuery Network

8. XRX Web Application Architecture

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Contact

Jim CostelloCenter for Technology in Government

[email protected]

twitter.com/jtcostello

http://delicious.com/jimcost/xquery

518-442-3812

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Open Forum

• Brainstorming Planning Session

• URL Shortener for NYS

• Mobile Apps Development group

• Link Management – Approaches and software

(Dreamweaver, Xenu, Siteimprove, Firefox Developer Kit)

• Credit Card Payment Processing– Home-grown solutions? Outsourcing? Paypal?

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Thank You

See you next month

Friday

May 7, 2010

9:00 am to Noon

NYS Museum

Huxley Theatre

Slides available at:

http://www.nysforum.org/committees/webmastersguild/resources.aspx

Webmasters’ Guild WorkgroupFriday, April 2, 2010

Similar Statement in SQL

SELECT course.courseName, class.location, class.date, class.timeStart, class.timeEnd, student.firstName, student.lastName, student.organization, student.phone, student.email

FROM student INNER JOIN (course INNER JOIN (class INNER JOIN classStudent ON class.classID = classStudent.classID) ON (course.courseID = class.courseID) AND (course.ID = classStudent.ID)) ON (student.studentID = classStudent.studentID) AND (student.ID = class.ID)

WHERE (((course.courseName)="Using XML for Web Site Management"))

ORDER BY class.date;