http://zorba.io/modules/store/dynamic/collections/dml

View as XML or JSON.

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.

Function Summary

apply-insert-after ($name as xs:QName, $target as item(), $content as item()*) as item()* external

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.

apply-insert-before ($name as xs:QName, $target as item(), $content as item()*) as item()* external

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.

apply-insert-first ($name as xs:QName, $content as item()*) as item()* external

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.

apply-insert-last ($name as xs:QName, $content as item()*) as item()* external

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.

collection-name ($item as item()) as xs:QName external

Gets the name of the collection the given item (node or JSON item) belongs to.

collection ($name as xs:QName) as item()* external

Gets the sequence of nodes or JSON items from a collection.

collection ($name as xs:QName, $skip as xs:integer) as item()* external

Gets the sequence of items (nodes or JSON items) from a collection.

collection ($name as xs:QName, $start as xs:anyURI, $skip as xs:integer) as item()* external

Gets the sequence of items (nodes or JSON items) from a collection.

delete-first ($name as xs:QName) external

Deletes the first item from a collection.

delete-first ($name as xs:QName, $number as xs:integer) external

Deletes the first N items from a collection.

delete-last ($name as xs:QName) external

Deletes the last item from a collection.

delete-last ($name as xs:QName, $number as xs:integer) external

Deletes the last N items from a collection.

delete ($items as item()*) external

Deletes items (nodes or JSON items) from a collection.

edit ($target as item(), $content as item()) external

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.

index-of ($item as item()) as xs:integer external

Gets the position of the given item (node or JSON item) within its collection.

insert-after ($name as xs:QName, $pos as item(), $content as item()*) external

Inserts copies of the given items (nodes or JSON items) into a collection at the position directly following the given target item.

insert-before ($name as xs:QName, $target as item(), $content as item()*) external

Inserts copies of the given items (nodes or JSON items) into a collection at the position directly preceding the given target item.

insert-first ($name as xs:QName, $content as item()*) external

Inserts copies of the given items (nodes or JSON items) at the beginning of the collection.

insert-last ($name as xs:QName, $content as item()*) external

Inserts copies of the given items (nodes or JSON items) at the end of the collection.

truncate ($name as xs:QName) external

Deletes the entire contents of a collection.

Functions

apply-insert-after#3

declare  %an:sequential function dml:apply-insert-after($name as xs:QName, $target as item(), $content as item()*) as item()* external
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.

Parameters

name as xs:QName
The name of the collection to insert into.
target as item()
The item in the collection after which $content will be inserted.
content as item()
The sequence of items whose copies to insert.

Returns

item()*
The sequence of items that have been inserted.

apply-insert-before#3

declare  %an:sequential function dml:apply-insert-before($name as xs:QName, $target as item(), $content as item()*) as item()* external
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.

Parameters

name as xs:QName
The name of the collection to insert into.
target as item()
The item in the collection before which $content will be inserted.
content as item()
The sequence of items whose copies to insert.

Returns

item()*
The sequence of items that have been inserted.

apply-insert-first#2

declare  %an:sequential function dml:apply-insert-first($name as xs:QName, $content as item()*) as item()* external
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.

Parameters

name as xs:QName
The name of the collection to insert into.
content as item()
The sequence of items whose copies to insert.

Returns

item()*
The sequence of items that have been inserted.

apply-insert-last#2

declare  %an:sequential function dml:apply-insert-last($name as xs:QName, $content as item()*) as item()* external
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.

Parameters

name as xs:QName
The name of the collection to insert into.
content as item()
The sequence of items whose copies to insert.

Returns

item()*
The sequence of items that have been inserted.

collection-name#1

declare  function dml:collection-name($item as item()) as xs:QName external
Gets the name of the collection the given item (node or JSON item) belongs to.

Parameters

item as item()
The item for which to get the name of the collection.

Returns

xs:QName
The name of the collection to which $item belongs.

collection#1

declare  function dml:collection($name as xs:QName) as item()* external
Gets the sequence of nodes or JSON items from a collection.

Parameters

name as xs:QName
The name of the collection.

Returns

item()*
The sequence contained in the given collection.

collection#2

declare  function dml:collection($name as xs:QName, $skip as xs:integer) as item()* external
Gets the sequence of items (nodes or JSON items) from a collection.

Parameters

name as xs:QName
The name of the collection.
skip as xs:integer
The number of collection items to skip.

Returns

item()*
The sub-sequence contained in the given collection.

collection#3

declare  function dml:collection($name as xs:QName, $start as xs:anyURI, $skip as xs:integer) as item()* external
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.

Parameters

name as xs:QName
The name of the collection.
start as xs:anyURI
A reference to the first item to return.
skip as xs:integer
The additional number of items to skip.

Returns

item()*
The sub-sequence from the given collection.

delete-first#1

declare  function dml:delete-first($name as xs:QName) external
Deletes the first item from a collection.

Parameters

name as xs:QName
The name of the collection to delete from.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the first item from the collection.

delete-first#2

declare  function dml:delete-first($name as xs:QName, $number as xs:integer) external
Deletes the first N items from a collection.

Parameters

name as xs:QName
The name of the collection to delete from.
number as xs:integer
The number of items to delete.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the items from the collection.

delete-last#1

declare  function dml:delete-last($name as xs:QName) external
Deletes the last item from a collection.

Parameters

name as xs:QName
The name of the collection to delete from.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the last item from the collection.

delete-last#2

declare  function dml:delete-last($name as xs:QName, $number as xs:integer) external
Deletes the last N items from a collection.

Parameters

name as xs:QName
The name of the collection to delete from.
number as xs:integer
The number of items to delete.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the last N items.

delete#1

declare  function dml:delete($items as item()*) external
Deletes items (nodes or JSON items) from a collection.

Parameters

items as item()
The items in the collection to delete.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the items from their collections.

edit#2

declare  function dml:edit($target as item(), $content as item()) external
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.

Parameters

target as item()
The target item to be edited.
content as item()
The item that serves as an edit goal.

Returns

An empty XDM instance and a pending update list that, once applied, performs the edit.

index-of#1

declare  function dml:index-of($item as item()) as xs:integer external
Gets the position of the given item (node or JSON item) within its collection.

Parameters

item as item()
The item to get the index of.

Returns

xs:integer
The position of $item in its collection.

insert-after#3

declare  function dml:insert-after($name as xs:QName, $pos as item(), $content as item()*) external
Inserts copies of the given items (nodes or JSON items) into a collection at the position directly following the given target item.

Parameters

name as xs:QName
The name of the collection to insert into.
pos as item()
content as item()
The sequence of items whose copies to insert.

Returns

An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.

insert-before#3

declare  function dml:insert-before($name as xs:QName, $target as item(), $content as item()*) external
Inserts copies of the given items (nodes or JSON items) into a collection at the position directly preceding the given target item.

Parameters

name as xs:QName
The name of the collection to insert into.
target as item()
The item in the collection before which $content will be inserted.
content as item()
The sequence of items whose copies to insert.

Returns

An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.

insert-first#2

declare  function dml:insert-first($name as xs:QName, $content as item()*) external
Inserts copies of the given items (nodes or JSON items) at the beginning of the collection.

Parameters

name as xs:QName
The name of the collection to insert into.
content as item()
The sequence of items whose copies to insert.

Returns

An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.

insert-last#2

declare  function dml:insert-last($name as xs:QName, $content as item()*) external
Inserts copies of the given items (nodes or JSON items) at the end of the collection.

Parameters

name as xs:QName
The name of the collection to insert into.
content as item()
The sequence of items whose copies to insert.

Returns

An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.

truncate#1

declare  function dml:truncate($name as xs:QName) external
Deletes the entire contents of a collection.

Parameters

name as xs:QName
The name of the collection whose contents to delete.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the contents.