Mark Logic Command: query

query runs an 'ad hoc' xquery on a on a Mark Logic server.
"Ad hoc" means the query from the local system, but the context (xml data) comes from the Mark Logic server.

Synopsis

query [options] [query] [varname value [varname value ...]]

Description

Invokes a script (xquery file) residing on a Mark Logic server.
Optionally passing in variable (parameters) to the script.

Options


-c,connect uriUse the connection string instead of $MLCONNECT
-tOutput result as text (instead of xml).
-vAssign variables (parameters) from the remaining arguments
-q scriptxquery to run passed as an argument
-f scriptfilefile containing the xquery.
-b,-boolNo output. Returns with the effective boolean value


If neither -q or -f is specified then the first argument after any options is taken to be the query string.
if -b is specified then no output. Exits (return value) with 0 if the effective boolean value is true, otherwise 1


Examples

Assuming the prefix "ml" is imported as the marklogic module, invoke the local xquery file "test.xq" script on the server passing in a parameter "id" with the value "123"

ml:query -v -f test.xq id 123


Run a simple query specified on the command line
ml:query -q "'Hello World'"



Test if a document exists
ml:query -b "exists(doc('/foo/bar'))" && echo document /foo/bar/ exists







MarkLogic Extension Module

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki