Composing XSL Transformations with XML Publishing Views
description
Transcript of Composing XSL Transformations with XML Publishing Views
![Page 1: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/1.jpg)
Composing XSL Transformations with XML
Publishing ViewsChengkai Li University of Illinois at Urbana-
ChampaignPhilip Bohannon Lucent Technologies, Bell LabsHenry F. Korth Lehigh UniversityPPS Narayan Lucent Technologies, Bell Labs
SIGMOD 2003
![Page 2: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/2.jpg)
2
MotivationXML: 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?
![Page 3: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/3.jpg)
3
XML Publishing
SQL queryes
Relational DB
Query Logic
Tagger
XML data
Publisher
view query: specifies the mapping between relational tables and resulting XML document.
view query
![Page 4: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/4.jpg)
4
Example: tables and schema of view
HOTEL
hotelid name star metro_id1 Hyatt 2 NYC
2 Hilton 4 CHI
metroid nameNYC New York CityCHI Chicago
METROAREA
ROOM
hotel_id room # available1 101 F1 102 F2 1 T2 2 F
/
metro (name)
hotel (name, star)
room (#)total_room available
![Page 5: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/5.jpg)
5
Example: published XML document
/
metro (“Chicago”)metro (“New York City”)
room (2)total_room
availableroom (1)2
hotel (“Hilton”, 4)
room (102)total_room
room (101)2
hotel (“Hyatt”, 2)
![Page 6: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/6.jpg)
6
Example of View QueryRelational 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
<metro>
<hotel>
<total_room> <available><room>
/
![Page 7: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/7.jpg)
7
Evaluate XSLT queries on relational data?
publisher
XSLTstylesheet
view query
view
![Page 8: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/8.jpg)
8
Approach 1: Materialization
Approach 1
XML parsing relational engine for XML processing unnecessary materialization of nodes
1 XML data
publisher
XSLTstylesheet
view query
XSLT processor
materialized view
![Page 9: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/9.jpg)
9
Unnecessary Materializations
rule 1. metro [@name=“Chicago”] : output name
rule 2. hotel [@star>3]: no output
rule 3. total_room : output total number of rooms
nodes that do not satisfy type requirementnodes that do not satisfy selection conditionnodes not involved in output /
metro (“Chicago”)metro (“New York City”)
room (2)total_room
availableroom (1)2
hotel (“Hilton”, 4)
![Page 10: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/10.jpg)
10
Approach 2: View Composition
+new
view query
publisher
1 2XML data
publisher
XSLTstylesheet
view query
XSLT processor
XSLTstylesheet
view query
XML data
materialized view
Approach 1 Approach 2
XML parsing relational engine for XML processing unnecessary materialization of nodes
![Page 11: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/11.jpg)
11
Algorithm Overview
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?
/metro (“Chicago”)metro (“New York City”)
room (2)total_room
availableroom (1)2
hotel (“Hilton”, 4)
![Page 12: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/12.jpg)
12
Algorithm Overviewview
queryXSLT
stylesheet
new view query
+
Context Transition Graph(CTG)
Traverse View Query(TVQ)
Output Tag Tree(OTT)
What type of nodes are accessed?
What are the instances of these types of nodes?
How do we avoid materializing nodes uninvolved in output?
![Page 13: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/13.jpg)
13
Example of XSLT StylesheetR1:<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>
![Page 14: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/14.jpg)
14
Template Rule
<xsl:template match=“/”> <result_metro> <A/> <xsl:apply-templates select=“metro/hotel/total_room”/> </result_metro></xsl:template>
A stylesheet consists of a set of template rules.
R = <match_pattern(r), output(r), select_expression(r) >
match the rootgenerate output process total_room for all hotels of all metro areas
![Page 15: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/15.jpg)
15
Simplified RepresentationR1:match=“/”select=“metro/hotel/total_room”
R2:match=“total_room”select=“../available/../room”
R3:match=“metro/hotel/room”
![Page 16: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/16.jpg)
16
XSLT processingR1:match=“/”select=“metro/hotel/total_room”
R2:match=“total_room”select=“../available/../room”
R3:match=“metro/hotel/room”
<metro>
/
<metro>
<hotel> <hotel>
<room><total_room> <room><available>
(/, R1)
(total_room,R2)
(room,R3)
![Page 17: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/17.jpg)
17
Context Transition Graph (CTG)(/, R1)
(total_room,R2)
(room,R3)
Document instances of <total_room> may be matched by R2, which further selects document instances of <room>, which may be matched by R3.
MATCHQ: nodes SELECTQ: edges
CTG: Which type of nodes are accessed?
total_room: context node
room: new context node
![Page 18: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/18.jpg)
18
Instances of accessed nodes?(/, R1)
(total_room,R2)$t_new= …
(room,R3)$r_new=?
![Page 19: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/19.jpg)
19
Traverse View Query (TVQ)(/, R1)
(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)
TVQ: Instances of accessed nodes
![Page 20: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/20.jpg)
20
TVQ: Instances of accessed nodesR2: match=“total_room”select=“../available/../room”
R3:match=“metro/hotel/room”
<hotel>
<total_room><room>
<available>
<hotel>
<room>
<metro>
<hotel>
<total_room><room>
<available>
<metro>
Select-Match Tree
(/, R1)
(total_room,R2)$t_new= …
(room,R3)$r_new=?
![Page 21: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/21.jpg)
21
Select-Match Tree: How does context transition happen?
<hotel>
<total_room><room>
<available>
<metro>
Select-Match Tree
(/, R1)
(total_room,R2)$t_new= …
(room,R3)$r_new=?
![Page 22: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/22.jpg)
22
UNBIND: Select-Match Tree tag query
<hotel>
<total_room><room>
<available>
<metro>
Select-Match Tree
(/, R1)
(total_room,R2)$t_new= …
(room,R3)$r_new=?
![Page 23: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/23.jpg)
23
UNBIND: Select-Match Tree tag query
<hotel>
<total_room> <available>
<metro>
Select-Match Tree
(/, R1)
(total_room,R2)$t_new= …
(room,R3)$r_new=?
<room> $r =SELECT * FROM room WHERE hotel_id=$h.hotelid
![Page 24: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/24.jpg)
24
UNBIND: Select-Match Tree tag query
<hotel>
<total_room> <available>
<metro>
Select-Match Tree
(/, R1)
(total_room,R2)$t_new= …
(room,R3)$r_new=SELECT * FROM room WHERE hotel_id=$t_new.hotelid
<room> $r =SELECT * FROM room WHERE hotel_id=$h.hotelid
![Page 25: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/25.jpg)
25
UNBIND: Select-Match Tree tag query
<hotel>
<total_room>
<metro>
Select-Match Tree
(/, R1)
(total_room,R2)$t_new= …
(room,R3)$r_new=SELECT * FROM room WHERE hotel_id=$t_new.hotelid
<room><available>$a=SELECT * FROM room WHERE hotel_id=$h.hotelid AND available = TRUE
![Page 26: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/26.jpg)
26
UNBIND: Select-Match Tree tag query
<hotel>
<total_room>
<metro>
Select-Match Tree
(/, R1)
(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)
<room><available>$a=SELECT * FROM room WHERE hotel_id=$h.hotelid AND available = TRUE
![Page 27: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/27.jpg)
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)
lowest common ancestor
a=10
b<5
context node
new context node
![Page 28: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/28.jpg)
28
Output Tag Tree
(root, R1)
(total_room,R2)
(room,R3)
![Page 29: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/29.jpg)
29
Output Tag Tree (OTT)
R1:<xsl:template match=``/''> <result_metro> <A/> <xsl:apply-templates select=``…''/> </result_metro></xsl:template>
<result_metro>
<A>
apply-template
(root, R1)
(total_room,R2)
(room,R3)
![Page 30: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/30.jpg)
30
Output Tag Tree (OTT)
R2: <xsl:template match=``total_room''> <result_total> <B/> <xsl:apply-templates select=``...''/> </result_total></xsl:template>
<result_metro>
<A>
<result_total>
<B>
apply-template
(root, R1)
(total_room,R2)
(room,R3)
![Page 31: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/31.jpg)
31
Output Tag Tree (OTT)<result_metro>
<A>
<result_total>
<B>
<room>
R3: <xsl:template match=``metro/hotel/room''> <xsl:value-of select=''.''/> </xsl:template>
(root, R1)
(total_room,R2)
(room,R3)
![Page 32: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/32.jpg)
32
New View Query
<result_metro>
<A>
<result_total>
<B>
<room>
Forced Unbind during the generation of OTT
(root, R1)
(total_room,R2)
(room,R3)
![Page 33: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/33.jpg)
33
XSLT_basicno type coercionno document orderno “//”no functionno variable and parameterno recursionno predicate in expressionno flow-control elements
(<xsl:if>, <xsl:for-each>,<xsl:choose>)no conflicting rule resolutionselect of <xsl:value-of> is “.”
![Page 34: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/34.jpg)
34
Relaxing Assumptionsrecursion
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”
![Page 35: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/35.jpg)
35
SummaryProblem: Composing XSL Transformations with XML publishing views
Advantages compared with materialization approach
Algorithm Context Transition Graph Traverse View Query Output Tag Tree
Relaxing Assumptions
![Page 36: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/36.jpg)
36
Future Work//: CTG graph multigraph
recursion
![Page 37: Composing XSL Transformations with XML Publishing Views](https://reader036.fdocuments.in/reader036/viewer/2022062301/56815d2f550346895dcb2b7d/html5/thumbnails/37.jpg)
37
Related WorkTranslating XSLT into SQL queries: Jain et al, WWW 02
XML publishing middlewareSilkRoute: Fernandez et al, WWW 00, SIGMOD 01XPERANTO: Carey et al, WebDB 00 & Shanmugasundaram et al, VLDB 01
Incorporating XSL processing into database engines: Moerkotte, VLDB 02