1 / 37

Composing XSL Transformations with XML Publishing Views

Composing XSL Transformations with XML Publishing Views. Chengkai Li University of Illinois at Urbana-Champaign Philip Bohannon Lucent Technologies, Bell Labs Henry F. Korth Lehigh University PPS Narayan Lucent Technologies, Bell Labs. SIGMOD 2003. Motivation.

marlie
Download Presentation

Composing XSL Transformations with XML Publishing Views

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Composing XSL Transformations with XML Publishing Views Chengkai Li University of Illinois at Urbana-Champaign Philip Bohannon Lucent Technologies, Bell Labs Henry F. Korth Lehigh University PPS Narayan Lucent Technologies, Bell Labs SIGMOD 2003

  2. Motivation XML: popular for data representation and exchange • The data: stored in RDBMS • Vast majority of existing data stored in RDBMS • Efficiency, robustness of RDBMS for XML applications • XML Publishing Views (SilkRoute, XPERANTO) • The query: expressed as XSLT • Designed for document transformation • Popular as XML query language How to evaluate queries on relational data posed in XSLT?

  3. XML Publishing view query Query Logic SQL queryes Relational DB Tagger Publisher XML data view query: specifies the mapping between relational tables and resulting XML document.

  4. Example: tables and schema of view METROAREA HOTEL ROOM / metro (name) hotel (name, star) total_room room (#) available

  5. Example: published XML document / metro (“New York City”) metro (“Chicago”) hotel (“Hilton”, 4) hotel (“Hyatt”, 2) total_room total_room available room (1) room (2) room (101) room (102) 2 2

  6. Relational Schema Metroarea(metroid, metroname) Hotel(hotelid, hotelname, starrating, metro_id) Room(hotel_id, room#, available) Desired Hierarchical Structure of Published XML $m = SELECT metroid, metroname FROM metroarea $h =SELECT * FROM hotel WHERE metro_id = $m.metroid AND starrating > 4 Example of View Query / <metro> <hotel> <available> <room> <total_room>

  7. publisher Evaluate XSLT queries on relational data? view query view XSLT stylesheet

  8. publisher XSLT processor Approach 1: Materialization view query materialized view XSLT stylesheet 1 XML data

  9. Unnecessary Materializations nodes that do not satisfy type requirement nodes that do not satisfy selection condition nodes not involved in output / metro (“Chicago”) metro (“New York City”) hotel (“Hilton”, 4) total_room available room (1) room (2) 2 rule 1. metro [@name=“Chicago”] : output name rule 2. hotel [@star>3]: no output rule 3. total_room : output total number of rooms

  10. publisher publisher XSLT processor Approach 2: View Composition view query view query new view query + materialized view XSLT stylesheet XSLT stylesheet 2 1 XML data XML data

  11. Algorithm Overview / metro (“Chicago”) metro (“New York City”) hotel (“Hilton”, 4) total_room available room (1) room (2) 2 nodes that do not satisfy type requirements: What type of nodes are accessed? nodes that do not satisfy selection condition: What are the instances of these types of nodes? nodes not involved in output: How do we avoid materializing uninvolved nodes?

  12. Algorithm Overview XSLT stylesheet view query + Context Transition Graph (CTG) What type of nodes are accessed? Traverse View Query (TVQ) What are the instances of these types of nodes? Output Tag Tree (OTT) How do we avoid materializing nodes uninvolved in output? new view query

  13. R1: <xsl:template match=“/”> <result_metro> <A/> <xsl:apply-templates select=“metro/hotel/total_room”/> </result_metro> </xsl:template> R2: <xsl:template match=“total_room”> <result_total> <B/> <xsl:apply-templates select=“../available/../room”/> </result_total> </xsl:template> R3: <xsl:template match=“metro/hotel/room”> <xsl:value-of select=“.”/> </xsl:template> Example of XSLT Stylesheet

  14. <xsl:template match=“/”> <result_metro> <A/> <xsl:apply-templates select=“metro/hotel/total_room”/> </result_metro> </xsl:template> Template Rule A stylesheet consists of a set of template rules. select_expression(r) output(r), match_pattern(r), > R = < match the root generate output process total_room for all hotels of all metro areas

  15. R1: match=“/” select=“metro/hotel/total_room” R2: match=“total_room” select=“../available/../room” R3: match=“metro/hotel/room” Simplified Representation

  16. R1: match=“/” select=“metro/hotel/total_room” R2: match=“total_room” select=“../available/../room” R3: match=“metro/hotel/room” XSLT processing / (/, R1) <metro> <metro> (total_room,R2) <hotel> <hotel> (room,R3) <available> <total_room> <room> <room>

  17. Context Transition Graph (CTG) MATCHQ: nodes SELECTQ: edges (/, R1) total_room: context node room: new context node (total_room,R2) (room,R3) CTG: Which type of nodes are accessed? Document instances of <total_room> maybe matched by R2, which further selects document instances of <room>, which may be matched by R3.

  18. Instances of accessed nodes? (/, R1) (total_room,R2) $t_new= … (room,R3) $r_new=?

  19. Traverse View Query (TVQ) (/, R1) TVQ: Instances of accessed nodes (total_room,R2) $t_new= … (room,R3) $r_new =SELECT * FROM room WHERE hotel_id=$t_new.hotelid AND EXISTS (SELECT * FROM room WHERE hotel_id=$t_new.hotelid AND available = TRUE)

  20. <hotel> <total_room> <available> <room> <metro> <hotel> <available> <total_room> <room> Select-Match Tree <metro> <hotel> <room> TVQ: Instances of accessed nodes R2: match=“total_room” select=“../available/../room” (/, R1) (total_room,R2) $t_new= … (room,R3) $r_new=? R3:match=“metro/hotel/room”

  21. Select-Match Tree: How does context transition happen? (/, R1) Select-Match Tree <metro> (total_room,R2) $t_new= … <hotel> <available> <total_room> <room> (room,R3) $r_new=?

  22. UNBIND: Select-Match Tree  tag query (/, R1) Select-Match Tree <metro> (total_room,R2) $t_new= … <hotel> <available> <total_room> <room> (room,R3) $r_new=?

  23. UNBIND: Select-Match Tree  tag query (/, R1) Select-Match Tree <metro> (total_room,R2) $t_new= … <hotel> <available> <total_room> <room> $r =SELECT * FROM room WHERE hotel_id=$h.hotelid (room,R3) $r_new=?

  24. UNBIND: Select-Match Tree  tag query (/, R1) Select-Match Tree <metro> (total_room,R2) $t_new= … <hotel> <available> <total_room> <room> $r =SELECT * FROM room WHERE hotel_id=$h.hotelid (room,R3) $r_new=SELECT * FROM room WHERE hotel_id=$t_new.hotelid

  25. UNBIND: Select-Match Tree  tag query (/, R1) Select-Match Tree <metro> (total_room,R2) $t_new= … <hotel> <total_room> <available> $a=SELECT * FROM room WHERE hotel_id=$h.hotelid AND available = TRUE <room> (room,R3) $r_new=SELECT * FROM room WHERE hotel_id=$t_new.hotelid

  26. UNBIND: Select-Match Tree  tag query (/, R1) Select-Match Tree <metro> (total_room,R2) $t_new= … <hotel> <total_room> <available> $a=SELECT * FROM room WHERE hotel_id=$h.hotelid AND available = TRUE <room> (room,R3) $r_new =SELECT * FROM room WHERE hotel_id=$t_new.hotelid AND EXISTS (SELECT * FROM room WHERE hotel_id=$t_new.hotelid AND available = TRUE)

  27. UNBIND: General Cases General Select-Match Tree with Predicates • Unbind along the lowest common ancestor to the new context node (FROM) • Nest of all sub-trees not on the two paths (WHERE EXISTS) • Attribute access of all nodes (WHERE) b<5 lowest common ancestor context node a=10 new context node

  28. Output Tag Tree (root, R1) (total_room,R2) (room,R3)

  29. Output Tag Tree (OTT) (root, R1) <result_metro> <A> apply-template (total_room,R2) R1: <xsl:template match=``/''> <result_metro> <A/> <xsl:apply-templates select=``…''/> </result_metro> </xsl:template> (room,R3)

  30. Output Tag Tree (OTT) <result_metro> (root, R1) <A> <result_total> (total_room,R2) <B> apply-template R2: <xsl:template match=``total_room''> <result_total> <B/> <xsl:apply-templates select=``...''/> </result_total> </xsl:template> (room,R3)

  31. Output Tag Tree (OTT) <result_metro> (root, R1) <A> <result_total> (total_room,R2) <B> <room> (room,R3) R3: <xsl:template match=``metro/hotel/room''> <xsl:value-of select=''.''/> </xsl:template>

  32. New View Query (root, R1) <result_metro> <A> <result_total> (total_room,R2) <B> <room> (room,R3) Forced Unbind during the generation of OTT

  33. XSLT_basic • no type coercion • no document order • no “//” • no function • no variable and parameter • no recursion • no predicate in expression • no flow-control elements (<xsl:if>, <xsl:for-each>,<xsl:choose>) • no conflicting rule resolution • select of <xsl:value-of> is “.”

  34. Relaxing Assumptions • recursion • predicate in expression • flow-control elements (<xsl:if>, <xsl:for-each>,<xsl:choose>) • conflicting rule resolution • select of <xsl:value-of> be other than “.” and “@attribute”

  35. Problem: Composing XSL Transformations with XML publishing views Advantages compared with materialization approach Algorithm Context Transition Graph Traverse View Query Output Tag Tree Relaxing Assumptions Summary

  36. //: CTG graph multigraph recursion Future Work

  37. Related Work • Translating XSLT into SQL queries: Jain et al, WWW 02 • XML publishing middleware • SilkRoute: Fernandez et al, WWW 00, SIGMOD 01 • XPERANTO: Carey et al, WebDB 00 & Shanmugasundaram et al, VLDB 01 • Incorporating XSL processing into database engines: Moerkotte, VLDB 02

More Related