Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
SilkRoute: A Framework for Publishing Relational Data in XML Mary Fernández, AT&T Labs - Research Dan Suciu, Univ. of Washington Yada Kadiyska, Univ. of Washington Atsuyuki Morishima, Univ. of Tsukuba Wang-Chiew Tan, Univ. of Pennsylvania XML-Relational Middleware XML: Standard, flexible syntax for exchanging data Industry defines common XML vocabulary Lingua franca of B2B Applications Document Type Descriptions (DTDs) or XML Schema Contract between data producers & consumers Reflects application domain XML-Relational Middleware Key business data in RDBMS Glue between existing business data & application Characteristics: General, dynamic, efficient SilkRoute : A Reference Framework 2 XML Data Management XML Producer XML Consumer XML Documents & Schemas Legacy Database Publish XML API or Query XML XML Interfaces XML XML Store XML Persistent Database 3 Clothing Supplier & Reseller Shared XML Schema element supplier { element company, element product* } element company { xs:string } element product { element name, element category, element retail, element sale?, element reports* } element name { xs:string } element category { xs:string } element retail { attribute cur { xs:string }, xs:float } element sale { xs:float } <supplier> <company>ACME Clothing</company> <product> <name>Suede jacket</name> <category>outerwear</category> <retail cur=“USD”>325.00</retail> <sale cur=“USD”>225.00</sale> </product> <product> <name>Rain boots</name> <category>outerwear</category> <retail cur=“USD”>45.00</retail> <sale cur=“USD”>22.50</sale> <report code=“defective” >leaks in heel</sale> <report code=“defective”>heel separates</sale> </product> </supplier> 4 Viewing and Querying XML Most data in relational database Suppliers’ goal: Define XML view of data General: support many XML Schemas Efficient: leverage relational database Application Query ? Application Public Query = ( ? ? ) Supplier Database 5 Viewing and Querying XML Brokers’ goal: Uniform access Dynamic: Access up-to-date, minimal result ? Application = ? ° ? = ? ( Supplier database ? = ) ? ( ) 6 SilkRoute Framework General, declarative view-definition language Public Query in XQuery Maps relational data to public XML view + Support many output XML Schemas Dynamic querying of XML views Application Query in XQuery Maps public XML data to application’s view Query composition algorithm + Underlying storage should be transparent to user + Access up-to-date, minimal result Efficient use of relational engine Query decomposition algorithm Selects query execution plan (one or more SQL queries) Uses relational engine’s cost estimates to guide search + Leverage power of relational query engine 7 Canonical XML View Clothing(pid, item, category, description, price, cost) : { <001, “Suede Jacket”, “outerwear”,”Hip length”, 325.00, 175.00>, <002, “Rain boots”, “outerwear”, “Ankle height”, 45.00, 19.99> } Discount(pid, discount) : { <001, 0.70>, <002, 0.50> } <Clothing> <Tuple> <pid>001</pid> <item>Suede jacket</item> <category>outerwear</category> <description>Hip length</description> <price>325.00</price> <cost>175.00</cost> </Tuple> <Tuple> <pid>002</pid> <item>Rain boots</item> <category>outerwear</category> <description>Ankle height</description> <price>45.00</price> <cost>19.99</cost> </Tuple> </Clothing> Oracle 9i XSQL Canonical XML View Use XSLT (out of engine) to transform canonical XML 8 Canonical & Public Views <supplier> <Clothing> <company>ACME Clothing</company> <Tuple> <product> <pid>001</pid> <name>Suede jacket</name> <item>Suede jacket</item> <category>outerwear</category> <category>outerwear</category> <retail cur=“USD”>325.00</retail> <description>Hip length</description> <sale cur=“USD”>225.00</sale> <price>325.00</price> </product> <cost>175.00</cost> <product> </Tuple> <name>Rain boots</name> <Tuple> <category>outerwear</category> <pid>002</pid> <retail cur=“USD”>45.00</retail> <item>Rain boots</item> <sale cur=“USD”>22.50</sale> <category>outerwear</category> <description>Ankle height</description> <report code=“defective” >leaks in heel</sale> <report code=“defective”>heel separates</sale> <price>45.00</price> </product> <cost>19.99</cost> </supplier> </Tuple> </Clothing> 9 XQuery Strongly typed, functional XML query language Compositional: XML to XML Large-scale database access Must guarantee safety/correctness of operations on data Q1(Q2(D)) = (Q1 o Q2)(D) XQuery 1.0 = XPath 2.0 (path, arithmetic, logical expressions) + for-let-where-orderby-return (FLWOR) XML construction + User-defined (recursive) functions + Strong typing 10 Public View Query ? Public view query expressed in XQuery Includes all XQuery expressions Except recursive functions, features that depend on document order <supplier><company>ACME Clothing</company> { for $c in $CanonicalView/Clothing/Tuple where $c/category = “outerwear” return <product> <name>{ data($c/item) }</name> <category>{ data($c/category) }</category> <retail cur=“USD”>{ data($c/price) }</retail> { for $d in $CanonicalView/Discount/Tuple where $d/pid = $c/pid return <sale cur=“USD”>{ $d/discount * $c/price } </sale> } </product> } </supplier> Type checking guarantees view conforms to public schema 11 Application Query ? Application query expressed in XQuery for $s in $PublicView/supplier return <supplier> <name>{ data($s/name) } </name> <discounted> { for $p in $s/product where $p/sale < 0.5 * $p/retail return <product>{ data($p/name) }</product> } </discounted> </supplier> Type checking guarantees application query correct w.r.t. public schema 12 SilkRoute Architecture Internet/Intranet SilkRoute Relational Engine XML Generator Application View Forest Composer ? View Forest Decomposer ? ? ? ? ? All modules process view forests Representation of all views: canonical, public, application Maps relational data to XML document 13 Query Decomposition ? ? for $c in $CanonicalView/Clothing/Tuple where $c/category = “outerwear” return <product> <name>{ data($c/item) }</name> <category>{ data($c/category) }</> <retail>{ data($c/price) }</retail> </product> <product> <name>item</name> <category>category</category> <retail>price</retail> </product> SELECT $c.pid as pid, $c.item as item, $c.category as category, $c.price as price FROM Clothing $c WHERE $c.category = “outerwear” View query may decompose into multiple SQL queries Use greedy algorithm (with help from RDBMS) to choose decomposition 14 Related Systems Commercial Systems Oracle 9i – canonical mapping IBM DB2 XML Extender – annotated schema Microsoft SQL Server – universal relation, annotated schema (To date), none support full XQuery SQL Server supports XPath (Quasi) Research Systems Xperanto (IBM Almaden) – now a product Rolex, PRATA (Bell Labs) 15 Summary XML Publishing Systems Workhorses of B2B applications Key characteristics: General, dynamic, efficient Commercial Systems Oracle, IBM DB2, Microsoft SQL Server Some, but not all, of key characteristics SilkRoute : A Reference Framework General, declarative mappings from relations to XML Query composition & decomposition Establishes link between XQuery & SQL Prototype (re-)implementation (JDBC-compliant database) 16