Navigation-Driven Evaluation of Virtual Mediated Views Bertram Ludäscher, SDSC/UCSD Yannis...

Post on 31-Dec-2015

214 views 1 download

Tags:

Transcript of Navigation-Driven Evaluation of Virtual Mediated Views Bertram Ludäscher, SDSC/UCSD Yannis...

Navigation-Driven Evaluation of Virtual Mediated Views

Bertram Ludäscher, SDSC/UCSD Yannis Papakonstantinou, UCSD

Pavel Velikhov, UCSD Overview

• Mediator architecture for virtual XML documents

• Navigation-driven evaluation: lazy mediators

• XMAS QL and algebra

• Mismatch: DOM-VXD vs. source granularity

• Conclusions

Mediator Architecture for Virtual XML Documents (DOM-VXD)

Client Query

Integrated XML View

DataSource

XML DataSource

DataSource

XMLView

Wrapper Wrapper

XMLView

XMLView

MIXmMediator

MIXmMediator

XMASView Definition

Mediator Architecture for Virtual XML Documents (DOM-VXD)

Client Query

IntegratedVirtual XML View

DataSource

XML DataSource

DataSource

Virtual XMLView

Wrapper Wrapper

Virtual XMLView

Virtual XMLView

MIXmMediator

MIXmMediator

XMASView Definition

Navigating Virtual ViewsMediator approaches:

• warehousing

• virtual

• compute complete answer

• compute partial answer “on demand”, i.e., driven by the client navigations

answer book

author Ullman

title DB Systems

dblp-pubs publication ... publication

dblp … author name

Ullmanpubs

publication … publication

db-books@amazon book author Ullman title DB Systems book author …

...s1s1 sn sn

XML source XML source

result

Lazy MediatorLazy Mediator

view definitionans = q( s1 … sn )

Input: clientnavigations

Output: sourcenavigations

Navigation-Driven Evaluation: Lazy Mediators

...s1s1 sn sn

XML source XML source

result

Lazy MediatorLazy Mediator

view definitionans = q( s1 … sn )

Input: clientnavigations

Output: sourcenavigations

Navigation-Driven Evaluation: Lazy Mediators

...s1s1 sn sn

XML source XML source

result

Lazy MediatorLazy Mediator

view definitionans = q( s1 … sn )

Input: clientnavigations

Output: sourcenavigations

Navigation-Driven Evaluation: Lazy Mediators

...s1s1 sn sn

XML source XML source

result

Lazy MediatorLazy Mediator

view definitionans = q( s1 … sn )

Input: clientnavigations

Output: sourcenavigations

Navigation-Driven Evaluation: Lazy Mediators

Navigation-Driven Evaluation: Lazy Mediators

...s1s1 sn sn

XML source XML source

result

Lazy MediatorLazy Mediator

view definitionans = q( s1 … sn )

Input: clientnavigations

Output: sourcenavigations

Modeling Navigations

Navigational commands (subset of DOM API):• d (down) • r (right)• f (fetch)

d

d

fr

d

d

Navigations:

c1(p0), c2(p1), …, cn(pn-1)

(pj = ci(pi-1), i < j)

p1

p0

p4

r r

Query Processing

TranslatorTranslator

Rewriter/OptimizerRewriter/Optimizer

Composed Algebraic Plan

Optimized Plan

XMAS Query

Composition (qov)Composition (qov)

Algebraic Plan for the Query

XMASView Definition

Algebraic Plan for the View

Plan Execution Plan Execution

Compile-timeCompile-time

Run-time: lazy

VXD evaluation

Run-time: lazy

VXD evaluation

XMAS Queries (XML Matching And Structuring Language)

CONSTRUCT <books> <book>

$a1$t<pubs>

$p { $p } </pubs>

</book> { $a1, $t } </books>WHERE <books.book>

$a1 : <author />$t : <title />

</> IN "amazon.com" AND <authors.author>

$a2 : <author /><pubs> $p : <pub/> </>

</> IN "www...DBLP… "AND value( $a1 ) = value( $a2 )

CONSTRUCT <books> <book>

$a1$t<pubs>

$p { $p } </pubs>

</book> { $a1, $t } </books>WHERE <books.book>

$a1 : <author />$t : <title />

</> IN "amazon.com" AND <authors.author>

$a2 : <author /><pubs> $p : <pub/> </>

</> IN "www...DBLP… "AND value( $a1 ) = value( $a2 )

XMAS Algebra

val($a1)=val($a2)

Concat[$a1, $t,$eps]-> $list

getD$book,”title”->$t

getD$book,”author”->$a1

getDamazon,”books.book”->$book

getD$auth,”pubs.pub”->$p

getD$auth,”name”->$a2

getDDBLP,”authors.author”->$auth

createElement”book”, $list -> $Res

removeDuplicates[$a1, $t]groupBy[$a1 ,$t],$p->$ps

createElement“pubs”,$ps->$eps

XMAS Algebra

• relational operators• + XML specific ones ( nest, unnest + pe’s)• works on trees of variable bindings

createElementname,ch->e

createListname,ch->e

concatenate[l1…lk]->z

groupBy[a1…gk],v->l

getDescendentse,pe->ch

getNamee->name

assignf[u1…un],[v1…vn]->x mapf[u1…

un],[v1…vn]->[x1…xn]

createElementname,ch->e

createListname,ch->e

concatenate[l1…lk]->z

groupBy[a1…gk],v->l

getDescendentse,pe->ch

getNamee->name

assignf[u1…un],[v1…vn]->x mapf[u1…

un],[v1…vn]->[x1…xn]

Efficiency of Lazy Mediators

Natural measure: client vs. sourcenavigations navigations

• Bounded Browsable: bounded # of source navigations• Browsable: does not require accessing all elements of lists• Unbrowsable: may require accessing all elements of lists(depend on the given navigation commands!)

Complexity XMAS Operators

Bounded

Browsable

Unbrowsable

createElement, getName, concat,

getDescendents, groupBy, , ,

setdiff, orderBy

Navigational Complexity:

Optimizing Using Navigational Complexity

materializeBrowsable

Unbrowsable

Potential for optimization of

unbrowsable sub-parts:

Granularity of Navigations

Mismatch:

Source granularity <=!=> DOM-VXD

granularity (RDB: sets of tuples vs. individual

table cells)

=> source should control result granularity

=> generic buffer component (above the wrapper)

based on LXP (Lean XML Fragment Protocol)

LXP Protocol

• getRoot

• get a holeId (“handle”) for the root node

• fillHole( holeId )

• replaces the hole in the open XML tree

with a list of nodes and possibly further holes

• getRoot

• get a holeId (“handle”) for the root node

• fillHole( holeId )

• replaces the hole in the open XML tree

with a list of nodes and possibly further holes

Buffer requests:

Holes

open XML tree

Some Empirical Results: Selection Queries

Selectivity First Ten All Conditions

1.0 31ms 3.3s ---

0.85 31ms 4.7s garage

0.66 63ms 7.1s >2 beds and no pool

0.45 16ms 2s >3 beds

0.3 78ms 2.7s >3 beds and no pool

0.22 31ms 1.7s pool

0.1 62ms 1.6s >4 beds

0.01 703ms 1.5s >5 beds

2400 homes

Performance Evaluation: Construction Queries

Selectivity First Ten All Conditions

1.0 1.2s 12s ---

0.73 1.9s 10s garage

0.66 1.6s 9.9s >2 beds and no pool

0.34 16ms 5s >3 beds

0.24 15ms 2.5s pool

0.09 31ms 2.5s >3 beds and pool

328 homes x 122 schools

Summary & Conclusions

• Demand-driven evaluation of virtual XML views

• related to relational iterators and pipelines (but:

trees vs tables, multiple vs single continuations…)

• XMAS QL and algebra for XML

• (try some “XMAS-BBQ”: demo #14)

• http://www.npaci.edu/DICE/MIX/

• http://www.db.ucsd.edu/Projects/MIX/ Future work

• XMAS and DOM-VXD extensions• Optimizing wrt. navigational complexity• Better (quantitative) cost model

Current MIX People

• Chaitan Baru, SDSC• Amarnath Gupta, SDSC/UCSD• Bertram Ludaescher, SDSC/UCSD• Richard Marciano, SDSC• Pratik Mukhopadhyay, UCSD • Kevin Munroe, UCSD• Yannis Papakonstantinou, UCSD• Pavel Velikhov, UCSD• Victor Vianu, UCSD• Andreas Yannakopoulos, UCSD• Ilya Zaslavsky, SDSC

Translating result NCs into source NCs

root

tuple tuple

t1 tname tch tn

...

root

tuple tuple

t1 tname tch tn

...

te

c1 cm... c1 cm... c1 cm...root

tuple

t0 tn te

identity

...

f/d(tuple)rnamef

d/d(tuple)rchd