{ "ns" : "http://zorba.io/modules/zorba-query", "description" : " This module contains functions to compile and evaluate queries\n written in either JSONiq or XQuery. Also, it contains function that\n allow to parameterize the static or dynamic evaluation phase.\n", "sees" : [ ], "authors" : [ "
This function binds the context-item of the prepared query\n identified by the given key to the $dot argument.
\n", "summary" : "This function binds the context-item of the prepared query\n identified by the given key to the $dot argument.
", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "This function binds the variable with name $name of\n the prepared query identified by $query-key to the given sequence.
\n", "summary" : "This function binds the variable with name $name of\n the prepared query identified by $query-key to the given sequence.
", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "Deletes the prepared query associated with the given identifier.
\nAfter the query is deleted, the corresponding identifier should\n not be used as argument to any of the functions of this module.
\n", "summary" : "Deletes the prepared query associated with the given identifier.
", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "Evaluates the given prepared query and returns the result\n of the evaluation. The query must be sequential.
\n", "summary" : "Evaluates the given prepared query and returns the result\n of the evaluation.
", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:string", "occurence" : null, "description" : "Evaluates the given prepared query and applies the updates\n computed by this query. The query must be an updating query.
\n", "summary" : "Evaluates the given prepared query and applies the updates\n computed by this query.
", "annotation_str" : "", "annotations" : [ ], "updating" : true, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "Evaluates the given prepared query and returns the result\n of the evaluation. The query must not be sequential or\n updating.
\n", "summary" : "Evaluates the given prepared query and returns the result\n of the evaluation.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "The function returns the names of the external variables that\n are declared in the given query (either in the main module or\n in any of the imported library modules).
\n", "summary" : "The function returns the names of the external variables that\n are declared in the given query (either in the main module or\n in any of the imported library modules).
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "The function tests if the context-item is bound for the\n execution of the query referred to by the given query identifier.
\n", "summary" : "The function tests if the context-item is bound for the\n execution of the query referred to by the given query identifier.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "The function tests if the given variable is bound for the\n execution of the query referred to by the given query identifier.
\n", "summary" : "The function tests if the given variable is bound for the\n execution of the query referred to by the given query identifier.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "The function tests if the query identified by the given key\n is sequential query.
\n", "summary" : "The function tests if the query identified by the given key\n is sequential query.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "The function tests if the query identified by the given key\n is an updating query.
\n", "summary" : "The function tests if the query identified by the given key\n is an updating query.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "The function loads a given query for execution from a\n xs:base64Binary query plan, obtained through the zq:query-plan function.
\nIf the query was successfully loaded, the function returns an\n identifier as xs:anyURI. This URI can be passed to other functions\n of this module (e.g. to actually evaluate the query). The URI\n is opaque and its lifetime is bound by the lifetime of the query\n that invoked this function. Further reference or uses\n of the identifier lead to unexpected results.
\n\n
Successfully prepared queries need to be deleted by passing the resulting\n identifier to the zq:delete-query function of this module.
\n", "summary" : "The function loads a given query for execution from a\n xs:base64Binary query plan, obtained through the zq:query-plan function.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "plan", "type" : "xs:base64Binary", "occurence" : null, "description" : "The function loads a given query for execution from a\n xs:base64Binary query plan, obtained through the zq:query-plan function.
\nIf the query was successfully loaded, the function returns an\n identifier as xs:anyURI. This URI can be passed to other functions\n of this module (e.g. to actually evaluate the query). The URI\n is opaque and its lilfetime is bound by the lifetime of the query\n that invoked this function. Further reference or uses\n of the identifier lead to unexpected results.
\n\n
For important notes regarding the second and third parameters of the\n function, review the comments in zq:prepare-main-module#3.
\n\n
Successfully prepared queries need to be deleted by passing the resulting\n identifier to the zq:delete-query function of this module.
\n", "summary" : "The function loads a given query for execution from a\n xs:base64Binary query plan, obtained through the zq:query-plan function.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "plan", "type" : "xs:base64Binary", "occurence" : null, "description" : "This function compiles a given XQuery or JSONiq library module.\n It can be used to compile-check a module.
\n", "summary" : "This function compiles a given XQuery or JSONiq library module.
", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "library-module-text", "type" : "xs:string", "occurence" : null, "description" : "The function prepares a given a query for execution.
\nIf the query was successfully compiled, the function returns an\n identifier as xs:anyURI. This URI can be passed to other functions\n of this module (e.g. to actually evaluate the query). The URI\n is opaque and its lifetime is bound by the lifetime of the query\n that invoked this function. Further reference or uses\n of the identifier lead to unexpected results.
\n\n
Successfully prepared queries need to be deleted by passing the resulting\n identifier to the zq:delete-query function of this module.
\n", "summary" : "The function prepares a given a query for execution.
", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "main-module-text", "type" : "xs:string", "occurence" : null, "description" : "The function prepares a given query for execution.
\nIf the query was successfully compiled, the function returns an\n identifier as xs:anyURI. This URI can be passed to other functions\n of this module (e.g. to actually evaluate the query). The URI\n is opaque and its lifetime is bound by the lifetime of the query\n that invoked this function. Further reference or uses\n of the identifier lead to unexpected results.
\n\n
Important notes regarding the second and third parameters of the function:
\n--------------------------------------------------------------------------
\n\n
These parameters allow you to specify a URL resolver and a URI mapper\n for Zorba to use when executing this query. See\n here
\n\n
The function must return the empty sequence when the specified $namespace\n or $entity are not the ones to be resolved.
\n\n
Example:
\n\n
declare function mymod:url-resolver($namespace as xs:string, $entity as xs:string) as item()?\n {\n if($namespace = 'http://test.xq')\n then \"module namespace test = 'http://test'; declare function test:foo(){'foo'};\"\n else ()\n };\n
\n
The URL resolver function's namespace, name, and parameter naming are\n not restricted by ZQ.
\n\n
The URL resolver function's return type is not restricted, it could be a string, a sequence,\n a node, etc. All the outputs types are to be serialized as a string.
\n\n
The third parameter is a function item for a URI mapper.
\nThe URI mapper must return an empty sequence when the specified $namesapce or $entity\n are not to be mapped. Unlike the URL resolver this function must return a sequence of strings.
\n\n
Example:
\n\n
declare function mymod:uri-mapper($namespace as xs:string, $entity as xs:string)\n {\n if($namespace = 'http://test')\n then (\"http://zorba.io/test\", \"http://foo.com/schema/test\")\n else ()\n };\n
\n
The URI mapper function's namespace, name, and parameter naming are\n not restricted by ZQ.
\n\n
In order to pass the above URL resolver and URI mapper to this function,\n use the following syntax:
\n\n
variable $queryID := zq:prepare-main-module(\"..query text..\",\n mymod:url-resolver#2, mymod:uri-mapper#2);\n
\n
That is, the QName of the function followed by \"#2\". This is XQuery\n \"higher-order function\" syntax, meaning the function with the specified\n QName which takes two arguments. Since URL resolvers and URI mappers\n must take two arguments, both will always be specified with \"#2\".
\n\n
Both the URL resolver and URI mapper functions are optional, meaning you\n may pass the empty-sequence () for either.
\n\n
Successfully prepared queries need to be deleted by passing the resulting\n identifier to the zq:delete-query function of this module.
\n", "summary" : "The function prepares a given query for execution.
", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "main-module-text", "type" : "xs:string", "occurence" : null, "description" : "Returns the compiled query identified by the given query-key\n as binary data.
\n", "summary" : "Returns the compiled query identified by the given query-key\n as binary data.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "This function returns the value of a variable that is bound in the\n given query.
\n", "summary" : "This function returns the value of a variable that is bound in the\n given query.
", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "query-key", "type" : "xs:anyURI", "occurence" : null, "description" : "