Top Banner
1 XQuery Freeing XML and Relational Data for the Web
17

XQuery Freeing XML and Relational Data for the Web

Sep 13, 2014

Download

Documents

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: XQuery Freeing XML and Relational Data for the Web

1

XQueryFreeing XML and Relational Data for the Web

Page 2: XQuery Freeing XML and Relational Data for the Web

2

Overview• 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.datadirect.com/downloads/registration/xquery/

Page 3: XQuery Freeing XML and Relational Data for the Web

3

XML from Relational, XML

HOLDINGS  

USERID TICKER SHARES

Jonathan PRGS 23

Minollo PRGS 4000000

Jonathan AMZN 3000

Minollo AMZN 3000

HISTORICAL    

TICKER DATE ADJUSTEDCLOSE ACTUALCLOSE

AMZN 24-Jun-04 44.69 44.69

EBAY 24-Jun-04 85.33 85.33

PRGS 24-Jun-04 18.78 18.78

YHOO 1-Jul-04 32.48 32.48

<request> <performance> <userId>Jonathan</userId> <start>2003-01-01</start> <end>2004-06-01</end> </performance></request>

<portfolio userId="Jonathan"> <stock ticker="AMZN"> <performance> <min>18.86</min> <max>59.69</max> <daily> <day> <datetraded>2003-01-02</datetraded> <adjustedclose>22.61</adjustedclose> </day> <day> <datetraded>2003-01-09</datetraded> <adjustedclose>22.18</adjustedclose> </day> <day> <datetraded>2003-01-16</datetraded> <adjustedclose>21.93</adjustedclose> </day> <day> <datetraded>2003-01-23</datetraded> <adjustedclose>18.86</adjustedclose> </day> <day> <datetraded>2003-01-30</datetraded>

Page 4: XQuery Freeing XML and Relational Data for the Web

4

What 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?

Page 5: XQuery Freeing XML and Relational Data for the Web

8

Portfolio Demo: The Queries

Page 6: XQuery Freeing XML and Relational Data for the Web

9

Portfolio Demo: XQuery Summary• FLWOR expressions

• Like SQL’s 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

Page 7: XQuery Freeing XML and Relational Data for the Web

10

What 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

Page 8: XQuery Freeing XML and Relational Data for the Web

11

XQuery and XQJ

Application XQJ

XQuery

XML Result XML Input

XML View of RDB

Dat

a So

urce

s

Page 9: XQuery Freeing XML and Relational Data for the Web

12

XQJ: A Prepared Query// Get a connection, prepare the query

dataSource = new DDXQDataSource(); dataSource.setJdbcUrl(“jdbc:xquery:sqlserver://server1:1433;databaseName=stocks”); connection = dataSource.getConnection(); preparedExpression = connection.prepareExpression(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.getSequenceAsString());

// 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"); System.out.println(xqSequence.getSequenceAsString());

Page 10: XQuery Freeing XML and Relational Data for the Web

13

DataDirect 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

Page 11: XQuery Freeing XML and Relational Data for the Web

14

DataDirect 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:

• <oXygen/> XML Editor for Eclipse (DataDirect Edition)

• Inexpensive for DataDirect XQuery 1.0 licensees

• XML IDE• Stylus Studio XML

Enterprise Edition  • Purchased separately

User
Expand to multiple slides, consider moving to front
Page 12: XQuery Freeing XML and Relational Data for the Web

15

Scenario: XML Publishing

XML

XML

HTML,PDF,PostScript,Paper…SQL

Page 13: XQuery Freeing XML and Relational Data for the Web

16

Scenario: Web Publishing

App Server

HTTP

HTML

HTTP Request

Web Server

Application

XML

SQL

Page 14: XQuery Freeing XML and Relational Data for the Web

17

Scenario: Web Services

App Server

HTTP

SOAP Request

SOAP Server

Application

XML XML

SQL

Page 15: XQuery Freeing XML and Relational Data for the Web

18

Customer Story: Gevity

How much will it cost to outsource our HR to Gevity?

XQuery queries w/data from SalesForce.com

XML

Oracle 9i

Human Resource Data

PDF w/ pricing for prospect

• 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, prospect’s office, or any Wi-Fi hot spot

• Deliver through many agents – browser, cell phone, blackberry, etc

Page 16: XQuery Freeing XML and Relational Data for the Web

19

Customer Story: GevityWhy 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• <oXygen/> XML Editor for Eclipse – an IDE that helps with learning curve of

new language• First class support for help with queries and tuning• DataDirect’s length of time in market and financial stability

Page 17: XQuery Freeing XML and Relational Data for the Web

20

Download DataDirect XQuery: http://www.datadirect.com/downloads/registration/xquery/

? ??