On the Expressive Power of Node Construction in XQuery - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

On the Expressive Power of Node Construction in XQuery

Description:

It would be nice to get rid of Node Construction, whenever possible. e.g. for SQL based evaluation of XQuery ... Does node construction add power, except for ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 13
Provided by: philippe54
Category:

less

Transcript and Presenter's Notes

Title: On the Expressive Power of Node Construction in XQuery


1
On the Expressive Power of Node Construction in
XQuery
  • Wim Le Page
  • Jan Hidders
  • Philippe Michiels
  • Jan Paredaens
  • Roel Vercammen

2
Introduction
  • XQuery allows node construction, but
  • complex semantics (e.g. non-determinism)
  • implied materialization/copying
  • It would be nice to get rid of Node Construction,
    whenever possible
  • e.g. for SQL based evaluation of XQuery
  • Does node construction add power, except for the
    construction of new nodes?
  • Is node construction necessary when used for
    intermediate results only?

3
Preliminaries (1)
  • We use LiXQuery (Hidders et al.) to prove
    something about XQuery
  • LiXQuery is a syntactical subset of XQuery, with
    essentially the same expressive power, but more
    compact
  • LiXQuery semantics are consistent with that of
    XQuery, but much simpler
  • Semantics defined by rules of the form
  • St, Env - e ? St, v
  • an evaluation of e against a store St and an
    environment Env, has St as the result store and
    v as the result sequence over St

4
Preliminaries (2)
  • An expression cannot be simulated by a
    constructor-free expression (CFE) if it returns
    newly created nodes
  • Node Conservative Expressions (NCE)
  • An NCE is an expression whose result contains no
    newly constructed nodes
  • if St, Env - e ? St, v
  • then all nodes in v are nodes in St
  • Note that an NCE can be non-deterministic
  • e.g. lta/gt ltlt ltb/gt
  • We do not consider non-deterministic NCEs

5
Theorem
  • For every deterministic NCE e, there exists a CFE
    e such that for all stores St and all initial
    environments Env, it holds that
  • if St, Env - e ? St, v
  • then there exists a store St s.t.
  • St, Env - e ? St, v
  • and Stv Stv
  • e is called a simulation for e

garbage collection
6
Simulation Outline
  • Idea eliminate node construction by simulating
    it
  • To simulate construction, we have to simulate the
    store
  • Simulation consists of the following steps
  • Use special variable to encode newly created
    nodes and nodes accessed using doc()
  • Whenever a doc() call occurs, add encoding of the
    document to the simulated store (if not already
    in store)
  • Accessing nodes in the store is simulated by
    accessing node in the encoded store
  • Nodes are simulated by using the node ids, i.e.,
    numbers referring to the encoded nodes in the
    simulated store
  • Special markers are used in the simulation to
    distinguish between node ids and atomic values
  • In the end, the simulation replaces node ids with
    corresponding nodes from the store

7
Encoding Store and Environment
  • An encoded store is a 3-tuple (V,E,d)
  • V sequence of nodes encoded as sequences of
    length 4 (id, kind, name, value)
  • E sequence of (parent, child) pairs (encoded as
    sequence of 2 ids)
  • d sequence of (URI, node id) pairs
  • An encoded item is a sequence of length 2
  • first item node (0) or atomic value (1) ?
  • second item node id or original value
  • Example ltagtltb/gtlt/agt,2
  • n ? 0, 1, 1, 2 ?
  • V ? 1, 1, a, , 2, 1, b, ?
  • E ? 1, 2 ?
  • d ? ?

8
Translation
  • Translation to a CFE is expressed by a
    translation function ?
  • Notes
  • is initial store (the web)
  • contains variables that simulate St and
    Env
  • contains encoded result sequence and store
  • Now, show by induction on the subexpressions e
    of an expression e that we can correctly
    translate e to a CFE.

9
Simulation of Node Construction
  • Translation of a construction operation extends
    the encoded store
  • element c ()
  • V ? 1, 1, a, , 2, 1, b, ? o ? 3, 1,
    c, ?
  • E ? 1, 2 ? o ? ?
  • d ? ?
  • Now, all other syntactical constructs in LiXQuery
    have to be translated to work on the encoding

10
Simulation Recursion
  • Currently, the simulation relies heavily on
    recursive functions
  • For example
  • Node copying element a expr
  • For loops for s at s in expr return element
    a()

declare function forx (pos,seq, V, E, delta,
varsx) let s seqpos2-1,seqpos2
let s pos let res1
e(returnExpr) let V1,E1,delta1,val1
getStVal(res1) let res2 for(pos1, seq,
V1, E1, delta1, varsx) let
V2,E2,delta2,val2 getStVal(res2) return
stValEnc(V2, E2, delta2,(val1, val2))
let V,e,delta,val getStVal(res)
?
let V V(res) let e E(res) let delta
delta(res) let val valal(res)
11
Conclusion and Future Work
  • Conclusion
  • For deterministic NCEs, node construction does
    not add any power
  • Linear relationship between e(e) and e
  • Future work
  • Simulation uses recursion, which is not
    optimal/practical ? can we avoid recursion?
  • Do similar results hold for copied nodes?

12
Questions?
Write a Comment
User Comments (0)
About PowerShow.com