| XQUERY/XSLT API DOCUMENTATION 4.2 |
All XQuery & XSLT Functions MarkLogic Built-In Functions Admin (xdmp:) AppServer (xdmp:) Classifier (cts:) Debug (dbg:) Document Conversion (xdmp:) Extension (xdmp:) Documents, Directories, Properties, and Locks Functions Extension Functions Function Values Functions HTTP Functions JSON Functions MarkLogic Server Functions Search Functions XML Functions XQuery Context Functions XSLT Functions map (map:) Math (math:) Profile (prof:) Search (cts:) cts:query Constructors Functions Geospatial Functions Geospatial Lexicon Functions Lexicon Functions Search Functions Search Clustering Functions Security (xdmp:) Server Monitoring (xdmp:) Spell (spell:) Update (xdmp:) XQuery Library Modules Admin Library (admin:) Actions Functions Appserver Functions Database Functions Forest Functions Group Functions Host Functions Mimetypes Functions Scheduler Functions Alerting (alert:) Elastic Compute Cloud (ec2:) Entity Enrichment (entity:) Flexible Replication (flexrep:) Geospatial Supporting Functions GEO Functions GeoRSS Functions GML Functions KML Functions MCGM Functions Information Studio (info:) Information Studio Developer (infodev:) Library Services (dls:) cts:query Constructor Functions Document Management Functions Document Update Functions Retention Policy Functions XInclude Functions Modular Documents XInclude Functions XPointer Functions PKI (pki:) Plugin (plugin:) Search (search:) Security-sec (sec:) Spelling Dictionary Management (spell:) Thesaurus (thsr:) Triggers (trgr:) Triggers Library (trgr:) WordProcessingML (ooxml:) ZIP Package (ooxml:) CPF Functions Content Processing Framework (cpf:) CSS Conversion (css:) DocBook Conversion (dbk:) Domains (dom:) Excel Conversion (excel:) Generic Conversion (cvt:) Links (lnk:) MSWord Conversion (msword:) PDF Conversion (pdf:) Pipelines (p:) Powerpoint Conversion (ppt:) XHTML Conversion (xhtml:) W3C-Standard Functions Accessor (fn:) AnyURI (fn:) Boolean (fn:) Context (fn:) DurationDateTime (fn:) Error and Trace (fn:) Node (fn:) Numeric (fn:) QName (fn:) Sequence (fn:) String (fn:) XSLT (fn:) W3C XQuery/XSLT Reference W3C XQuery Functions W3C XQuery Language W3C XSLT Language
This page was generated September 12, 2012 5:59 AM | XQuery & XSLT Built-In & Modules Function Reference
Module: Admin Library - Scheduler Functions
The Admin module is an XQuery library module that allows you to script administrative tasks that you otherwise would need the Admin Interface to perform. Most functions in this library perform adminstrative tasks and therefore require the user who runs the XQuery program to have the Admin role. Many of these functions provide new configuration information. In most cases, you must save the configuration (with `admin:save-configuration`, for example) in the same statement that you use the functions in order for them to take effect. To use the Admin module as part of your own XQuery module, include the following line in your XQuery prolog: `import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy" ;` The library namespace prefix `admin` is not predefined in the server.
Function Summary
admin:group-add-scheduled-task | This function adds one or more scheduled tasks to the specified group.
admin:group-daily-scheduled-task | This function constructs a task to be invoked at daily intervals.
admin:group-delete-scheduled-task | This function deletes one or more scheduled tasks from the specified group.
admin:group-get-scheduled-tasks | This function returns all of the tasks scheduled for the specified group.
admin:group-hourly-scheduled-task | This function constructs a task to be invoked at hourly intervals.
admin:group-minutely-scheduled-task | This function constructs a task to be invoked at intervals defined in terms of minutes.
admin:group-monthly-scheduled-task | This function constructs a task to be invoked at monthly intervals.
admin:group-one-time-scheduled-task | This function constructs a task to be invoked once, at a specific calendar day and time.
admin:group-weekly-scheduled-task | This function constructs a task to be invoked at weekly intervals.
Function Detail
admin:group-add-scheduled-task(
| $config as element(configuration),
| $group-id as xs:unsignedLong,
| $scheduled-tasks as element(gr:scheduled-task)*
) as element(configuration)
Summary: This function adds one or more scheduled tasks to the specified group.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$group-id : The ID of the group on which the scheduled tasks are configured. Typically, this is the result of an `admin:group-get-id` call.
$scheduled-tasks : One or more scheduled tasks, such as those created by the task-create functions.
Example:
      xquery version "1.0-ml";
      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()

      let $task := admin:group-hourly-scheduled-task(
          "/Scheduler_test.xqy",
          "/Docs",
          2,
          30,
          xdmp:database("Documents"),
          0,
          xdmp:user("Jim"),
          0)

      let $addTask := admin:group-add-scheduled-task($config,
          admin:group-get-id($config, "Default"), $task)

      return
          admin:save-configuration($addTask)

      (: Creates an hourly scheduled task and adds it to the "Default" group. :)
admin:group-daily-scheduled-task(
| $task-path as xs:string,
| $task-root as xs:string,
| $task-period as xs:positiveInteger,
| $task-start-time as xs:time,
| $task-database as xs:unsignedLong,
| $task-modules as xs:unsignedLong,
| $task-user as xs:unsignedLong,
| $task-host as xs:unsignedLong?
) as element(gr:scheduled-task)
Summary: This function constructs a task to be invoked at daily intervals.
Parameters:
$task-path : The name of the module to be invoked. The task path must begin with a forward slash (/) and cannot contain a question mark '?', colon ':' or pound '#' character.
$task-root : The root directory (files system) or URI root (database) that contains the module. For example, if the module is located in the filesystem under MarkLogic/Docs, specify Docs.
$task-period : The number of days to elapse between each invocation of the module.
$task-start-time : The time of day (in 24:00 notation) to invoke the module.
$task-database : The id of the database on which the module is to be invoked.
$task-modules : The id of the modules database. For example, xdmp:database("Modules"). To specify the filesystem, use 0.
$task-user : The id of the user with permission to invoke the module. For example, xdmp:user("Jim").
$task-host : The id of the host on which to invoke the module. Leave empty, (), to specify all hosts.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
         admin:group-daily-scheduled-task(
            "/Scheduler_test.xqy",
            "/Docs",
            2,
            xs:time("09:30:00"),
            xdmp:database("Documents"),
            xdmp:database("Modules"),
            xdmp:user("Jim"),
            0)

      (: returns a daily scheduled task. :)
admin:group-delete-scheduled-task(
| $config as element(configuration),
| $group-id as xs:unsignedLong,
| $scheduled-tasks as element(gr:scheduled-task)*
) as element(configuration)
Summary: This function deletes one or more scheduled tasks from the specified group.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$group-id : The ID of the group on which the scheduled tasks are configured. Typically, this is the result of an `admin:group-get-id` call.
$scheduled-tasks : One or more scheduled tasks.
Example:
      xquery version "1.0-ml";
      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      let $group := admin:group-get-id($config, "Default")
      let $tasks := admin:group-get-scheduled-tasks($config, $group)

      return
       admin:group-delete-scheduled-task($config, $group, $tasks)

      (: Returns a configuration element with the scheduled tasks in the
          "Default" group deleted -- use admin:save-configuration
          to save the changes to the configuration or pass the configuration
          to other Admin API functions to make other changes. :)
admin:group-get-scheduled-tasks(
| $config as element(configuration),
| $group-id as xs:unsignedLong
) as element(gr:scheduled-task)*
Summary: This function returns all of the tasks scheduled for the specified group.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$group-id : The ID of the group on which the scheduled tasks are configured. Typically, this is the result of an `admin:group-get-id` call.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
        admin:group-get-scheduled-tasks($config,
          admin:group-get-id($config, "Default"))

       =>

      <scheduled-task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://marklogic.com/xdmp/group">
        <task-path>/Scheduler_test.xqy</task-path>
        <task-root>/Docs</task-root>
        <task-type>minutely</task-type>
        <task-period>15</task-period>
        <task-days/>
        <task-timestamp>2009-02-27T12:16:06.152-08:00</task-timestamp>
        <task-database>3439178527237237454</task-database>
        <task-modules>0</task-modules>
        <task-user>10677693687367813363</task-user>
      </scheduled-task>
admin:group-hourly-scheduled-task(
| $task-path as xs:string,
| $task-root as xs:string,
| $task-period as xs:positiveInteger,
| $task-minute as xs:nonNegativeInteger,
| $task-database as xs:unsignedLong,
| $task-modules as xs:unsignedLong,
| $task-user as xs:unsignedLong,
| $task-host as xs:unsignedLong?
) as element(gr:scheduled-task)
Summary: This function constructs a task to be invoked at hourly intervals.
Parameters:
$task-path : The name of the module to be invoked. The task path must begin with a forward slash (/) and cannot contain a question mark '?', colon ':' or pound '#' character.
$task-root : The root directory (filesystem) or URI root (database) that contains the module. For example, if the module is located in the filesystem under MarkLogic/Docs, specify Docs.
$task-period : The number of hours to elapse between each invocation of the module.
$task-minute : The number of minutes after the hour to invoke the module. This value must be 59 or less. Note that this setting does not add to the task-period value.
$task-database : The id of the database on which the module is to be invoked.
$task-modules : The id of the modules database. For example, xdmp:database("Modules"). To specify the filesystem, use 0.
$task-user : The id of the user with permission to invoke the module. For example, xdmp:user("Jim").
$task-host : The id of the host on which to invoke the module. Leave empty, (), to specify all hosts.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
         admin:group-hourly-scheduled-task(
             "/Scheduler_test.xqy",
             "/Docs",
             2,
             30,
             xdmp:database("Documents"),
             0,
             xdmp:user("Jim"),
             0)

        (: returns an hourly scheduled task. :)
admin:group-minutely-scheduled-task(
| $task-path as xs:string,
| $task-root as xs:string,
| $task-period as xs:positiveInteger,
| $task-database as xs:unsignedLong,
| $task-modules as xs:unsignedLong,
| $task-user as xs:unsignedLong,
| $task-host as xs:unsignedLong?
) as element(gr:scheduled-task)
Summary: This function constructs a task to be invoked at intervals defined in terms of minutes.
Parameters:
$task-path : The name of the module to be invoked. The task path must begin with a forward slash (/) and cannot contain a question mark '?', colon ':' or pound '#' character.
$task-root : The root directory (filesystem) or URI root (database) that contains the module. For example, if the module is located in the filesystem under MarkLogic/Docs, specify Docs.
$task-period : The number of minutes to elapse between each invocation of the module.
$task-database : The id of the database on which the module is to be invoked.
$task-modules : The id of the modules database. For example, xdmp:database("Modules"). To specify the filesystem, use 0.
$task-user : The id of the user with permission to invoke the module. For example, xdmp:user("Jim").
$task-host : The id of the host on which to invoke the module. Leave empty, (), to specify all hosts.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
         admin:group-minutely-scheduled-task(
            "/Scheduler_test.xqy",
            "/Docs",
            45,
            xdmp:database("Documents"),
            0,
            xdmp:user("Jim"),
            0)

        (: returns a minutely scheduled task. :)
admin:group-monthly-scheduled-task(
| $task-path as xs:string,
| $task-root as xs:string,
| $task-period as xs:positiveInteger,
| $task-month-day as xs:unsignedLong,
| $task-start-time as xs:time,
| $task-database as xs:unsignedLong,
| $task-modules as xs:unsignedLong,
| $task-user as xs:unsignedLong,
| $task-host as xs:unsignedLong?
) as element(gr:scheduled-task)
Summary: This function constructs a task to be invoked at monthly intervals.
Parameters:
$task-path : The name of the module to be invoked. The task path must begin with a forward slash (/) and cannot contain a question mark '?', colon ':' or pound '#' character.
$task-root : The root directory (files system) or URI root (database) that contains the module. For example, if the module is located in the filesystem under MarkLogic/Docs, specify Docs.
$task-period : The number of months to elapse between each invocation of the module.
$task-month-day : The day of the month to invoke the module.
$task-start-time : The time of day (in 24:00 notation) to invoke the module.
$task-database : The id of the database on which the module is to be invoked.
$task-modules : The id of the modules database. For example, xdmp:database("Modules"). To specify the filesystem, use 0.
$task-user : The id of the user with permission to invoke the module. For example, xdmp:user("Jim").
$task-host : The id of the host on which to invoke the module. Leave empty, (), to specify all hosts.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
         admin:group-monthly-scheduled-task(
            "/Scheduler_test.xqy",
            "/Docs",
    	2,
    	3,
    	xs:time("14:42:52"),
            xdmp:database("Documents"),
            0,
            xdmp:user("Jim"),
    	0)

         (: returns a monthly scheduled task. :)
admin:group-one-time-scheduled-task(
| $task-path as xs:string,
| $task-root as xs:string,
| $task-start as xs:dateTime,
| $task-database as xs:unsignedLong,
| $task-modules as xs:unsignedLong,
| $task-user as xs:unsignedLong,
| $task-host as xs:unsignedLong?
) as element(gr:scheduled-task)
Summary: This function constructs a task to be invoked once, at a specific calendar day and time.
Parameters:
$task-path : The name of the module to be invoked. The task path must begin with a forward slash (/) and cannot contain a question mark '?', colon ':' or pound '#' character.
$task-root : The root directory (files system) or URI root (database) that contains the module. For example, if the module is located in the filesystem under MarkLogic/Docs, specify Docs.
$task-start : The date and time on which the task is to start.
$task-database : The id of the database on which the module is to be invoked.
$task-modules : The id of the modules database. For example, xdmp:database("Modules"). To specify the filesystem, use 0.
$task-user : The id of the user with permission to invoke the module. For example, xdmp:user("Jim").
$task-host : The id of the host on which to invoke the module. Leave empty, (), to specify all hosts.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
         admin:group-one-time-scheduled-task(
            "/Scheduler_test.xqy",
            "/Docs",
            xs:dateTime("2009-03-29T14:42:52"),
            xdmp:database("Documents"),
            xdmp:database("Documents"),
            xdmp:user("Jim"),
    	admin:host-get-id($config, xdmp:host-name()))

        (: returns a one-time scheduled task. :)
admin:group-weekly-scheduled-task(
| $task-path as xs:string,
| $task-root as xs:string,
| $task-period as xs:positiveInteger,
| $task-days as xs:string+,
| $task-start-time as xs:time,
| $task-database as xs:unsignedLong,
| $task-modules as xs:unsignedLong,
| $task-user as xs:unsignedLong,
| $task-host as xs:unsignedLong?
) as element(gr:scheduled-task)
Summary: This function constructs a task to be invoked at weekly intervals.
Parameters:
$task-path : The name of the module to be invoked. The task path must begin with a forward slash (/) and cannot contain a question mark '?', colon ':' or pound '#' character.
$task-root : The root directory (files system) or URI root (database) that contains the module. For example, if the module is located in the filesystem under MarkLogic/Docs, specify Docs.
$task-period : The number of weeks to elapse between each invocation of the module.
$task-days : One or more days on the specified week to invoke the module
$task-start-time : The time of day (in 24:00 notation) to invoke the module.
$task-database : The id of the database on which the module is to be invoked.
$task-modules : The id of the modules database. For example, xdmp:database("Modules"). To specify the filesystem, use 0.
$task-user : The id of the user with permission to invoke the module. For example, xdmp:user("Jim").
$task-host : The id of the host on which to invoke the module. Leave empty, (), to specify all hosts.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
         admin:group-weekly-scheduled-task(
            "/Scheduler_test.xqy",
            "/Docs",
            2,
            ("Monday", "Wednesday"),
            xs:time("14:42:52"),
            xdmp:database("Documents"),
            xdmp:database("Documents"),
            xdmp:user("Jim"),
            admin:host-get-id($config, xdmp:host-name()))

         (: returns a weekly scheduled task. :)

© Copyright 2002-2012 MarkLogic Corporation. All rights reserved.