INNOV - PowerPoint PPT Presentation

About This Presentation
Title:

INNOV

Description:

INNOV 10: An Introduction to XQuery by Example Gus Bj rklund Wizard, Vice President Technology ... – PowerPoint PPT presentation

Number of Views:98
Avg rating:3.0/5.0
Slides: 35
Provided by: PSC95
Category:
Tags: innov | pure

less

Transcript and Presenter's Notes

Title: INNOV


1
INNOV10 An Introduction to XQuery by Example
Gus Björklund
Wizard, Vice President Technology
2
Topics
  • XQuery
  • The XQuery API for Java (XQJ)
  • DataDirect XQuery
  • Usage Scenarios
  • XML Publishing
  • Web Publishing
  • Web Services
  • Gevity Customer Story

3
Feel free to ask questionsas we go !
4
XML 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
HOLDINGS HOLDINGS  
USERID TICKER SHARES
Jonathan PRGS 23
Minollo PRGS 4000000
Jonathan AMZN 3000
Minollo AMZN 3000
HISTORICAL HISTORICAL HISTORICAL      
TICKER DATE DATE ADJUSTEDCLOSE ADJUSTEDCLOSE ACTUALCLOSE
AMZN AMZN 24-Jun-04 24-Jun-04 44.69 44.69
EBAY EBAY 24-Jun-04 24-Jun-04 85.33 85.33
PRGS PRGS 24-Jun-04 24-Jun-04 18.78 18.78
YHOO YHOO 1-Jul-04 1-Jul-04 32.48 32.48
5
Why XQuery?
XML is Everywhere
  • Much data is stored and queried (via SQL) in
    relational databases
  • On the Internet, most data is exchanged as XML
  • In most Internet applications, XML needs to be
    processed together with relational data
  • The same data can be combined in many, many
    different ways to create different documents
    data does not have just one native structure

6
Why XQuery
  • Easier
  • Programming for XML can be done with JDBC DOM
    Java, but is tedious. You write a lot of code.
  • Standard
  • Proprietary XML extensions from relational
    vendors work on only one database, and vary in
    quality
  • Powerful
  • SQL/XML and XQuery allow queries to create XML
  • XML documents and Databases
  • XQuery allows queries to span multiple sources,
    and can support XML views of relational data

7
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)

8
XQuery Native XML Programming
  • An XML-oriented language
  • XML is the only complex data type
  • No objects
  • No structs
  • Optimized for XML operations
  • Easily construct any XML structure
  • Easily locate any XML node
  • Easily restructure and compute from XML

9
Where Are The Standards?
  • XQuery is W3C Candidate Recommendation
  • Support from most major relational vendors
  • 45 implementations on W3C page
  • Recommendation 1H 2006? 3Q 2006?

10
XQuery 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

11
XQuery 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

12
XQuery 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

13
Functions
  • declare function localsummary(user)
  • for p in doc("portfolio.xml")/portfolio,
  • s in p/stock
  • where p/_at_UserId user
  • order by s/Shares
  • return
  • ltsummarygt
  • s/StockTicker,
  • s/Shares
  • lt/summarygt
  • localsummary("Jonathan")

14
Topics
  • XQuery
  • The XQuery API for Java (XQJ)
  • DataDirect XQuery
  • Usage Scenarios
  • XML Publishing
  • Web Publishing
  • Web Services
  • Gevity Customer Story

15
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

16
XQJ API
17
XQJ 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")

18
Topics
  • XQuery
  • The XQuery API for Java (XQJ)
  • DataDirect XQuery
  • Usage Scenarios
  • XML Publishing
  • Web Publishing
  • Web Services
  • Gevity Customer Story

19
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 many databases and application servers

20
DataDirect XQuery
  • Designed from the start for high performance
  • 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)

21
DatatDirect XQuery
  • 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

22
DataDirect XQuery
  • 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

23
DataDirect XQuery
  • 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

24
Topics
  • XQuery
  • The XQuery API for Java (XQJ)
  • DataDirect XQuery
  • Usage Scenarios
  • XML Publishing
  • Web Publishing
  • Web Services
  • Gevity Customer Story

25
Scenario XML Publishing
HTML, PDF, PostScript, Paper
SQL
XML
XML
26
Scenario Web Publishing
HTTP Request
Web Server
HTTP
HTML
XML
App Server
Application
SQL
27
Scenario Web Services
SOAP Request
SOAP Server
HTTP
XML
XML
App Server
Application
SQL
28
Topics
  • XQuery
  • The XQuery API for Java (XQJ)
  • DataDirect XQuery
  • Usage Scenarios
  • XML Publishing
  • Web Publishing
  • Web Services
  • Gevity Customer Story

29
Customer 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
30
Customer 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

31
Customer Story Gevity
  • 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

32
Download DataDirect XQuery 1.0
http//www.datadirect.com/downloads /registration
/xquery/(all on one line)
33
Questions andAnswers
?
34
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com