cis562f10_note10_XQuery2

cis562f10_note10_XQuery2 - Combining and restructuring...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 • Combining and restructuring nodes: FLWOR expression — The most powerful expression in XQuery — Pronounced “flower” — Similar to SELECT-FROM-WHERE in SQL — Support iteration — Combine information from different sources and restructure it to create a new result — Have o e where order by and eturn Have f or , l et , w here , o rder by and r clauses E.g., * for and let clauses — Each FLWOR expression must have at least one for or let clause — The for and let clauses create tuples for other clauses to use —A for clause associate one or more variables to expressions, creating a tuple stream: bind each variable to the resulting items of its associated expression one at a time.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 E.g., for $i in (1, 2, 3) return <tuple><i>{ $i }</i></tuple> Result: <tuple><i>1</i></tuple> <tuple><i>2</i></tuple> <tuple><i>3</i></tuple> Notes: - A for clause preserves the given order. -A for clause can bind a variable to any XQuery expression. — If several variables are bound in the for clauses, the tuples contain all possible combinations (Cartesian product) of the items. E.g., for $i in (1, 2, 3) $j in (4, 5, 6) return <tuple><i>{ $i }</i><j>{ $j }</j></tuple> <tuple><i>{ $i }</i><j>{ $j }</j></tuple>
Background image of page 2
Result: Note: A for clause with two variables is equivalent to two for clauses. That is, for $i in (1, 2, 3) for $j in (4, 5, 6) …… —A let clause binds a variable to the entire result of an expression. E.g.,
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 20

cis562f10_note10_XQuery2 - Combining and restructuring...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online