configast:apply( $source as item() ) as the output, if any, from the functions of the Admin API
This function takes the Config AST representation of a server configuration for parsing and processing as a JSON object or XQuery map and applies the configuration using the functions of the Admin API.
Parameters | |
---|---|
source | The JSON object or map with the Config AST representation of the server configuration. |
The Config AST builds the configurations with the same functions used in the Admin API.
Namespaces are all predefined including the admin
namespace for the Admin API
functions.
The final operation in the AST returns the output.
The JSON format of the Config AST is similar to the JSON format of the Optic AST.
{"$config":[...]}
in the Config AST
where the top object is {"$optic":{...}}
in the Optic AST.$config
property can take an array of declarations in the Config AST.
The $optic
property takes only a single chaining object (described below)
in the Optic AST.{"ns":"op", "fn":"constdefs", "args":[...]}
object that assigns
constants. Subsequent items in the array can be chaining objects.{"ns":"op", "fn":"operators", "args":[...}]}
chaining object
builds calls to the configuration building functions of the Admin API in the Config AST.
The same chaining object builds calls to the Optic Query operations in the Optic AST.{"ns":"op", "fn":"constref", "args":["...constant name..."]}
object
to produce a value for a call or the final output from the Config AST.import module namespace configAST = "http://marklogic.com/config-ast-json" at "/MarkLogic/builder/config-ast-json.xqy"; configAST:apply(' {"$config":[ {"ns":"op", "fn":"constdefs", "args":[ {"name":"db", "value":{"ns":"xdmp", "fn":"database", "args":["Documents"]}}, {"name":"cfg", "value":{"ns":"admin", "fn":"get-configuration", "args":[]}}, {"name":"out", "value":{"ns":"map", "fn":"entry", "args":[ "phrase", {"ns":"admin", "fn":"database-get-fast-phrase-searches", "args":[ {"ns":"op", "fn":"constref", "args":["cfg"]}, {"ns":"op", "fn":"constref", "args":["db"]} ]} ]}} ]}, {"ns":"op", "fn":"constref", "args":["out"]} ]} ')
import module namespace configAST = "http://marklogic.com/config-ast-json" at "/MarkLogic/builder/config-ast-json.xqy"; configAST:apply(' {"$config":[ {"ns":"op", "fn":"constdefs", "args":[ {"name":"db", "value":{"ns":"xdmp", "fn":"database", "args":["Documents"]}}, {"name":"cfg", "value":{"ns":"admin", "fn":"get-configuration", "args":[]}}, {"name":"out", "value":{"ns":"map", "fn":"entry", "args":[ "phrase", {"ns":"admin", "fn":"database-get-fast-phrase-searches", "args":[ {"ns":"op", "fn":"constref", "args":["cfg"]}, {"ns":"op", "fn":"constref", "args":["db"]} ]} ]}} ]}, {"ns":"op", "fn":"constref", "args":["out"]} ]} ')