Executing a Query

Command

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

Command Line Options

 -O N          : Optimization Level. Default: Full Optimization
 -compileonly  : Compile the query and stop
 -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
 -x            : Bind an external variable

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-incubating/vxquery-cli/target/appassembler/bin/vxq test.xq