Database Reference
In-Depth Information
Event
XQuery function name
Java function name
after-copy-document
afterCopyDocument
Move document
before-move-document
beforeMoveDocument
after-move-document
afterMoveDocument
Delete document
before-delete-document beforeDeleteDocument
after-delete-document
afterDeleteDocument
Table 16-4. Naming convention for collection trigger events
Event XQuery function name Java function name
Create collection before-create-collection beforeCreateCollection
after-create-collection afterCreateCollection
Copy collection before-copy-collection beforeCopyCollection
after-copy-collection afterCopyCollection
Move collection before-move-collection beforeMoveCollection
after-move-collection afterMoveCollection
Delete collection before-delete-collection beforeDeleteCollection
after-delete-collection
afterDeleteCollection
XQuery Triggers
When implementing an XQuery Trigger in eXist, you have two main options:
• Store the XQuery into an XQuery library module in the database and reference it
by URI in a parameter to the XQueryTrigger called url in the collection
configuration.
• Write the XQuery code into a parameter to the XQueryTrigger called query in
the collection configuration.
While both options are available to the developer, we would advise taking the first
approach and storing your XQuery code for your trigger into the database. This is the
approach we will cover in this chapter. This enables you to store your code separately
from your configuration, which means that you can reuse this trigger in multiple col‐
lection configurations. In addition, it means that you can test your trigger code inde‐
pendently by writing an XQuery that imports your trigger module and calls your
functions.
 
Search WWH ::




Custom Search