Changes

Jump to navigation Jump to search
390 bytes added ,  14:18, 20 July 2022
no edit summary
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:functions||function(*)*}}<br/>{{Func|inspect:functions|$uri as xs:string|function(*)*}}
|-valign="top"
| '''Summary'''
|Returns function items for all user-defined functions (both public and private) that are known in the current query context. If a {{Code|$uri}} is specified, the specified resource will be retrieved as string and compiled, and its functions will be added to the query context and returned to the user. A relative URI will be resolved against the static base URI of the query.
|-valign="top"
|'''Examples'''
|Invokes the declared functions and returns their values:<br/>
return $f()
</syntaxhighlight>
|-valign="top"
| '''Errors'''
|{{Error|parse|#Errors}} Error while parsing a module.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:function-annotations|$function as function(*)?|map(xs:QName, xs:anyAtomicType*)}}<br/>
|-valign="top"
| '''Summary'''
|Returns the annotations of the specified {{Code|$function}} in a map.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:static-context|$function as function(*)?, $name as xs:string|item()*}}<br/>
|-valign="top"
| '''Summary'''
|Returns a component of the [https://www.w3.org/TR/xquery-31/#dt-static-context static context] of a {{Code|$function}} with the specified {{Code|$name}}. If no function is supplied, the current static context is considered.<br/>The following components can be requested:
* {{Code|copy-namespaces}}: Copy-namespaces mode ({{Code|inherit}}/{{Code|no-inherit}}, {{Code|preserve}}/{{Code|no-preserve}})
* {{Code|decimal-formats}}: Nested map with all statically known decimal formats
|-valign="top"
| '''Examples'''
|
inspect:static-context(data:get#1, 'namespaces')
</syntaxhighlight>
|-valign="top"
| '''Errors'''
|{{Error|unknown|#Errors}} The specified component does not exist.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:type|$value as item()*|xs:string}}<br/>{{Func|inspect:type|$value as item()*, $options as map(*)|xs:string}}
|-valign="top"
| '''Summary'''
|Returns a string representation of the type of a {{Code|$value}}:
* {{Code|item}}: If enabled, only the item type is returned and the occurrence indicator is omitted. The default is {{Code|false()}}.
* {{Code|mode}}: If {{Code|value}} is specified, the assigned type of the result value is returned. With {{Code|expression}} the type of the input expression is returned (please note that the original expression may already have been rewritten at compile-time). With {{Code|computed}}, the exact value is computed at runtime, based on the expression and the result value. The default is {{Code|computed}}.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:function|$function as function(*)|element(function)}}
|-valign="top"
| '''Summary'''
|Inspects the specified {{Code|$function}} and returns an element that describes its structure. The output of this function is similar to eXist-db’s [https://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/inspection&location=java:org.exist.xquery.functions.inspect.InspectionModule inspect:inspect-function] function.
|-valign="top"
|'''Examples'''
|The query {{Code|inspect:function(count#1)}} yields:
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:context||element(context)}}
|-valign="top"
| '''Summary'''
|Generates an element that describes all variables and functions in the current query context.
|-valign="top"
| '''Examples'''
|Evaluate all user-defined functions with zero arguments in the query context:<br/>
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:module|$uri as xs:string|element(module)}}
|-valign="top"
| '''Summary'''
|Retrieves the resource located at the specified {{Code|$uri}}, parses it as XQuery module, and generates an element that describes the module's structure. A relative URI will be resolved against the static base URI of the query.
|-valign="top"
|'''Examples'''
|An example is [[#Examples|shown below]].
|-valign="top"
| '''Errors'''
|{{Error|parse|#Errors}} Error while parsing a module.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|inspect:xqdoc|$uri as xs:string|element(xqdoc:xqdoc)}}
|-valign="top"
| '''Summary'''
|Retrieves the resource located at the specified {{Code|$uri}}, parses it as XQuery module, and generates an xqDoc element. A relative URI will be resolved against the static base URI of the query.<br/>[http://xqdoc.org/ xqDoc] provides a simple vendor-neutral solution for generating documentation from XQuery modules. The documentation conventions have been inspired by the JavaDoc standard. Documentation comments begin with {{Code|(:~}} and end with {{Code|:)}}, and tags start with {{Code|@}}. xqDoc comments can be specified for main and library modules and variable and function declarations.<br/>
* a single {{Code|<xqdoc:namespaces/>}} node is added to the root element, which summarizes all prefixes and namespace URIs used or declared in the module.
* name and type elements are added to variables.
|-valign="top"
|'''Examples'''
|An example is [[#Examples|shown below]].
|-valign="top"
| '''Errors'''
|{{Error|parse|#Errors}} Error while parsing a module.
! width="110"|Code
|Description
|-valign="top"
|{{Code|parse}}
|Error while parsing a module.
|-valign="top"
|{{Code|unknown}}
|The specified component does not exist.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu