http://zorba.io/modules/store/documents

View as XML or JSON.

This module defines a set of functions which manage documents that are persisted in the store. Specifically, it contains functions to put, remove, list, or retrieve documents.

Please refer to our documentation for more information about the lifecycle management and manipulation of documents.

Function Summary

available-documents () as xs:string* external

Retrieves a sequence of URIs of documents bound in the store.

document ($uri as xs:string) as document() external

Gets the document with the given URI from the store.

is-available-document ($uri as xs:string) as xs:boolean external

Returns true if a document with the given URI exists in the store.

put ($uri as xs:string, $doc as document()) external

Adds a document to the store.

remove ($uri as xs:string) external

Removes the document with the given URI from the store.

Functions

available-documents#0

declare  function doc:available-documents() as xs:string* external
Retrieves a sequence of URIs of documents bound in the store.

Parameters

Returns

xs:string*
The list of URIs of the available documents in the store or the empty sequence if none.

document#1

declare  function doc:document($uri as xs:string) as document() external
Gets the document with the given URI from the store. The difference to fn:doc is that this function does not attempt to retrieve the resource from the file system or the web before returning it. Its only responsibility is to return the document from the store that was bound using fn:put or doc:put.

Parameters

uri as xs:string
The URI of the document to retrieve. If a relative URI is given, the URI is made absolute using the static base URI of the module.

Returns

document()
Returns the document bound to the given URI.

is-available-document#1

declare  function doc:is-available-document($uri as xs:string) as xs:boolean external
Returns true if a document with the given URI exists in the store.

Parameters

uri as xs:string
The URI of the document to check for. If a relative URI is given, the URI is made absolute using the static base URI of the module.

Returns

xs:boolean
Returns true if a document with the given URI exists in the store or false otherwise.

put#2

declare  function doc:put($uri as xs:string, $doc as document()) external
Adds a document to the store. The document is bound to the URI given as first parameter. This URI is the name of the document and can be used by the doc:document() function to retrieve the document from the store.

The semantics of the function is similar to the fn:put() function. The difference is that this function accepts only document nodes as parameters. Please note that this function does not try to fetch the document from the external resource identified by the URI. Instead, the file or http-client modules can be used to retrieve the resource as string and fn:parse-xml() can be used to parse the string returning a document.

Parameters

uri as xs:string
The URI of the document. If a relative URI is given, the URI is made absolute using the static base URI of the module.
doc as document()
The document node to be added to the store.

Returns

An empty XDM instance and a pending update list that, when applied, adds the given document to the store.

remove#1

declare  function doc:remove($uri as xs:string) external
Removes the document with the given URI from the store.

Parameters

uri as xs:string
The URI of the document to remove. If a relative URI is given, the URI is made absolute using the static base URI of the module.

Returns

Returns an empty XDM instance and a pending update list that, when applied, removes the document bound to the given URI.