dba/queries  library module
RA

Summary

Open query.
Authors
  • Christian Grün, BaseX Team 2005-23, BSD License
Related documents
ViewDescriptionFormat
xqdocxqDoc xml file from the source modulexml
xqparsexqparse xml file from the source modulexml

Imports

This module is imported by 0 modules. It imports 1 modules.

(None)
imports
dba/queries
imports

Variables

None

Functions

4.1 dba:query-open

Arities: #1RA

Summary
Returns the contents of a query file.
Signatures
dba:query-open ( $name as xs:string ) as xs:string
Parameters
  • name as xs:string name of query file
Return
  • xs:string query string
Invoked by 0 functions from 0 modules
    Annotations (3)
    %rest:path('/dba/query-open')
    %rest:query-param('name','{$name}')
    %output:method('text')
    Source ( 6 lines)
    function dba:query-open(
      $name  as xs:string
    ) as xs:string {
      config:query($name),
      file:read-text(config:directory() || $name)
    }

    Namespaces

    The following namespaces are defined:

    PrefixUri
    configdba/config
    dbadba/queries 2 3 4 5
    filehttp://expath.org/ns/file
    outputhttp://www.w3.org/2010/xslt-xquery-serialization
    resthttp://exquery.org/ns/restxq
    xshttp://www.w3.org/2001/XMLSchema

    6 RestXQ

    Paths defined 1.

    PathMethodFunction
    /dba/query-opendba:query-open#1

    Source Code

    (:~
     : Open query.
     :
     : @author Christian Grün, BaseX Team 2005-23, BSD License
     :)
    module namespace dba = 'dba/queries';
    
    import module namespace config = 'dba/config' at '../lib/config.xqm';
    
    (:~
     : Returns the contents of a query file.
     : @param  $name  name of query file
     : @return query string
     :)
    declare
      %rest:path('/dba/query-open')
      %rest:query-param('name', '{$name}')
      %output:method('text')
    function dba:query-open(
      $name  as xs:string
    ) as xs:string {
      config:query($name),
      file:read-text(config:directory() || $name)
    };