| 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 6:02 AM | XQuery & XSLT Built-In & Modules Function Reference
Module: Plugin
The Plugin API module contains functions that allow you to register plugins for use by MarkLogic Server. The Plugin API is installed as the following file: `install_dir/Modules/MarkLogic/plugin/plugin.xqy` where `install_dir` is the directory in which MarkLogic Server is installed. To use the `plugin.xqy` module in your own XQuery modules, include the following line in your XQuery prolog:
       import module namespace plugin = "http://marklogic.com/extension/plugin"
          at "/MarkLogic/plugin/plugin.xqy";
The library uses the `plugin:` namespace, which is not predefined in the server. MarkLogic recommends enabling the URI Lexicon when using Plugin; the URI lexicon will improve performance, especially when the database grows to a large number of documents.
Function Summary
plugin:capability | This function returns a function pointer implementing a given capability from a particular plugin.
plugin:enumerate | This function enumerates functions implementing all capabilities supported by the given plugin.
plugin:implementations | This function returns a map referencing all of the plugins that implement the specified capability.
plugin:plugins | This function returns unique IDs of the registered plugins that have the specified capabilities.
plugin:register | This function registers the capabilities map for use by MarkLogic Server.
Function Detail
plugin:capability(
| $capability as xs:string,
| $uri as xs:string
) as xdmp:function?
Summary: This function returns a function pointer implementing a given capability from a particular plugin. If the plugin doesn't exist an exception is thrown. If the plugin does exist but the capability isn't present, an empty sequence is returned.
Parameters:
$capability : The desired capability to match.
$uri : The unique identifier of the plugin.
Example:
      xquery version "1.0-ml";

      import module namespace plugin = "http://marklogic.com/extension/plugin"
          at "/MarkLogic/plugin/plugin.xqy";

      plugin:capability(
         "http://marklogic.com/appservices/infostudio/collector/cancel",
         "plugin:collector-filescan.xqy")

      (: Returns a pointer to the function that implements the 'cancel' capability. :)
plugin:enumerate(
| $uri as xs:string
) as map:map
Summary: This function enumerates functions implementing all capabilities supported by the given plugin. It returns a map, keyed on the capabilities.
Parameters:
$uri : The unique identifier of the plugin.
Example:
      xquery version "1.0-ml";

      import module namespace plugin = "http://marklogic.com/extension/plugin"
          at "/MarkLogic/plugin/plugin.xqy";

      plugin:enumerate("plugin:collector-filescan.xqy")

      (: Returns the capabilities map for the filescan collector. :)
plugin:implementations(
| $capability as xs:string
) as map:map
Summary: This function returns a map referencing all of the plugins that implement the specified capability. If no plugins implement the given capability, returns an empty map.
Parameters:
$capability : The desired capability to match.
Example:
      xquery version "1.0-ml";

      import module namespace plugin = "http://marklogic.com/extension/plugin"
          at "/MarkLogic/plugin/plugin.xqy";

      plugin:implementations(
         "http://marklogic.com/appservices/infostudio/collector/cancel")

      (: Returns a pointer to the function that implements the 'cancel' capability
         for each plugin that implements 'cancel'. :)
plugin:plugins(
| $capability as xs:string*
) as xs:string*
Summary: This function returns unique IDs of the registered plugins that have the specified capabilities. If no matching plugins are registered, an empty sequence is returned.
Parameters:
$capability : A list of strings representing desired capabilities to match. The plugin must match all of the listed capabilities. Specify an empty sequence to return the IDs of all of the plugins.
Example:
      xquery version "1.0-ml";

      import module namespace plugin = "http://marklogic.com/extension/plugin"
          at "/MarkLogic/plugin/plugin.xqy";

      plugin:plugins("http://marklogic.com/appservices/infostudio/collector/abort")

      (: Lists all collector plugins with the 'abort' capability. :)
plugin:register(
| $capabilities as map:map,
| $plugin-uri as xs:string
) as xs:string
Summary: This function registers the capabilities map for use by MarkLogic Server.
Parameters:
$capabilities : The map of capabilities to be registered.
$plugin-uri : An identifier that uniquely identifies this plugin. If a plugin is added with the same identifier an existing plugin, then the newly registered plugin will be used.
Required Privilege: `http://marklogic.com/xdmp/privileges/plugin-register`
Example:
      xquery version "1.0-ml";

      declare namespace testdoc = "http://marklogic.com/extension/plugin/testdoc";

      import module namespace plugin = "http://marklogic.com/extension/plugin"
          at "/MarkLogic/plugin/plugin.xqy";

      declare function testdoc:capabilities()
      as map:map
      {
        let $map := map:map()
        let $_ := map:put($map, "http://marklogic.com/appservices/infostudio/collector/model",
                           xdmp:function(xs:QName("testdoc:model")))
        let $_ := map:put($map, "http://marklogic.com/appservices/infostudio/collector/start",
                           xdmp:function(xs:QName("testdoc:start")))
        let $_ := map:put($map, "http://marklogic.com/appservices/infostudio/collector/config-view",
                           xdmp:function(xs:QName("testdoc:view")))
        let $_ := map:put($map, "http://marklogic.com/appservices/infostudio/collector/cancel",
                           xdmp:function(xs:QName("testdoc:cancel")))
        let $_ := map:put($map, "http://marklogic.com/appservices/infostudio/collector/abort",
                           xdmp:function(xs:QName("testdoc:abort")))
        let $_ := map:put($map, "http://marklogic.com/appservices/infostudio/collector/validate",
                           xdmp:function(xs:QName("testdoc:validate")))
        let $_ := map:put($map, "http://marklogic.com/appservices/string",
                           xdmp:function(xs:QName("testdoc:string")))
        return $map
      };

      (: Implement the functions in the capabilities map. :)

      plugin:register(testdoc:capabilities(), "testdoc.xqy")

      (: Registers the capabilities in the map for this plugin. :)

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