Structured Materialized Views for XML Queries Andrei Arion 1 , 2 - - PowerPoint PPT Presentation

structured materialized views for xml queries
SMART_READER_LITE
LIVE PREVIEW

Structured Materialized Views for XML Queries Andrei Arion 1 , 2 - - PowerPoint PPT Presentation

Structured Materialized Views for XML Queries Andrei Arion 1 , 2 eronique Benzaken 2 V Ioana Manolescu 1 Yannis Papakonstantinou 3 1 GEMO Project, INRIA Futurs firstname.lastname@inria.fr 2 Laboratoire de Recherche en Informatique, University


slide-1
SLIDE 1

Structured Materialized Views for XML Queries

Andrei Arion1,2 V´ eronique Benzaken2 Ioana Manolescu1 Yannis Papakonstantinou3

1GEMO Project, INRIA Futurs

firstname.lastname@inria.fr

2Laboratoire de Recherche en Informatique, University Paris XI

firstname.lastname@lri.fr

3University of California San Diego, USA

firstname@cs.ucsd.edu

VLDB 2007, September 25th, 2007

1 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-2
SLIDE 2

Outline

1

Context: rewriting XQuery using nested views

2

Pattern containment under summary constraints Path summary Summary based containment

3

Summary based query rewriting

4

Experimental results

5

Conclusions

2 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-3
SLIDE 3

Context: rewriting XQuery using nested views

Outline

1

Context: rewriting XQuery using nested views

2

Pattern containment under summary constraints Path summary Summary based containment

3

Summary based query rewriting

4

Experimental results

5

Conclusions

3 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-4
SLIDE 4

Context: rewriting XQuery using nested views

Context: rewriting XQuery using nested views

  • !
  • !

4 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-5
SLIDE 5

Context: rewriting XQuery using nested views

Context: rewriting XQuery using nested views

  • !
  • !

5 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-6
SLIDE 6

Context: rewriting XQuery using nested views

Context: rewriting XQuery using nested views

  • !
  • !

6 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-7
SLIDE 7

Context: rewriting XQuery using nested views

Context: rewriting XQuery using nested views

  • !
  • !

7 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-8
SLIDE 8

Context: rewriting XQuery using nested views

Context: rewriting XQuery using nested views

  • !
  • !

8 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-9
SLIDE 9

Context: rewriting XQuery using nested views

Context: rewriting XQuery using nested views

  • !
  • !
  • 9

Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-10
SLIDE 10

Context: rewriting XQuery using nested views

Related works

XPath containment and equivalence No constraints:

  • S. Amer-Yahia 2001, Deutsch and Tannen, 2001; Miklau

and Suciu, 2002

DTD constraints:

Wood 2003 ,Neven and Schwentick 2003

XPath rewriting Balmin et al, 2004, weak path usage Wanhong Xu et al 2005 Lakshmanan et al, 2006, MCR under path summary constraints XQuery containment and rewriting Halevy et al. 2004 Onose et al. 2006, equivalent rewriting We address XAM containment and rewriting under path summaries constraints.

10 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-11
SLIDE 11

Context: rewriting XQuery using nested views

Related works

XPath containment and equivalence No constraints:

  • S. Amer-Yahia 2001, Deutsch and Tannen, 2001; Miklau

and Suciu, 2002

DTD constraints:

Wood 2003 ,Neven and Schwentick 2003

XPath rewriting Balmin et al, 2004, weak path usage Wanhong Xu et al 2005 Lakshmanan et al, 2006, MCR under path summary constraints XQuery containment and rewriting Halevy et al. 2004 Onose et al. 2006, equivalent rewriting We address XAM containment and rewriting under path summaries constraints.

10 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-12
SLIDE 12

Context: rewriting XQuery using nested views

Materialized views for XML: Query

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Use an XQuery view that materialize the whole query. Problems:

The complexity of the XQuery language Difficult to understand and combine multiple XQuery views

11 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-13
SLIDE 13

Context: rewriting XQuery using nested views

Materialized views for XML: Query

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Use an XQuery view that materialize the whole query. Problems:

The complexity of the XQuery language Difficult to understand and combine multiple XQuery views

11 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-14
SLIDE 14

Context: rewriting XQuery using nested views

Materialized views for XML: Query

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Use an XQuery view that materialize the whole query. Problems:

The complexity of the XQuery language Difficult to understand and combine multiple XQuery views

11 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-15
SLIDE 15

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-16
SLIDE 16

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-17
SLIDE 17

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-18
SLIDE 18

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-19
SLIDE 19

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-20
SLIDE 20

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-21
SLIDE 21

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-22
SLIDE 22

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-23
SLIDE 23

Context: rewriting XQuery using nested views

Materialized views for XML: XPath

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XPath: V=//item

Q=E1(V) Problems: V is big, E1 is complex

XPath: V1=//item/name, V2=//item//keyword

Q = E2(V1, V2) XQuery semantics: output an empty res element even if no name, keyword! Problem: How to combine V1 and V2? Add some IDs!

12 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-24
SLIDE 24

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store IDs in the view V1=//item ID, V2=//name ID, V3=//keyword ID

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Problem: still store too much!

ID, Val, Cont in the view definition V1=//item ID, V2=//name ID Val, V3=//keyword ID Cont

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Can I eliminate the joins? Express outer joins in view!

13 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-25
SLIDE 25

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store IDs in the view V1=//item ID, V2=//name ID, V3=//keyword ID

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Problem: still store too much!

ID, Val, Cont in the view definition V1=//item ID, V2=//name ID Val, V3=//keyword ID Cont

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Can I eliminate the joins? Express outer joins in view!

13 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-26
SLIDE 26

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store IDs in the view V1=//item ID, V2=//name ID, V3=//keyword ID

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Problem: still store too much!

ID, Val, Cont in the view definition V1=//item ID, V2=//name ID Val, V3=//keyword ID Cont

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Can I eliminate the joins? Express outer joins in view!

13 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-27
SLIDE 27

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store IDs in the view V1=//item ID, V2=//name ID, V3=//keyword ID

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Problem: still store too much!

ID, Val, Cont in the view definition V1=//item ID, V2=//name ID Val, V3=//keyword ID Cont

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Can I eliminate the joins? Express outer joins in view!

13 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-28
SLIDE 28

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store IDs in the view V1=//item ID, V2=//name ID, V3=//keyword ID

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Problem: still store too much!

ID, Val, Cont in the view definition V1=//item ID, V2=//name ID Val, V3=//keyword ID Cont

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Can I eliminate the joins? Express outer joins in view!

13 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-29
SLIDE 29

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store IDs in the view V1=//item ID, V2=//name ID, V3=//keyword ID

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Problem: still store too much!

ID, Val, Cont in the view definition V1=//item ID, V2=//name ID Val, V3=//keyword ID Cont

Q = V1 ⊲ ⊳ ⊏ID V2 ⊲ ⊳ ⊏ID V3 Can I eliminate the joins? Express outer joins in view!

13 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-30
SLIDE 30

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store ID, Cont, Val + optional edges

V

keyword Cont V name item ID

Q = GroupByID(V) Can I eliminate the need for group by? Add nesting!

14 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-31
SLIDE 31

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store ID, Cont, Val + optional edges

V

keyword Cont V name item ID

Q = GroupByID(V) Can I eliminate the need for group by? Add nesting!

14 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-32
SLIDE 32

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store ID, Cont, Val + optional edges

V

keyword Cont V name item ID

Q = GroupByID(V) Can I eliminate the need for group by? Add nesting!

14 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-33
SLIDE 33

Context: rewriting XQuery using nested views

Materialized views for XML: Enhanced Tree Patterns

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} Store ID, Cont, Val + optional edges

V

keyword Cont V name item ID

Q = GroupByID(V) Can I eliminate the need for group by? Add nesting!

14 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-34
SLIDE 34

Context: rewriting XQuery using nested views

Materialized views for XML: XML Access Modules

for $x in //item return <res> {$x//keyword} </res> {$x/name/text()} XML Access Modules = tree patterns with IDs, Val, Cont +

  • ptional and nested edges + value predicates

V

keyword Cont V name item ID n n

Q = V

15 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-35
SLIDE 35

Context: rewriting XQuery using nested views

XAMs by examples

a

*

a b ID a b IDs a b V a b Cont a b V="7" a a a a b b b b a b a b a b a b

n n n n

16 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-36
SLIDE 36

Context: rewriting XQuery using nested views

XAMs by examples

n4 n10 n13 n14 n17 n18 n19 n28 n21 n27 n23 n22 n24 n26 n15 n9 n8 n12 n7 n6 n11 n25 n20

text mail to from date

n16 n5 n32 n

30

n29 n1 n2 n3

Can you...

site regions mailbox item

bob@u2.com Hello,...

text parlist name description parlist

Stainless steel, bold

listitem text name text

Italic fountain pen

keyword keyword listitem

Columbus pen Columbus bill@aol.com jane@u2.com 4/6/2006 jim@gmail.com

item mailbox description listitem mail from

gold plated Monteverdi Invincia pen

to asia

n31

date text

Monteverdi pen 3/4/2006

n5 n22

ID V Columbus pen Monteverdi pen regions nameID V

V1

17 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-37
SLIDE 37

Context: rewriting XQuery using nested views

XAMs by examples

n4 n10 n13 n14 n17 n18 n19 n28 n21 n27 n23 n22 n24 n26 n15 n9 n8 n12 n7 n6 n11 n25 n20

text mail to from date

n16 n5 n32 n

30

n29 n1 n2 n3

Can you...

site regions mailbox item

bob@u2.com Hello,...

text parlist name description parlist

Stainless steel, bold

listitem text name text

Italic fountain pen

keyword keyword listitem

Columbus pen Columbus bill@aol.com jane@u2.com 4/6/2006 jim@gmail.com

item mailbox description listitem mail from

gold plated Monteverdi Invincia pen

to asia

n31

date text

Monteverdi pen 3/4/2006

n4

<listitem><keyword>Columbus</keyword><text>Italic <keyword>fountain pen</keyword></text> </listitem> <listitem><text>Stainless steeel, <bold>gold plated</bold></text> </listitem> gold plated

n21

<listitem><text>Monteverdi Invincia pen</text></listitem> A ID V C

V

2 * ID

site description parlist bold V n

* Cont

18 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-38
SLIDE 38

Context: rewriting XQuery using nested views

Rewriting XQuery using XAMs

n4 n10 n13 n14 n17 n18 n19 n28 n21 n27 n23 n22 n24 n26 n15 n9 n8 n12 n7 n 6 n11 n25 n20

text mail to from date

n16 n5 n32 n

30

n29 n1 n2 n3

Can you...

site regions mailbox item

bob@u2.com Hello,...

text parlist name description parlist

Stainless steel, bold

listitem text name text

Italic fountain pen

keyword keyword listitem

Columbus pen Columbus bill@aol.com jane@u2.com 4/6/2006 jim@gmail.com

item mailbox description listitem mail from

gold plated Monteverdi Invincia pen

to asia

n31

date text

Monteverdi pen 3/4/2006

regions nameID V

V1

n5 n22

ID V Columbus pen Monteverdi pen

for $x in //item[//mail] return <res> {$x/name/text(), for $y in $x//listitem return <key> {$y//keyword} </key>} </res>

V2

n4 n21

* ID

site description parlist bold n

*

V ID V . . . . . . . . . C A plated gold Cont

19 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-39
SLIDE 39

Context: rewriting XQuery using nested views

Rewriting XQuery using XAMs

n4 n10 n13 n14 n17 n18 n19 n28 n21 n27 n23 n22 n24 n26 n15 n9 n8 n12 n7 n 6 n11 n25 n20

text mail to from date

n16 n5 n32 n

30

n29 n1 n2 n3

Can you...

site regions mailbox item

bob@u2.com Hello,...

text parlist name description parlist

Stainless steel, bold

listitem text name text

Italic fountain pen

keyword keyword listitem

Columbus pen Columbus bill@aol.com jane@u2.com 4/6/2006 jim@gmail.com

item mailbox description listitem mail from

gold plated Monteverdi Invincia pen

to asia

n31

date text

Monteverdi pen 3/4/2006

regions nameID V

V1

n5 n22

ID V Columbus pen Monteverdi pen

for $x in //item[//mail] return <res> {$x/name/text(), for $y in $x//listitem return <key> {$y//keyword} </key>} </res>

V2

n4 n21

V2

V1

ID C A ID V V

item ANCESTOR−OF name

If document structure is known

* ID

site description parlist bold n

*

V ID V . . . . . . . . . C A plated gold Cont

20 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-40
SLIDE 40

Context: rewriting XQuery using nested views

XAMs by example

a

*

a b ID a b V a b IDs a b Cont a b V="7" a a a a b b b b a b a b a b a b

n n n n

21 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-41
SLIDE 41

Context: rewriting XQuery using nested views

XAMs by example

a

*

a b ID a b V a b b IDs a b Cont a b V="7" a a a a b b b b a b a b a b a b

n n n n

a

22 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-42
SLIDE 42

Pattern containment under summary constraints

Outline

1

Context: rewriting XQuery using nested views

2

Pattern containment under summary constraints Path summary Summary based containment

3

Summary based query rewriting

4

Experimental results

5

Conclusions

23 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-43
SLIDE 43

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

24 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-44
SLIDE 44

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

24 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-45
SLIDE 45

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

24 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-46
SLIDE 46

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

25 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-47
SLIDE 47

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

26 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-48
SLIDE 48

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

27 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-49
SLIDE 49

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

28 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-50
SLIDE 50

Pattern containment under summary constraints Path summary

Path summary

Simple summary of a document d: root, label and parent-preserving mapping φ : d → S the children of a summary node have distinct labels A document d’ conforms to a path summary S (S | = d′) iff ∃φ′ : d′ → S

b d e b b b e d d a a d c e b e b d S b c c b c

29 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-51
SLIDE 51

Pattern containment under summary constraints Path summary

Path summaries and XAMs in query rewriting

b e e a a c c b d b b Q V1 V2

30 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-52
SLIDE 52

Pattern containment under summary constraints Path summary

Path summaries and XAMs in query rewriting

b e e a a c c b d b b a c b d b e b Q V1 V2 S

31 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-53
SLIDE 53

Pattern containment under summary constraints Path summary

Path summaries and XAMs in query rewriting

b e e a a c c b d b b a c b d b e b Q V1 V2 S

32 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-54
SLIDE 54

Pattern containment under summary constraints Summary based containment

Summary based containment

Definition p ⊆S p′ iff for any t such that S | = t, p(t) ⊆ p′(t). Problem: infinitely many trees t Solution: consider trees from a finite set canonical model of S if no canonical tree is a counter-example then p ⊆S p′

33 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-55
SLIDE 55

Pattern containment under summary constraints Summary based containment

Summary based containment

Definition p ⊆S p′ iff for any t such that S | = t, p(t) ⊆ p′(t). Problem: infinitely many trees t Solution: consider trees from a finite set canonical model of S if no canonical tree is a counter-example then p ⊆S p′

33 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-56
SLIDE 56

Pattern containment under summary constraints Summary based containment

Summary based containment

Definition p ⊆S p′ iff for any t such that S | = t, p(t) ⊆ p′(t). Problem: infinitely many trees t Solution: consider trees from a finite set canonical model of S if no canonical tree is a counter-example then p ⊆S p′

33 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-57
SLIDE 57

Pattern containment under summary constraints Summary based containment

Summary based containment

Definition p is S-contained in p′ iff for any t such that S | = t, p(t) ⊆ p′(t). Proposition: p ⊆S p′ iff ∀ tp ∈ modS(p) the return tuple of p(tp) ∈ p′(tp).

34 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-58
SLIDE 58

Summary based query rewriting

Outline

1

Context: rewriting XQuery using nested views

2

Pattern containment under summary constraints Path summary Summary based containment

3

Summary based query rewriting

4

Experimental results

5

Conclusions

35 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-59
SLIDE 59

Summary based query rewriting

Query rewriting: problem statement

Input: Path summary S, XQuery Q, set of XAMs X1, X2, . . . , Xn Output: all minimal algebraic expressions e(X1, X2, . . . , Xn) (up to algebraic equivalence) s.t. ∀ d conforming to S Q(d) = e(X1, X2, ..., Xn)(d) Algebra: σ , Π, ⊲ ⊳ID, ⊲ ⊳ ⊏ID, ⊲ ⊳≺, ⊲ ⊳ ⊏≺ (variants: ancestor-descendent, nested joins), Nest, Unnest, Nav and ∪

36 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-60
SLIDE 60

Summary based query rewriting

Query rewriting: problem statement

Input: Path summary S, XQuery Q, set of XAMs X1, X2, . . . , Xn Output: all minimal algebraic expressions e(X1, X2, . . . , Xn) (up to algebraic equivalence) s.t. ∀ d conforming to S Q(d) = e(X1, X2, ..., Xn)(d) Algebra: σ , Π, ⊲ ⊳ID, ⊲ ⊳ ⊏ID, ⊲ ⊳≺, ⊲ ⊳ ⊏≺ (variants: ancestor-descendent, nested joins), Nest, Unnest, Nav and ∪

36 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-61
SLIDE 61

Summary based query rewriting

Query rewriting: problem statement

Input: Path summary S, XQuery Q, set of XAMs X1, X2, . . . , Xn Output: all minimal algebraic expressions e(X1, X2, . . . , Xn) (up to algebraic equivalence) s.t. ∀ d conforming to S Q(d) = e(X1, X2, ..., Xn)(d) Algebra: σ , Π, ⊲ ⊳ID, ⊲ ⊳ ⊏ID, ⊲ ⊳≺, ⊲ ⊳ ⊏≺ (variants: ancestor-descendent, nested joins), Nest, Unnest, Nav and ∪

36 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-62
SLIDE 62

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

37 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-63
SLIDE 63

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

XQ1 XQ2 XQm ……………………………

E

38 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-64
SLIDE 64

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

39 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-65
SLIDE 65

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

40 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-66
SLIDE 66

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

41 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-67
SLIDE 67

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 e1,k1

… …

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

42 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-68
SLIDE 68

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 e1,k1

… …

e2,1 e2,2 e2,k2

… …

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

43 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-69
SLIDE 69

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 e1,k1

… …

e2,1 e2,2 e2,k2

… …

em,1 em,2 em,km

… …

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

44 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-70
SLIDE 70

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 e1,k1

… …

e2,1 e2,2 e2,k2

… …

em,1 em,2 em,km

… …

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

45 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-71
SLIDE 71

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 e1,k1

… …

e2,1 e2,2 e2,k2

… …

em,1 em,2 em,km

… …

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

46 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-72
SLIDE 72

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 e1,k1

… …

e2,1 e2,2 e2,k2

… …

em,1 em,2 em,km

… …

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

47 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-73
SLIDE 73

Summary based query rewriting

Query rewriting algorithm

23

XQuery Q

e1,1 e1,2 e1,k1

… …

e2,1 e2,2 e2,k2

… …

em,1 em,2 em,km

… …

X1, X2, …, Xn

S

XQ1 XQ2 XQm ……………………………

E

e1,2 e2,k2 em,1 ……………………………

E

48 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-74
SLIDE 74

Summary based query rewriting

Query rewriting algorithm

24

XQuery Q

XQ1 XQ2 XQm ……………………………

E

X1, X2, …, Xn e1,1 e1,2 e1,k1

… …

e2,1 e2,2 e2,k2

… …

em,1 em,2 em,km

… …

S

e1,1 e2,2 em,km ……………………………

E

49 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-75
SLIDE 75

Summary based query rewriting

Zoom on XAM rewriting

Rewriting one query XAM In the presence of a summary bucket algorithms would be incomplete Inflationary algorithm:

Builds (structural) joins a plan is a full rewriting when its equivalent XAM is ≡S to the query XAM. XAM containment algorithm under S constraints

When to stop: no new plans or plans outgrow a certain size Agressive summary-based pruning of plans to keep search space manageable

50 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-76
SLIDE 76

Summary based query rewriting

Full results

XAM language

Value and structure predicates Nesting Optional edges Structural and non-structural IDs

Enhanced summaries: integrity constraints (required children)

51 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-77
SLIDE 77

Summary based query rewriting

Summary vs. DTD constraints

  • 52

Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-78
SLIDE 78

Summary based query rewriting

Summary vs. DTD constraints

  • Example: Is there a rewriting //a=//b/a + //c/a ?

53 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-79
SLIDE 79

Experimental results

Outline

1

Context: rewriting XQuery using nested views

2

Pattern containment under summary constraints Path summary Summary based containment

3

Summary based query rewriting

4

Experimental results

5

Conclusions

54 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-80
SLIDE 80

Experimental results

Experimental setting

ULoad prototype, Java 1.5, 1GHz CPU, 1GB RAM Documents

DBLP 2005 (280MB) XMark (233MB)

Queries

XMark query patterns Randomly generated patterns based on DBLP and XMark path summaries

Views

1 view per each XMark tag (IDs V) randomly generated patterns based on XMark and DBLP

55 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-81
SLIDE 81

Experimental results Pattern containment results

Pattern containment results

56 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-82
SLIDE 82

Experimental results Pattern containment results

Pattern containment results

57 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-83
SLIDE 83

Experimental results Pattern containment results

Query rewriting

183 views: 100 generated + 83 tag partition

58 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-84
SLIDE 84

Conclusions

Outline

1

Context: rewriting XQuery using nested views

2

Pattern containment under summary constraints Path summary Summary based containment

3

Summary based query rewriting

4

Experimental results

5

Conclusions

59 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-85
SLIDE 85

Conclusions

Conclusions

Contributions XML query pattern containment and equivalent rewriting based on summary constraints exploiting detailed informations about view contents and IDs expressed by XAMs query rewriting using XAMs is feasible Future work Cost-based materialized view selection View maintenance in the presence of updates

60 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries

slide-86
SLIDE 86

Conclusions

Questions?

More information ULoad, XAM home: http://gemo.futurs.inria.fr/projects/XAM/ A.Arion, V.Benzaken, I.Manolescu: ”XML Access Modules: Towards Physical Independence in XML Databases”, [XIMEP2005] A.Arion, V.Benzaken, I.Manolescu, R.Vijay: ”ULoad: Finding the Best Storage for your XML Management Application”, [VLDBDemo2005] A.Arion, V.Benzaken, I.Manolescu, Y.Papakonstantinou and R.Vijay: ”Algebra-Based Tree Pattern Extraction from XQuery”, [FQAS2006] I.Manolescu, V.Benzaken, A.Arion and Y.Papakonstantinou: ”Structured Materialized views for XML Queries”, INRIA report, http://hal.inria.fr, 2006

61 Arion, Benzaken, Manolescu, Papakonstantinou Structured Materialized Views for XML Queries