XQuery Freeing XML and Relational Data for the Web
Upcoming SlideShare
Loading in...5
×
 

XQuery Freeing XML and Relational Data for the Web

on

  • 691 views

 

Statistics

Views

Total Views
691
Views on SlideShare
691
Embed Views
0

Actions

Likes
1
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Welcome audience and introduce yourself One of the editors of XQuery Program Manager for DataDirect XQuery This is a really helpful tool that makes processing XML much simpler, and I’m excited to be able to share this with you. Now that we’re on the market, I’m not just doing theoretical stuff, I’m working with enthusiastic customers, and….
  • Here’s the basic problem you are trying to solve: You have data in a relational database or in XML You need to create some kind of “report”, “web message”, or data for a web page Note that this is a lot like relational report writing – but it is XML now, much more richly structured. Could use Java APIs for this, but you write lots of code, very tedious - XQuery solves easily
  • You can think of this two ways. The Java way to think of this is a nested loop, iterating over portfolio elements and the stocks they contain. The SQL way to think of this is as a join. For binds variables – each time the other clauses are evaluated, $p is bound to a portfolio, $s is bound to a stock.
  • Motivation: Creating one result from many sources, many input formats Transformations may be needed sometimes radical restructuring Computing results Etc. Easy transformation to multiple formats The missing piece: creating the XML in the middle
  • “If you have a web page, and it has data, you’re probably doing something like this” XML can hold the complex structures shown on web pages XML can be transmitted easily among diverse applications XML promotes loose coupling
  • “If you’re doing e-business, you’re probably doing something like this” First change: We took away the friendly woman “ You’ve been replaced with a computer” Second change: XML is everywhere The SOAP request is XML XML is sent to our “virtual user” Note “REST” is simpler, much of the same benefit May want to mention Amazon
  • Business problem: The pricing engine lets salespeople compute estimates for moving a prospect’s HR to Gevity. Salesforce.com contains all client information. Oracle 9i contains Human Resource Data, including tax rates per state, etc. Sales person is in salesforce.com, selects a button “pricing engine”, clicks on it, and the pricing engine application comes up. It pulls some data from Salesforce.com, and asks for other data to be entered manually. Why use XML? He needed a datasource-independent format that could be rendered to any device. Why XQuery? Because it can get XML from anywhere, and it is the fastest development environment for them – and also much more efficient than their old way. Highlight: What application does Why he needed XML Why he needed XQuery
  • Problems with Oracle 10gR2: Not ready to update their database Only supported XQuery spec 60-70% Couldn’t handle large queries Didn’t like it w/database, problems when database patches loaded Some long reports hung database Load balancing easier in middle tier No separate IDE – they already had Eclipse and , so this fit easily into their environment. XQuery: Develop faster, no transformation code Faster processing time
  • Welcome audience and introduce yourself Short, simple intro that our business is about connecting software to the data it needs..

XQuery Freeing XML and Relational Data for the Web XQuery Freeing XML and Relational Data for the Web Presentation Transcript

  • XQuery Freeing XML and Relational Data for the Web
  • 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 /
  • XML from Relational, XML <request> <performance> <userId>Jonathan</userId> <start>2003-01-01</start> <end>2004-06-01</end> </performance> </request> <portfolio userId=&quot;Jonathan&quot;> <stock ticker=&quot;AMZN&quot;> <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> 3000 AMZN Minollo 3000 AMZN Jonathan 4000000 PRGS Minollo 23 PRGS Jonathan SHARES TICKER USERID   HOLDINGS 32.48 32.48 1-Jul-04 YHOO 18.78 18.78 24-Jun-04 PRGS 85.33 85.33 24-Jun-04 EBAY 44.69 44.69 24-Jun-04 AMZN ACTUALCLOSE ADJUSTEDCLOSE DATE TICKER     HISTORICAL
  • 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?
  • XQuery: FLWOR Expressions
    • for $p in doc(&quot;portfolio.xml&quot;)/portfolio,
    • $s in $p/stock
    • where $p/@userId = &quot;Jonathan&quot;
    • order by $s/shares
    • return
    • <summary>
    • {
    • $s/stockTicker,
    • $s/shares
    • }
    • </summary >
  • XQuery: Path Expressions
    • for $p in doc(&quot;portfolio.xml&quot;)/portfolio,
    • $s in $p/stock
    • where $p/@userId = &quot;Jonathan&quot;
    • order by $s/shares
    • return
    • <summary>
    • {
    • $s/stockTicker,
    • $s/shares
    • }
    • </summary >
  • XQuery: XML Constructors
    • for $p in doc(&quot;portfolio.xml&quot;)/portfolio,
    • $s in $p/stock
    • where $p/@userId = &quot;Jonathan&quot;
    • order by $s/shares
    • return
    • <summary>
    • {
    • $s/stockTicker,
    • $s/shares
    • }
    • </summary >
  • Portfolio Demo: The Queries
  • 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
  • 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
  • XQuery and XQJ Application XQJ XQuery XML Result XML Input XML View of RDB Data Sources
  • 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(&quot;p&quot;), &quot;Jonathan&quot;);
    • xqSequence = preparedExpression.executeQuery();
    • System.out.println(&quot; Holdings for Jonathan: &quot;);
    • System.out.println(xqSequence.getSequenceAsString());
    • // Bind variable $l to 'Minollo' and execute
    • preparedExpression.bindString(new QName(&quot;p&quot;), &quot;Minollo&quot;);
    • xqSequence = preparedExpression.executeQuery();
    • System.out.println(&quot; Holdings for Minollo: &quot;);
    • System.out.println(xqSequence.getSequenceAsString());
  • 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
  • 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
  • Scenario: XML Publishing XML XML HTML, PDF, PostScript, Paper… SQL
  • Scenario: Web Publishing App Server HTTP HTML HTTP Request Web Server Application XML SQL
  • Scenario: Web Services App Server HTTP SOAP Request SOAP Server Application XML XML SQL
  • Customer Story: Gevity How much will it cost to outsource our HR to Gevity? XQuery queries w/data from SalesForce.com
    • 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
    XML Oracle 9i Human Resource Data PDF w/ pricing for prospect
  • 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
    • 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
  • Download DataDirect XQuery: http://www.datadirect.com/downloads/registration/xquery / ? ? ?