pandrangi

Uploaded from authorPOINTLite
Views:
 
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Practical Applications of XQuery: 

Practical Applications of XQuery Srinivas Pandrangi, Ipedo Inc. XML Conference, 2003 Philadelphia

Topics: 

Topics An extremely brief Introduction to XQuery Querying XML Data Sources XQuery for Data Integration XQuery for Application Integration Q & A

XQuery – An XML Query Language: 

XQuery – An XML Query Language Each executable query module has 2 parts Prolog Query Body Prolog sets the context in which the query executes Includes variable decls, namespace decls etc. Query Body is composed of one or more expressions XQuery is a language for querying XML (?) data sources. Most parts of the specification are in last call. Specs are available at http://www.w3.org/XML/Query#specs A Short Introduction to XQuery

XQuery Expressions: 

XQuery Expressions XQuery expressions are composed from keywords, symbols and other expressions. e.g.: for $order in document(“orders.xml”)/Orders/Order where $order/orderDate lt “2003-10-12” return $order Keywords Expressions

XQuery Expressions – Contd.: 

XQuery Expressions – Contd. Some common types of XQuery Expressions: Path Expressions (To identify portions of interest in XML trees) Conditional Expressions (If…then…else…) FLWOR Expressions Arithmetic Expressions (+, -, div….) Comparison Expressions (<. >, lt, gt ….) Node Constructors (Elements, Attributes, PIs, Comments…)

XQuery Applications: 

XQuery Applications The three broad application areas covered in this talk: Querying XML Data Sources Case Study: Digital Content Marketplace XQuery for Data Integration Case Study: Executive Dashboard XQuery for Application Integration Case Study: Web Services Integration

Querying XML Data Sources: 

Querying XML Data Sources Need: A Query language for XML data stores. Common reasons for building XML stores: Application inputs and/or outputs are in XML Standardization with XML vocabularies Extensibility and flexibility in data modeling XML content management. Take advantage of more granular CM, single source, multiple presentations etc. Ability to integrate XML content with other data sources. Solution: XQuery is the best option for querying XML data sources today.

Case Study 1: Fidelity National Finance Data Aggregation and Delivery: 

Case Study 1: Fidelity National Finance Data Aggregation and Delivery Loan Origination Systems Loan Document Repository XQuery based document delivery interface Ad Hoc Query SLAs XML Representations of Loan Documents XML Loan Docs

Case Study 1: Fidelity National Finance-contd. Data Aggregation and Delivery: 

Case Study 1: Fidelity National Finance-contd. Data Aggregation and Delivery for $policy in collection("PolicyDocuments")/Policy where $policy/loan_number = $LOAN_NUMBER return <Response> <DocumentInfo Type=“Policy" RefNumber="{ $policy/docID }" /> <Title PolicyNumber="'{$policy/Policy_Info/Policy_Number}'" PolicyEffectiveDate="'{$policy/Policy_Info/Effective_Date}'" /> <LoanInfo LenderLoanNumber="'{$policy/Policy_Info/Loan_Number}'"/> ……………………… ………………………. </Response> An example of an applicable query:

Case Study 2: Navio Inc. P2P Marketplace: 

Case Study 2: Navio Inc. P2P Marketplace Navio is a P2P marketplace for trading any asset of value (ring tones, images, games, loyalty points, bets …..). All data is modeled in XML (Titles, Offers, Rights, Promotions etc.) and stored in an XML repository. XQuery is the language of choice for querying/manipulating* this content. *XQuery1,0 does not include an Update Language. Some vendors provide their own update extensions.

XQuery for Data Integration: 

XQuery for Data Integration Need: Most enterprises have a mix of data sources. A data integration solution will provide a uniform way to access these heterogeneous data sources Solution: XQuery implementations can allow querying multiple XML/non-XML data sources.

What the Query sees: 

What the Query sees Query Processor DM Insts Inputs Outputs DM Insts Schema Query expressions operate on data model instances

Inputs to a Query: 

Inputs to a Query Typical ways of providing inputs to a Query: fn:doc() fn:collection() Binding values to external variables Implementation defined methods

Generating Data Model Instances: 

Generating Data Model Instances Query Processor DM Insts Outputs XML Documents Relational Databases Web Services CSV Files, Binary Files etc. DM Instances Schema

Case Study 3: Hewlett Packard Executive Dashboard: 

Case Study 3: Hewlett Packard Executive Dashboard Repository ----------- XQuery Engine Financial System 2 OLAP Reports Archive Financial System 1 Epicentric FS1 Text FS 2 Text OLAP Data RA Snippet FS1 Data XSL Updates Blended Content Customized View Executive Dashboard

An Example Scenario: 

An Example Scenario X Q U E R Y D/I Dashboard Application Existing Financial Apps

An Example Scenario- contd.: 

An Example Scenario- contd. <sales> { for $product in document("products.xml")/products/product, $sales in view(“hp/sales_view")/sales/product where $product/productId = $sales/productId return <product id="{$product/productId}“> {$product/productName, $product/productSpec, $sales/mrq, $sales/ytd, $sales/margin} </product> } </sales> Original Sales Query:

An Example Scenario- contd.: 

An Example Scenario- contd. <sales> { for $product in document("products.xml")/products/product, $sales in (view(“hp/sales_view")/sales/product, view(“acquisition1/sales_view")/sales/product) where $product/productId = $sales/productId return <product id="{$product/productId}“> {$product/productName, $product/productSpec, $sales/mrq, $sales/ytd, $sales/margin} </product> } </sales> Sales Query Including New Acquisition:

XQuery in Application Integration: 

XQuery in Application Integration Need: Application A needs to talk to Application B which only talks language L. Application A and Application B have web services interfaces exposing app data. You need a universal view of this data at a higher level. Solution: XQuery has transformation capabilities (search source document and build a result document structure of choice from it), and also the ability to aggregate data.

Case Study 4: A car rental company Composing Rental Agreements: 

Case Study 4: A car rental company Composing Rental Agreements Cust:… Name:… Address Renter:.. Pick-Up:.. Return:… Rental App Customer Information Management System Customer Records Virtual Document Built using XQuery Views Style Engine Rental Agreement Docs Web Services for Location based services Cust:… Name:… Address

Case Study 5: Financial News Portal Search News Stories and Aggregate Related Information: 

Case Study 5: Financial News Portal Search News Stories and Aggregate Related Information Use cases: Investors/Analysts searching News archives for stories on portfolio companies. News portal style functionality of getting additional information about companies mentioned these articles. Statistical analysis of news articles (e.g. partner companies most often mentioned in articles about your portfolio company, correlation of stock prices to news traffic etc.) These use cases combine search engine style query capabilities (full-text, fuzzy etc) with data aggregation, transformation and composition capabilities.

Case Study 5: Financial News Portal Search News Stories and Aggregate Related Information –contd. : 

Case Study 5: Financial News Portal Search News Stories and Aggregate Related Information –contd. for $news in collection("test/NewsML")//NewsItem/NewsComponent where contains($news/NewsLines/HeadLine, "IBM") return <news> <headline>{$news/NewsLines/HeadLine/text()}</headline> <company_list> { for $company in $news//companyinfo let $symbol := $company/@ticker_symbol, $price := data(view("publicWS/getQuote", $symbol)/Result), $searchResults := view("publicWS/google", "zylC//pQ", $symbol, …) return <company symbol="{$symbol}" price="{$price}"> <google_search_results> {$searchResults}</google_search_results> </company> } </company_list> <story>{$news//body.content/*}</story> </news>

Conclusions: 

Conclusions XQuery’s most obvious application is to query XML data sources. It will be supported by most major XML database/content management system vendors. Ability of XQuery implementations to allow querying of Non-XML data sources will lead to its use as a Data Integration tool. The XML transformation capabilities of XQuery can allow it to be used for Application Integration. Q&A spandran@ipedo.com