Loading TOC...

MarkLogic 12 Product Documentation
op:call

op:call(
   $moduleUri as string,
   $functionName as string,
   [$args as string]
) as map:map

Summary

This function calls a built-in function on every row.

The call() function is needed only for built-in functions that aren't already supported by the Optic expression functions that appear in the Value Processing Functions list.

Use the call() function with care and only for functions that transform values without side effects. Some builtins could adversely affect performance, create deadlocks through the need for update transactions, or worse. The following restrictions apply to the op.call() function:

Parameters
$moduleUri The URI of the function module.
$functionName The function name.
$args The function arguments.

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-literals(map:entry("row", 1))
  =>op:bind(op:as('hostName', op:call('http://marklogic.com/xdmp', 'host-name')))
  =>op:bind(op:as('version',  op:call('http://marklogic.com/xdmp', 'version')))
  =>op:result()
  

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-view("main", "employees")
	   => op:select(("EmployeeID",
                op:as("callcheck",
                      op:call("http://www.w3.org/2005/xpath-functions",
                              "concat",
                              json:to-array((op:col("EmployeeID"), "_x"))
	              ))))
	   => op:result()
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.