25.12.2013 Views

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

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.

Query Examples<br />

Deleting Nodes<br />

The first simple query deletes all books from the current bib collection that have been edited by<br />

Darcy Gerbarg:<br />

Query<br />

update delete input()/bib/book[editor/last="Gerbarg"]<br />

Result<br />

As the result is a modification of the current collection, you receive a confirmation that the operation<br />

has been performed successfully:<br />

Explanation<br />

From the document returned by <strong>Tamino</strong> you can see the original query expression in the marked<br />

CDATA section, and the xq:result element that provides information about where the update<br />

operation took place: The first document instance (ino:id="1") of the document type bib<br />

(ino:doctype="bib") in the collection XMP (ino:collection="XMP").<br />

You can use queries like count(input()/bib/book) to check the number of books before and after<br />

the delete operation.<br />

See UpdateExpr and DeleteClause in the language reference for details.<br />

<strong>XQuery</strong> <strong>User</strong> <strong>Guide</strong><br />

17

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

Saved successfully!

Ooh no, something went wrong!