Database Reference
In-Depth Information
(see json ) and JSONP XQuery (see jsonp )—work in much the same way as the JSON
serializer. The third module, XQJSON (see xqjson ), which was written by John Snel‐
son and adapted by Joe Wictenowski, is the newest JSON addition to eXist; it allows
you to serialize XML to JSON as well as parse JSON back into XML so that you can
round-trip your data.
Controlling XQuery Execution
There are several mechanisms which give you control over the execution of your
XQuery scripts.
eXist XQuery Pragmas
With XQuery pragmas, you can set implementation-specific options for parts of your
code. The general syntax is:
(# pragmaname #) {
(: Your XQuery code block :)
}
eXist has the following pragmas:
exist:batch-transaction
Provides a way to combine multiple updates on the database into a single trans‐
action. Only works for updates done through eXist's XQuery update extension.
For example:
(# exist:batch-transaction #) {
update delete $ document / * / LogEntry [ position () ge 10 ],
update insert $ new-entry preceding $ document / * / LogEntry [ 1 ]
}
exist:force-index-use
Useful for debugging index usage (see Chapters Chapter 11 and Chapter 12 ).
Will raise an error if there is no index available for the given XQuery expression.
This can help you to check whether indexes are correctly defined.
exist:no-index
Prevents the use of indexes on the given XQuery expression. Useful for debug‐
ging or for curiosity purposes (“How long does my query take without
indexes?”). Also, sometimes it is more efficient to run without indexes than with
—for instance, when a search isn't very selective.
exist:optimize
Enables optimization for the given XQuery expression. If you've turned optimi‐
zation off (with declare option exist:optimize "enable=no"; , as discussed
Search WWH ::




Custom Search