incubator-vxquery-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinayak Borkar <>
Subject Re: Example Queries From w3schools - Questions and Commentary
Date Tue, 05 Jun 2012 03:49:24 GMT
Hi Preston,

Please see inline...

> === Query 1 ===
> doc("books.xml")
> What do these keywords mean?

UNPARTITIONED is an Algebricks annotation attached to each operator to 
indicate that no analysis about partitioning has been performed. At 
first, when an Algebricks plan is created by the translator, the 
operators are unpartitioned. Partitioning is later introduced by rewrite 

QUANT_??? are quantifiers used to construct Sequence Types. They serve a 
similar purpose as ?, *, + in regular expressions.

> === Query 2 ===
> doc("books.xml")/bookstore/book/title
> we set up a sequence of all the books from the data supplied in the
> iterator $$14.
> … Repeat again for "title"
> … Finally sort the complete output.
> Looks like we assign a count, but do not use it. Is that true?

Good question. A variable assigned to the count() function is to support 
the last() function in path expression evaluation.

> Why does the iterator have to variables?

During iteration over sequences, we need to bind a value to each item 
and also to the index of that item to support position() and also the at 
$i syntax for "for" clauses in XQuery.

> What do these keywords mean?

This is a quantifier as explained above (Construction of sequence types).

> === Query 3 ===
> doc("books.xml")/bookstore/book[price<30]
> 7. The final output is sorted.
> how do you define a subplan? Is that for each level of the query?

The subplan operator is used to maintain the correct cardinality of 
tuples at each point in the expression tree.

The best way to understand the use of subplan would be to consider some 
example input and run through a manual evaluation of the expressions.


View raw message