Title: XQuery Freeing XML and Relational Data for the Web
1XQueryFreeing XML and Relational Data for the
Web
2Overview
- XQuery
- The XQuery API for Java (XQJ)
- DataDirect XQuery
- Usage Scenarios
- XML Publishing
- Web Publishing
- Web Services
- Gevity Customer Story
Download DataDirect XQuery http//www.datadire
ct.com/downloads/registration/xquery/
3XML from Relational, XML
ltrequestgt ltperformancegt ltuserIdgtJonathanlt/us
erIdgt ltstartgt2003-01-01lt/startgt
ltendgt2004-06-01lt/endgt lt/performancegt lt/requestgt
ltportfolio userId"Jonathan"gt ltstock
ticker"AMZN"gt ltperformancegt
ltmingt18.86lt/mingt ltmaxgt59.69lt/maxgt
ltdailygt ltdaygt
ltdatetradedgt2003-01-02lt/datetradedgt
ltadjustedclosegt22.61lt/adjustedclosegt
lt/daygt ltdaygt
ltdatetradedgt2003-01-09lt/datetraded
gt ltadjustedclosegt22.18lt/adjust
edclosegt lt/daygt
ltdaygt ltdatetradedgt2003-01-16lt/
datetradedgt
ltadjustedclosegt21.93lt/adjustedclosegt
lt/daygt ltdaygt
ltdatetradedgt2003-01-23lt/datetradedgt
ltadjustedclosegt18.86lt/adjustedclosegt
lt/daygt ltdaygt
ltdatetradedgt2003-01-30lt/datetradedgt
4What is XQuery?
- Query Language for XML
- Find anything in an XML structure (path
expressions) - Create any XML structure (constructors)
- Combine data to create new structures (FLWOR
expressions) - Designed for Industrial Strength Applications
- Declarative language - optimizable
- Type safety
- Designed for Data Integration
- Non-XML sources viewed as XML (e.g. Relational)
- Status
- Candidate Recommendation
- Support from most major relational vendors
- 45 implementations on W3C page
- Recommendation 1H 2006? 3Q 2006?
5XQuery FLWOR Expressions
- for p in doc("portfolio.xml")/portfolio,
- s in p/stock
- where p/_at_userId "Jonathan"
- order by s/shares
- return
- ltsummarygt
-
- s/stockTicker,
- s/shares
-
- lt/summarygt
6XQuery Path Expressions
- for p in doc("portfolio.xml")/portfolio,
- s in p/stock
- where p/_at_userId "Jonathan"
- order by s/shares
- return
- ltsummarygt
-
- s/stockTicker,
- s/shares
-
- lt/summarygt
7XQuery XML Constructors
- for p in doc("portfolio.xml")/portfolio,
- s in p/stock
- where p/_at_userId "Jonathan"
- order by s/shares
- return
- ltsummarygt
-
- s/stockTicker,
- s/shares
-
- lt/summarygt
8Portfolio Demo The Queries
9Portfolio Demo XQuery Summary
- FLWOR expressions
- Like SQLs SELECT-FROM-WHERE
- Allow data to be combined based on conditions
- Path expressions
- Can locate anything in a document
- Constructors
- Allow any result to be created
- XML Report Writing
- Web messages
- Data for web sites
- XML Views of Relational Data
- Unified view of relational, XML sources
- Data integration
- Web message processing
10What is XQJ?
- XQuery API for Java (XQJ) JSR 225
- Analogous to JDBC
- Status first Early Draft Review
- Early Draft Review 2 expected very soon
- Final expected shortly after XQuery 1.0
Recommendation
11XQuery and XQJ
XQuery
Data Sources
XML View of RDB
XQJ
Application
XML Result
XML Input
12XQJ A Prepared Query
- // Get a connection, prepare the query
- dataSource new DDXQDataSource()
- dataSource.setJdbcUrl(jdbcxquerysqlserver/
/server11433databaseNamestocks) - connection dataSource.getConnection()
- preparedExpression connection.prepareExpress
ion(xqueryText) - // Bind variable l to 'Jonathan' and execute
- preparedExpression.bindString(new QName("p"),
"Jonathan") - xqSequence preparedExpression.executeQuery()
- System.out.println("\n\nHoldings for
Jonathan\n\n") - System.out.println(xqSequence.getSequenceAsStr
ing()) - // Bind variable l to 'Minollo' and execute
- preparedExpression.bindString(new QName("p"),
"Minollo") - xqSequence preparedExpression.executeQuery()
- System.out.println("\n\nHoldings for
Minollo\n\n")
13DataDirect XQuery
- Standards-based XQuery implementation
- Simplifies XML and Relational data integration
- Industry-leading query optimization and mediation
technology - Easily embeddable plugs into any architecture,
does not require a server - Works with most databases and application servers
14DataDirect XQuery
- XQuery for the Java platform
- Pure Java implementation
- Any Java platform
- Any server or no server
- Easily embeddable installs like JDBC driver
- XQuery API for Java (XQJ)
- Database support
- SQL Server 2000
- Oracle 9i, 10gR1
- DB2 W/U/L 8.x
- DB2 iSeries v5r2, v5r3
- DB2 z/OS 8
- Sybase 12.5
- XML sources
- http ftp and file schemes
- XML in DOM trees
- XML Output
- XML as text
- XML in DOM trees
- XML in SAX streams
- XML in StAX streams
- Designed for performance!
- Java developer IDE
- ltoXygen/gt XML Editor for Eclipse (DataDirect
Edition) - Inexpensive for DataDirect XQuery 1.0 licensees
- XML IDE
- Stylus Studio XML Enterprise Edition
- Purchased separately
15Scenario XML Publishing
HTML, PDF, PostScript, Paper
SQL
XML
XML
16Scenario Web Publishing
HTTP Request
Web Server
HTTP
HTML
XML
App Server
Application
SQL
17Scenario Web Services
SOAP Request
SOAP Server
HTTP
XML
XML
App Server
Application
SQL
18Customer Story Gevity
XQuery queries w/data from SalesForce.com
How much will it cost to outsource our HR to
Gevity?
- Users Gevity sales representatives
- Purpose quickly produce price quotes from within
SalesForce.com - Data Human Resource Data in Oracle 9i, customer
and prospect data in SalesForce.com - Can manage accounts from any internet connection
home, office, prospects office, or any Wi-Fi
hot spot - Deliver through many agents browser, cell
phone, blackberry, etc
19Customer Story Gevity
- Why XML?
- Easiest way to do data integration
- Why XQuery?
- XQuery XQJ integrates easily into their
environment - XQuery is best for manipulating data as XML
- XQuery simplifies merging relational and XML
- Increasingly difficult for developers to keep up
with peculiarities in proprietary XML tools
XQuery and XQJ are standards - Why DataDirect XQuery?
- Easily embeddable can live in middle tier with
the application - Follows standards closer than other
implementations - XQJ is like JDBC, and integrates easily into
their architecture - ltoXygen/gt XML Editor for Eclipse an IDE that
helps with learning curve of new language - First class support for help with queries and
tuning - DataDirects length of time in market and
financial stability
20?
?
?
Download DataDirect XQuery http//www.datadire
ct.com/downloads/registration/xquery/