30.08.2014 Views

url - Universität zu Lübeck

url - Universität zu Lübeck

url - Universität zu Lübeck

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.3. XML QUERY LANGUAGES 31<br />

m. p consists of two leading /a/b location steps followed by m − 1 expressions<br />

of the form /../b. The first part selects the two b elements. The remainder of p<br />

is executed for both b. Each /../b step returns the two b elements, so that the<br />

number of b elements is doubled on each execution of the /../b path expression.<br />

The m-th execution step returns 2 m b elements. Of course these are redundant<br />

repetitions of the original two b elements.<br />

This naive approach is implemented in most XPath processors like XALAN [7]<br />

and Microsoft Internet Explorer 1 Gottlob, Koch and Pichler propose a more efficient<br />

implementation that uses polynomial runtime in the worst case. Details can<br />

be taken from [34, 35].<br />

2.3.4 XQuery<br />

XQuery is a functional programming language that uses XPath expressions for<br />

selecting nodes. More precisely, XQuery is a superset of XPath; this implies that<br />

each XPath expression is already a valid XQuery expression and will return the<br />

same result in both languages. In contrast to XPath that only selects nodes in a<br />

given document XQuery allows to transform the nodes and to create new structures<br />

with XML templates.<br />

XQuery is a proposal of the W3C that is not standardized yet. The latest working<br />

draft was published in April 2005. However, many systems that use an XQuery<br />

implementation are realized. Examples include the Microsoft SQL Server 2005 Express<br />

with XQuery support [79] or the Berkeley DB XML 2.0 [107], an embedded<br />

native XML database with support for XQuery 1.0.<br />

Sequences<br />

The basic construct of XQuery are sequences. All XQuery expressions and functions<br />

operate on one or multiple sequences and returns a new sequence. Sequences<br />

consist of items which can be atomic values or XML nodes. Both types<br />

can be mixed in a sequence. A sequence may not contain another sequence but<br />

can contain nested nodes. The following example shows how a sequence of values<br />

and elements is created syntactically in XQuery:<br />

1 (1 , , 2 , 1 , )<br />

The items in a sequence are ordered and may appear more than once. Therefore,<br />

duplicates are allowed in a sequence. The concept of the sequence is different to<br />

the node-sets of XPath that have no ordered items and no duplicates.<br />

1 The Internet Explorer uses XPath in its embedded XSLT engine generating HTML pages from<br />

an XML document and a stylesheet.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!