couple of doubts

1). W3C XQuery doesn’t have data manipulation functionality till now. Whatever is available with Software AG’s Quip, is it related to W3C?
Are insert, updates and delete functions used in working draft of W3C to this present date?

2 ). if I want to test my own xquery on some xml, where should I place my xquery and xml file? in which directory?

3). For following query I’am getting following error
{-- (Q3) Deletes all bids for items that have an end_date lying in the past
if the number of tuples in bids is higher than 500 --}

let $bs := document(“data/R-bids.xml”)/bids/bid_tuple
if (count($bs) > 500) then
for $a in $bs
for $b in document(“data/R-items.xml”)/items/item_tuple
where ($a/itemno = $b/itemno) and ($b/end_date < today())
delete $a




This is to update xquery
for update
{-- (Q12) Renames a document. --}

rename document(“test.xml”) as "test1.xml"


Error (4,1): unparsed data

Can anybody help me here?
plz its driving me crazy :frowning:
Thanks in advance.

On your first point, there is activity on defining an update capability for W3C XQuery, but it won’t be part of the initial XQuery 1.0 specification. In Software AG we’re trying to monitor the way this is going, but we need to provide an update capability for Tamino now, so we weren’t able to wait for the standards.

Your second question: how can you run queries from a file in QuiP? You can select a directory in the small panel on the top-right of the screen; then File/Open will list the .XQuery files in this directory. The query gets its data files relative to the file containing the query, using the document() function.

Your third question: the query updates/R/U3Q3.XQuery produces a message saying that no update was performed. I think this is the expected behavior if you run it on the data files as issued. This query is designed to tidy up old data if you have added a lot of data.

The query updates/Tree/U2Q12 fails for me in the same way. I think this query is incorrect. The “rename” expression is designed to change the name of an XML element or attribute node, while this sample appears to be applying it to a document node; but document nodes have no name.

Michael Kay

Thanks Michael!
I have one quick question.
If i have created a XML file and I wrote few queries for that file. Where should I placed these file exactly so that XQuery engine can recognized them?
Thanks in advance

If you are asking about QuiP, the simplest thing to do is to extend the directory structure that QuiP uses for its sample queries. But you can put your own directories anywhere you like: just browse to them using the usual file open dialogs or the “Directory” and “Browse” buttons. QuiP uses the file extension “.xquery” to identify files containing queries.

Michael Kay