2013-12-04T01:28:38.942159+01:001.0http://zorba.io/modules/store/dynamic/collections/dmldml This modules provides a set of functions to modify a collection
and retrieve the items contained in a particular collection.
Please refer to our documentation for
more information
about the lifecycle management and the manipulation of such collections.
Matthias Brantner, David Graf, Till Westmann, Markos ZaharioudakisData Lifecyclehttp://zorba.io/modules/zorba.io/modules/store/dynamic/collections/ddlhttp://zorba.io/modules/zorba.io/errorsZorba/Data Store/Collections/Dynamic Data Manipulationxquery3.0utf-8 Inserts copies of the given items (nodes or JSON items)
into a collection at the position directly preceding the given target item.
$name The name of the collection to insert into.$target The item in the collection before which $content
will be inserted.$content The sequence of items whose copies to insert.An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.zerr:ZDDY0003 if the collection is not available.zerr:ZDDY0011 if $target
is not in the collection.dml:insert-beforedeclare updating function dml:insert-before($name as xs:QName, $target as item(), $content as item()*) externalnamexs:QNametargetitem()contentitem() Inserts copies of the given items (nodes or JSON items)
at the beginning of the collection.
$name The name of the collection to insert into.$content The sequence of items whose copies to insert.An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.zerr:ZDDY0003 if the collection is not available.dml:insert-firstdeclare updating function dml:insert-first($name as xs:QName, $content as item()*) externalnamexs:QNamecontentitem() Inserts copies of the given items (nodes or JSON items)
at the end of the collection.
$name The name of the collection to insert into.$content The sequence of items whose copies to insert.An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.zerr:ZDDY0003 if the collection is not available.dml:insert-lastdeclare updating function dml:insert-last($name as xs:QName, $content as item()*) externalnamexs:QNamecontentitem() Inserts copies of the given items (nodes or JSON items)
into a collection at the position directly following the given target item.
$name The name of the collection to insert into.$target The item in the collection after which $content
will be inserted.$content The sequence of items whose copies to insert.An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.zerr:ZDDY0003 if the collection is not available.zerr:ZDDY0011 if $target
is not in the collection.dml:insert-afterdeclare updating function dml:insert-after($name as xs:QName, $pos as item(), $content as item()*) externalnamexs:QNamepositem()contentitem() This function does the same thing as insert-first()
except it
immediately applies the resulting pending updates and returns the items that
have been inserted.
$name The name of the collection to insert into.$content The sequence of items whose copies to insert.The sequence of items that have been inserted.zerr:ZDDY0003 if the collection is not available.dml:insert-firstdml:apply-insert-firstdeclare %an:sequential function dml:apply-insert-first($name as xs:QName, $content as item()*) as item()* externalnamexs:QNamecontentitem()item()* This function does the same thing as insert-last()
except it
immediately applies the resulting pending updates and returns the items that
have been inserted.
$name The name of the collection to insert into.$content The sequence of items whose copies to insert.The sequence of items that have been inserted.zerr:ZDDY0003 if the collection is not available.dml:insert-lastdml:apply-insert-lastdeclare %an:sequential function dml:apply-insert-last($name as xs:QName, $content as item()*) as item()* externalnamexs:QNamecontentitem()item()* This function does the same thing as insert-before()
except it
immediately applies the resulting pending updates and returns the items that
have been inserted.
$name The name of the collection to insert into.$target The item in the collection before which $content
will be inserted.$content The sequence of items whose copies to insert.The sequence of items that have been inserted.zerr:ZDDY0003 if the collection is not available.dml:insert-beforedml:apply-insert-beforedeclare %an:sequential function dml:apply-insert-before($name as xs:QName, $target as item(), $content as item()*) as item()* externalnamexs:QNametargetitem()contentitem()item()* This function does the same thing as insert-after()
except it
immediately applies the resulting pending updates and returns the items that
have been inserted.
$name The name of the collection to insert into.$target The item in the collection after which $content
will be inserted.$content The sequence of items whose copies to insert.The sequence of items that have been inserted.zerr:ZDDY0003 if the collection is not available.zerr:ZDDY0011 if $target
is not in the collection.dml:insert-afterdml:apply-insert-afterdeclare %an:sequential function dml:apply-insert-after($name as xs:QName, $target as item(), $content as item()*) as item()* externalnamexs:QNametargetitem()contentitem()item()* Gets the sequence of nodes or JSON items from a collection.
$name The name of the collection.The sequence contained in the given collection.zerr:ZDDY0003 if the collection is not available.dml:collectiondeclare function dml:collection($name as xs:QName) as item()* externalnamexs:QNameitem()* Gets the sequence of items (nodes or JSON items) from a collection.
$name The name of the collection.$skip The number of collection items to skip.The sub-sequence contained in the given collection.zerr:ZDDY0003 if the collection is not available.dml:collectiondeclare function dml:collection($name as xs:QName, $skip as xs:integer) as item()* externalnamexs:QNameskipxs:integeritem()* Gets the sequence of items (nodes or JSON items) from a collection.
The parameters $start
and $skip
can be used to
skip over items at the beginning of the collection.
If both are given, both are applied: first, $start
to skip to
that item and then $skip
to skip that additional number of
items.
$name The name of the collection.$start A reference to the first item to return.$skip The additional number of items to skip.The sub-sequence from the given collection.zerr:ZAPI0028 If the given URI is not a valid node position computed by the np:node-position
function.zerr:ZDDY0003 if the collection is not available.zerr:ZSTR0066 If $start
does not reference a node from the collection $name
.dml:collectiondeclare function dml:collection($name as xs:QName, $start as xs:anyURI, $skip as xs:integer) as item()* externalnamexs:QNamestartxs:anyURIskipxs:integeritem()* Gets the name of the collection the given item (node or JSON item) belongs
to.
$item The item for which to get the name of the collection.The name of the collection to which $item
belongs.zerr:ZDDY0011 if $item
does not belong to a collection.dml:collection-namedeclare function dml:collection-name($item as item()) as xs:QName externalitemitem()xs:QName Deletes items (nodes or JSON items) from a collection.
$items The items in the collection to delete.An empty XDM instance and a pending update list that, once applied, deletes the items from their collections.zerr:ZDDY0011 if any item in $items
is not a member of a collection or not all items belong to the same collection.dml:deletedeclare updating function dml:delete($items as item()*) externalitemsitem() Deletes the first item from a collection.
$name The name of the collection to delete from.An empty XDM instance and a pending update list that, once applied, deletes the first item from the collection.zerr:ZDDY0011 if the collection is empty.dml:delete-firstdeclare updating function dml:delete-first($name as xs:QName) externalnamexs:QName Deletes the first N items from a collection.
$name The name of the collection to delete from.$number The number of items to delete.An empty XDM instance and a pending update list that, once applied, deletes the items from the collection.zerr:ZDDY0003 if the collection is not available.zerr:ZDDY0011 if the collection contains less than $number
items.dml:delete-firstdeclare updating function dml:delete-first($name as xs:QName, $number as xs:integer) externalnamexs:QNamenumberxs:integer Deletes the last item from a collection.
$name The name of the collection to delete from.An empty XDM instance and a pending update list that, once applied, deletes the last item from the collection.zerr:ZDDY0003 if the collection is not available.zerr:ZDDY0011 if the collection is empty.dml:delete-lastdeclare updating function dml:delete-last($name as xs:QName) externalnamexs:QName Deletes the last N items from a collection.
$name The name of the collection to delete from.$number The number of items to delete.An empty XDM instance and a pending update list that, once applied, deletes the last N items.zerr:ZDDY0003 if the collection is not available.zerr:ZDDY0011 if the collection contains less than $number
items.dml:delete-lastdeclare updating function dml:delete-last($name as xs:QName, $number as xs:integer) externalnamexs:QNamenumberxs:integer Edits the first supplied item so as to make it look exactly like a copy of
the second supplied item while retaining its original identity.
$target The target item to be edited.$content The item that serves as an edit goal.An empty XDM instance and a pending update list that, once applied, performs the edit.zerr:ZDDY0003 if the collection to which $target
belongs is not available.zerr:ZDDY0006 if the collection to which $target
belongs is append-only, const, or queue.zerr:ZDDY0017 if $target
is not a member of a collection.zerr:ZDDY0037 if the collection is append-only.zerr:ZDDY0038 if the collection is a queue.zerr:ZDDY0039 if $target
is not a root.zerr:ZDDY0040 if $target
cannot be updated to match the content (for example, because the target is a node and the content is an object).dml:editdeclare updating function dml:edit($target as item(), $content as item()) externaltargetitem()contentitem() Gets the position of the given item (node or JSON item) within its
collection.
$item The item to get the index of.The position of $item
in its collection.zerr:ZDDY0011 if $item
does not belong to a collection.dml:index-ofdeclare function dml:index-of($item as item()) as xs:integer externalitemitem()xs:integer Deletes the entire contents of a collection.
$name The name of the collection whose contents to delete.An empty XDM instance and a pending update list that, once applied, deletes the contents.zerr:ZDDY0003 if the collection is not available.dml:truncatedeclare updating function dml:truncate($name as xs:QName) externalnamexs:QName