Скачать презентацию Composing XSL Transformations with XML Publishing Views Chengkai Скачать презентацию Composing XSL Transformations with XML Publishing Views Chengkai

0bd383d37e2e598d83cbd1fbc7250223.ppt

  • Количество слайдов: 37

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

Motivation XML: popular for data representation and exchange <The data: stored in RDBMS § Motivation XML: popular for data representation and exchange

XML Publishing view query Query Logic SQL queryes Relational DB Tagger Publisher XML data 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. 3

Example: tables and schema of view METROAREA HOTEL metroid name hotelid name star metro_id Example: tables and schema of view METROAREA HOTEL metroid name hotelid name star metro_id NYC New York City 1 Hyatt 2 NYC CHI Chicago 2 Hilton 4 CHI ROOM hotel_id room # available 1 101 F 1 102 F 2 1 T 2 2 F / metro (name) hotel (name, star) total_room 4 room (#) available

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

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

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

Approach 1: Materialization view query publisher materialized view XSLT stylesheet XSLT processor 1 XML Approach 1: Materialization view query publisher materialized view XSLT stylesheet XSLT processor 1 XML data Approach 1 XML parsing relational engine for XML processing unnecessary materialization of nodes 8

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

Approach 2: View Composition view query publisher view query + materialized view XSLT new Approach 2: View Composition view query publisher view query + materialized view XSLT new view query XSLT stylesheet publisher XSLT processor 1 2 XML data Approach 1 Approach 2 XML parsing relational engine for XML processing unnecessary materialization of nodes 10

Algorithm Overview / metro (“New York City”) metro (“Chicago”) hotel (“Hilton”, 4) total_room 2 Algorithm Overview / metro (“New York City”) metro (“Chicago”) hotel (“Hilton”, 4) total_room 2 room (1) room (2) available 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? 11

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

Example of XSLT Stylesheet R 1: <xsl: template match=“/”> <result_metro> <A/> <xsl: apply-templates select=“metro/hotel/total_room”/> Example of XSLT Stylesheet R 1: R 2: R 3: 13

Simplified Representation R 1: match=“/” select=“metro/hotel/total_room” R 2: match=“total_room” select=“. . /available/. . /room” Simplified Representation R 1: match=“/” select=“metro/hotel/total_room” R 2: match=“total_room” select=“. . /available/. . /room” R 3: match=“metro/hotel/room” 15

XSLT processing R 1: match=“/” select=“metro/hotel/total_room” R 2: match=“total_room” select=“. . /available/. . /room” XSLT processing R 1: match=“/” select=“metro/hotel/total_room” R 2: match=“total_room” select=“. . /available/. . /room” R 3: match=“metro/hotel/room” (/, R 1) (total_room, R 2) / (room, R 3) 16

Context Transition Graph (CTG) (/, R 1) (total_room, R 2) MATCHQ: nodes SELECTQ: edges Context Transition Graph (CTG) (/, R 1) (total_room, R 2) MATCHQ: nodes SELECTQ: edges total_room: context node room: new context node (room, R 3) CTG: Which type of nodes are accessed? Document instances of may be matched by R 2, which further selects document instances of , which may be matched by R 3. 17

Instances of accessed nodes? (/, R 1) (total_room, R 2) $t_new= … (room, R Instances of accessed nodes? (/, R 1) (total_room, R 2) $t_new= … (room, R 3) $r_new=? 18

Traverse View Query (TVQ) (/, R 1) TVQ: Instances of accessed nodes (total_room, R Traverse View Query (TVQ) (/, R 1) TVQ: Instances of accessed nodes (total_room, R 2) $t_new= … (room, R 3) $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) 19

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

Select-Match Tree: How does context transition happen? (/, R 1) Select-Match Tree <metro> (total_room, Select-Match Tree: How does context transition happen? (/, R 1) Select-Match Tree (total_room, R 2) $t_new= … (room, R 3) $r_new=? 21

UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree <metro> (total_room, R 2) UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree (total_room, R 2) $t_new= … (room, R 3) $r_new=? 22

UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree <metro> (total_room, R 2) UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree (total_room, R 2) $t_new= … (room, R 3) $r_new=? 23 $r =SELECT * FROM room WHERE hotel_id=$h. hotelid

UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree <metro> (total_room, R 2) UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree (total_room, R 2) $t_new= … (room, R 3) $r_new=SELECT * FROM room $r =SELECT * FROM room WHERE hotel_id=$h. hotelid WHERE hotel_id=$t_new. hotelid 24

UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree <metro> (total_room, R 2) UNBIND: Select-Match Tree tag query (/, R 1) Select-Match Tree (total_room, R 2) $t_new= … (room, R 3) $r_new=SELECT * FROM room WHERE hotel_id=$t_new. hotelid 25 $a=SELECT * FROM room WHERE hotel_id=$h. hotelid AND available = TRUE

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

UNBIND: General Cases General Select-Match Tree with Predicates <Unbind along the lowest common ancestor UNBIND: General Cases General Select-Match Tree with Predicates

Output Tag Tree (root, R 1) (total_room, R 2) (room, R 3) 28 Output Tag Tree (root, R 1) (total_room, R 2) (room, R 3) 28

XSLT_basic <no type coercion <no document order <no “//” <no function <no variable and XSLT_basic , , ) is “. ” 33

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

Summary <Problem: Composing XSL Transformations with XML publishing views <Advantages compared with materialization approach Summary

Future Work <//: CTG graph multigraph <recursion 36 Future Work

Related Work <Translating XSLT into SQL queries: Jain et al, WWW 02 <XML publishing Related Work