Update Syntax for XQuery

Currently there is no W3C standard available for Updates within XQuery. XQuery is expected to get an update syntax as there is already a task force and a set of use cases, but so far nothing has been published. Therefore X-Hive implements a proprietary syntax for updating XML documents and the database repository using XQuery statements.

Updates can be invoked using one of the functions described below. The query evaluation is independent of the update syntax and follows snapshot semantics. Conceptually the single update operations are generated, cached and not applied until after query execution. There are currently no checks for conflicting updates within one query.

Examples:

for $book in document('bib.xml')/bib/book
where @year < 1990
return
  xhive:remove($book)
for $book in document('bib.xml')/bib/book,
    $review in document('http://example.com/reviews.xml')//review
where @isbn = $book/@isbn
return
  xhive:insert-into($book, $review)
xhive:insert-document('/lib/newfile.xml',
  document {
    <root>
      ...
    </root>

  }
)