Executing a Query

Command On *nix Based Systems

sh ./apache-vxquery-X.Y/vxquery-cli/target/appassembler/bin/vxq

Commands On Windows Based Systems

set JAVA_OPTS=-Xmx1024m
set PATH=%PATH%;"path-to"\apache-vxquery-X.Y\vxquery-cli\target\appassembler\bin\
vxq "path-to"\test.xq

Command Line Options

Command line options for all systems.

-O N                       : Optimization Level. Default: Full Optimization
-available-processors N    : Number of available processors. (default java's available processors)
-client-net-ip-address VAL : IP Address of the ClusterController
-client-net-port N         : Port of the ClusterController (default 1098)
-compileonly               : Compile the query and stop
-frame-size N              : Frame size in bytes. (default 65536)
-local-node-controllers N  : Number of local node controllers (default 1)
-repeatexec N              : Number of times to repeat execution
-showast                   : Show abstract syntax tree
-showoet                   : Show optimized expression tree
-showquery                 : Show query string
-showrp                    : Show Runtime plan
-showtet                   : Show translated expression tree
-timing                    : Produce timing information
-hdfs-conf VAL             : The folder containing the HDFS configuration files

Java Options

JAVA_OPTS="-Xmx1024m"

Example

The following example query is from W3Schools XQuery Tutorial. If you are new to XQuery, the W3Schools tutorial is a great place to start.

  1. Query file (test.xq)
    for $x in doc("books.xml")/bookstore/book
    where $x/price>30
    order by $x/title
    return $x/title
  2. Command line
    JAVA_OPTS="-Xmx1024m" sh ./apache-vxquery-X.Y/vxquery-cli/target/appassembler/bin/vxq test.xq