| 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:01 AM | XQuery & XSLT Built-In & Modules Function Reference
Module: Pipelines
The pipelines module is installed as part of the Content Processing Framework. These functions are used to manage pipelines, which define content processing steps. To use the pipelines module as part of your own XQuery module, include the following line in your XQuery prolog: `import module namespace p = "http://marklogic.com/cpf/pipelines" at "/MarkLogic/cpf/pipelines.xqy";` The library namespace prefix `p` is not predefined in the server. These functions should be executed in the context of the triggers database.
Function Summary
p:action | Construct an action element.
p:collection | Return the name of the collection in which pipelines are stored.
p:condition | Construct a condition element.
p:create | Create a new content processing pipeline.
p:execute | Construct a execute element.
p:get | Find a particular pipeline.
p:get-by-id | Find a particular pipeline.
p:insert | Insert a fully constructed content processing pipeline, returning its unique ID.
p:pipelines | Return all the pipelines.
p:remove | Remove the named pipeline.
p:state-transition | Construct a new state transition element.
p:status-transition | Construct a new status transition element.
Function Detail
p:action(
| $module as xs:string,
| $description as xs:string?,
| $options as element()?
) as element(p:action)
Summary: Construct an action element.
Parameters:
$module : The path to the module to evaluate.
$description : A description of the action.
$options : The options element to pass to the module as the external variable $cpf:options. The options element will be in the namespace of the module.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      p:action("/app/process-workitem.xqy", (), () )
             ===> returns
                <p:action xmlns:p="http:marklogic.com/cpf/pipelines">
                   <p:module>/app/process-workitem.xqy</p:module>
                </p:action>
p:collection( ) as xs:string
Summary: Return the name of the collection in which pipelines are stored.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      p:collection()
          ==> returns "http://marklogic.com/cpf/pipelines"
p:condition(
| $module as xs:string,
| $description as xs:string?,
| $options as element()?
) as element(p:condition)
Summary: Construct a condition element.
Parameters:
$module : The path to the module to evaluate.
$description : A description of the condition.
$options : The options element to pass to the module as the external variable $cpf:options. The options element will be in the namespace of the module.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      let $options :=
         <options xmlns="/app/test-root.xqy">
            <root>workitem</root>
         </options>
      return p:condition("/app/test-root.xqy", (), $options )
             ===> returns
                <p:condition xmlns:p="http:marklogic.com/cpf/pipelines">
                   <p:module>/app/test-root.xqy</p:module>
                   <options xmlns="/app/test-root.xqy">
                     <root>workitem</root>
                   </options>
                </p:condition>
p:create(
| $name as xs:string,
| $description as xs:string,
| $success-action as element(p:action)?,
| $failure-action as element(p:action)?,
| $status-transitions as element(p:status-transition)*,
| $state-transitions as element(p:state-transition)*
) as xs:unsignedLong
Summary: Create a new content processing pipeline.
Parameters:
$name : The name of the pipeline. It must be unique.
$description : A description of the pipeline.
$success-action : The default action for successful transitions. If none is provided the system default success action will be used. Create using p:action.
$failure-action : The default action for failed transitions. If none is provided the system default failure action will be used. Create using p:action.
$status-transitions : Status transition definitions. There should be exactly one status transition for the statuses "created", "deleted", and "updated". Create using p:status-transition.
$state-transitions : State transition definitions. There should be at most one state transition for a given state. Create using p:state-transition.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      let $init-state := xs:anyURI("http://example.com/states/init")
      let $error-state := xs:anyURI("http://example.com/states/error")
      return
      p:create( "Empty", "No nothing much", (), (),
                ( p:status-transition("created", "",
                                      $init-state,
    				  $error-state,
    				  (), (), () ),
    	      p:status-transition("deleted", "",
    	                          (),
    	                          $error-state,
    				  (), (), () ),
    	      p:status-transition("updated", "",
    				  (),
    				  $error-state,
    				  (), (), () )
                 ), ()
              )
p:execute(
| $condition as element(p:condition)?,
| $action as element(p:action)?,
| $description as xs:string?
) as element(p:execute)
Summary: Construct a execute element.
Parameters:
$condition : The condition to execute to test whether this rule applies. If no condition is specified, the action always executes.
$action : The action to execute should this rule apply. If no action is specified, the default success action will execute instead.
$description : A description of the rule.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      let $options :=
         <options xmlns="/app/test-root.xqy">
            <root>workitem</root>
         </options>
      return
      p:execute( p:condition("/app/test-root.xqy", (), $options ), (),
                 "Execute default action on workitems."
               )
p:get(
| $pipeline-name as xs:string
) as element(p:pipeline)
Summary: Find a particular pipeline.
Parameters:
$pipeline-name : The name of the pipeline to get. An error is raised if no such pipeline exists.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      p:get( "Link Maintenance" )
p:get-by-id(
| $pipeline-id as xs:unsignedLong
) as element(p:pipeline)
Summary: Find a particular pipeline.
Parameters:
$pipeline-id : The ID of the pipeline to get. An error is raised if no such pipeline exists.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";
      import module namespace dom = "http://marklogic.com/cpf/domains"
    		  at "/MarkLogic/cpf/domains.xqy";

      p:get-by-id( dom:get("Default Domain")/dom:pipeline[1] )
p:insert(
| $pipeline-node as node()
) as xs:unsignedLong
Summary: Insert a fully constructed content processing pipeline, returning its unique ID. If a pipeline with the same name already exists in the database, it is replaced.
Parameters:
$pipeline-node : The pipeline definition. Any pipeline-id element will be ignored.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      p:insert( xdmp:get("/pipelines/myapp.xml")/* )
p:pipelines( ) as element(p:pipeline)*
Summary: Return all the pipelines.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      for $pipeline in p:pipelines()
      return $pipeline/p:pipeline-name
p:remove(
| $pipeline-name as xs:string
) as empty-sequence()
Summary: Remove the named pipeline. An error is raised if no such pipeline exists.
Parameters:
$pipeline-name : The name of the pipeline to remove.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      p:remove( "Empty" )
p:state-transition(
| $state as xs:anyURI,
| $description as xs:string,
| $on-success as xs:anyURI?,
| $on-failure as xs:anyURI?,
| $priority as xs:unsignedLong?,
| $default-action as element(p:action)?,
| $rules as element(p:execute)*
) as element(p:state-transition)
Summary: Construct a new state transition element.
Parameters:
$state : The name of the state.
$description : A description of the transition.
$on-success : The successor state, should the transition succeed. If no successor state is defined, the document will remain in its current state.
$on-failure : The successor state, should the transition fail. If no successor state is defined, the document will remain in its current state.
$priority : The priority for this transition. Higher priority transitions will be examined before lower priority ones. If no priority is passed, then the transition gets the highest priority.
$default-action : The default action to execute on entry into this state, if none of the rules apply.
$rules : The execution rules to apply in this transition. The first rule whose condition is true will have its action executed.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      p:state-transition( xs:anyURI("http://example.com/states/review"),
                          "Document review state",
                          (), xs:anyURI("http://example.com/states/error"), (),
                          p:action("/app/send-to-reviewer.xqy",(), ()),
                          () )
p:status-transition(
| $status as xs:string,
| $description as xs:string,
| $on-success as xs:anyURI?,
| $on-failure as xs:anyURI?,
| $priority as xs:unsignedLong?,
| $default-action as element(p:action)?,
| $rules as element(p:execute)*
) as element(p:status-transition)
Summary: Construct a new status transition element.
Parameters:
$status : The status: either "created", "updated", or "deleted".
$description : A description of the transition.
$on-success : The successor state, should the transition succeed. If no successor state is defined, the document will remain in its current state.
$on-failure : The successor state, should the transition fail. If no successor state is defined, the document will remain in its current state.
$priority : The priority for this transition. Higher priority transitions will be examined before lower priority ones. If no priority is passed, then the transition gets the highest priority.
$default-action : The default action to execute on entry into this status, if none of the rules apply.
$rules : The execution rules to apply in this transition. The first rule whose condition is true will have its action executed.
Example:
      xquery version "1.0-ml";
      import module namespace p = "http://marklogic.com/cpf/pipelines"
    		  at "/MarkLogic/cpf/pipelines.xqy";

      p:status-transition("created",
                          "Document creation: Put in initial state.",
                          xs:anyURI("http://example.com/states/initial"), (), (),
                          (), () )

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