trgr functions

The table below lists all the trgr built-in functions (in this namespace: http://marklogic.com/xdmp/triggers).

The triggers function module is installed as the following file:

where install_dir is the directory in which MarkLogic Server is installed.

To use the triggers.xqy module in your own XQuery modules, include the following line in your XQuery prolog:

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

The triggers module is used for manually creating and managing triggers. If you use the Content Processing Framework, it automatically creates and manages the triggers.

The function to create a new trigger, trgr:create-trigger , uses the other trigger functions to construct the trigger XML document and insert it into the triggers database. The trigger functions should all be run against the triggers database of the database in which the content is stored.

For more information on using triggers, see "Using Triggers to Spawn Actions" in the Application Developer's Guide.

28 functions
Function name Description
trgr:any-property-content Returns the XML representation of an all-properties part to a triggering event, usable as the content parameter of a trigger event constructor such as trgr:trigger-data-event .
trgr:collection-scope Returns the XML representation of a collection scope, usable as the scope parameter of a trigger event constructor such as trgr:trigger-data-event .
trgr:create-trigger Creates a new trigger in the context database.
trgr:directory-scope Returns the XML representation of a directory scope, usable as the scope parameter of a trigger event constructor such as trgr:trigger-data-event .
trgr:document-content Returns the XML representation of a document part of a triggering event, usable as the content parameter of a trigger event constructor such as trgr:trigger-data-event .
trgr:document-scope Returns the XML representation of a document scope, usable as the scope parameter of a trigger event constructor such as trgr:trigger-data-event .
trgr:get-trigger Returns the XML representation of a trigger with the given name.
trgr:get-trigger-by-id Returns the XML representation of the trigger with the given trigger id.
trgr:post-commit Returns the XML representation of a post-commit trigger timing.
trgr:pre-commit Returns the XML representation of a pre-commit trigger timing.
trgr:property-content Returns the XML representation of a property part to a triggering event, usable as the content parameter of a trigger event constructor such as trgr:trigger-data-event .
trgr:remove-trigger Removes the named trigger.
trgr:trigger-add-permissions Adds permissions to the set of permissions on the named trigger.
trgr:trigger-data-event Returns the XML representation of a triggering eventa, usable as the event parameter of trgr:create-trigger .
trgr:trigger-database-online-event Returns the XML representation of a database coming online event, usable as the event parameter of trgr:create-trigger .
trgr:trigger-disable Disables the named trigger.
trgr:trigger-enable Enables the named trigger.
trgr:trigger-get-permissions Returns the permissions for the named trigger.
trgr:trigger-module Returns the XML representation of a trigger module which can be used as the module parameter of trgr:create-trigger .
trgr:trigger-remove-permissions Removes a set of permissions from the set of permissions on the named trigger.
trgr:trigger-set-description Sets the description of the named trigger.
trgr:trigger-set-event Assigns a triggering event to the named trigger.
trgr:trigger-set-module Sets or replaces the action module associated with the named trigger.
trgr:trigger-set-name Changes the name of a trigger.
trgr:trigger-set-permissions Sets the permissions that determine which roles are permitted to modify the named trigger.
trgr:trigger-set-recursive Sets the recursive setting of the identified trigger.
trgr:trigger-set-task-priority Sets the task priority setting of the identified trigger.
trgr:triggers-change-modules-database This function changes the trigger definitions of each trigger definition in the database that has the database ID $old-db and replaces each database ID with $new-db.
Powered by MarkLogic Server | Terms of Use | Privacy Policy