Difference between revisions of "Command-Line Options"

From BaseX Documentation
Jump to navigation Jump to search
m (Text replace - "{{Mono|" to "{{Code|")
Line 18: Line 18:
 
> _</pre>
 
> _</pre>
  
Available command-line flags can be listed with {{Mono|-h}}:
+
Available command-line flags can be listed with {{Code|-h}}:
 
<pre>
 
<pre>
 
$ basex -h
 
$ basex -h
Line 49: Line 49:
 
! Examples
 
! Examples
 
|- valign="top"
 
|- valign="top"
| {{Mono|[file]}}
+
| {{Code|[file]}}
 
| Executes the specified XQuery file.
 
| Executes the specified XQuery file.
 
|
 
|
 
|- valign="top"
 
|- valign="top"
 
|- valign="top"
 
|- valign="top"
| {{Mono|-b&lt;pars&gt;}}
+
| {{Code|-b&lt;pars&gt;}}
 
| Binds external variables to XQuery expressions. This flag may be specified multiple times. Variables names and their values are delimited by equality signs (<code>=</code>). The names may be optionally prefixed with dollar signs. If a variable uses a namespace different to the default namespace, it can be specified with the [http://www.jclark.com/xml/xmlns.htm Clark Notation] or [http://www.w3.org/TR/xquery-30/#id-basics Expanded QName Notation].
 
| Binds external variables to XQuery expressions. This flag may be specified multiple times. Variables names and their values are delimited by equality signs (<code>=</code>). The names may be optionally prefixed with dollar signs. If a variable uses a namespace different to the default namespace, it can be specified with the [http://www.jclark.com/xml/xmlns.htm Clark Notation] or [http://www.w3.org/TR/xquery-30/#id-basics Expanded QName Notation].
 
| <code>[[Options#BINDINGS|BINDINGS]]</code>
 
| <code>[[Options#BINDINGS|BINDINGS]]</code>
 
| <ul><li><code>-b$v=example -q$v</code></li><li><code>-b{URL}ln=value<br/>-q"declare namespace ns='URL'; $ns:ln"</code></li></ul>
 
| <ul><li><code>-b$v=example -q$v</code></li><li><code>-b{URL}ln=value<br/>-q"declare namespace ns='URL'; $ns:ln"</code></li></ul>
 
|- valign="top"
 
|- valign="top"
| {{Mono|-c&lt;cmd&gt;}}
+
| {{Code|-c&lt;cmd&gt;}}
 
| Runs the specified [[commands]] and quits. Several commands can be separated by semicolons.
 
| Runs the specified [[commands]] and quits. Several commands can be separated by semicolons.
 
|
 
|
| {{Mono|-c"list;info"}}
+
| {{Code|-c"list;info"}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-C&lt;file&gt;}}
+
| {{Code|-C&lt;file&gt;}}
| Runs all [[commands]] from the specified text file and quits. Empty lines and lines starting with the number sign {{Mono|#}} are skipped.
+
| Runs all [[commands]] from the specified text file and quits. Empty lines and lines starting with the number sign {{Code|#}} are skipped.
 
|
 
|
| {{Mono|-C commands.txt}}
+
| {{Code|-C commands.txt}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-d}}
+
| {{Code|-d}}
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| <code>[[Options#DEBUG|DEBUG]]</code>
 
| <code>[[Options#DEBUG|DEBUG]]</code>
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-i&lt;input&gt;}}
+
| {{Code|-i&lt;input&gt;}}
 
| Opens a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression.
 
| Opens a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression.
 
|
 
|
| {{Mono|-iitems.xml -q"//item"}}
+
| {{Code|-iitems.xml -q"//item"}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-L}}
+
| {{Code|-L}}
 
| Add trailing newline after query result. Useful for batch processing or pipelining on Unix systems.  
 
| Add trailing newline after query result. Useful for batch processing or pipelining on Unix systems.  
 
|
 
|
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-o&lt;file&gt;}}
+
| {{Code|-o&lt;file&gt;}}
 
| All command and query output is written to the specified file.
 
| All command and query output is written to the specified file.
 
|
 
|
| {{Mono|-o output.txt}}
+
| {{Code|-o output.txt}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-q&lt;expr&gt;}}
+
| {{Code|-q&lt;expr&gt;}}
 
| Executes the specified string as XQuery expression.
 
| Executes the specified string as XQuery expression.
 
|
 
|
| {{Mono|-q"doc('input')//head"}}
+
| {{Code|-q"doc('input')//head"}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-s&lt;pars&gt;}}
+
| {{Code|-s&lt;pars&gt;}}
 
| Specifies parameters for serializing XQuery results; see [[Serialization]] for more details. This flag may be specified multiple times. Key and values are separated by the equality sign (<code>=</code>).
 
| Specifies parameters for serializing XQuery results; see [[Serialization]] for more details. This flag may be specified multiple times. Key and values are separated by the equality sign (<code>=</code>).
 
| <code>[[Options#SERIALIZER|SERIALIZER]]</code>
 
| <code>[[Options#SERIALIZER|SERIALIZER]]</code>
 
| <code>-smethod=text</code>
 
| <code>-smethod=text</code>
 
|- valign="top"
 
|- valign="top"
| {{Mono|-u}}
+
| {{Code|-u}}
 
| Modifies original files after evaluating XQuery Update expressions.
 
| Modifies original files after evaluating XQuery Update expressions.
 
| <code>[[Options#WRITEBACK|WRITEBACK]]</code>
 
| <code>[[Options#WRITEBACK|WRITEBACK]]</code>
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-v}}
+
| {{Code|-v}}
 
| Prints process and timing information to the ''standard output''.
 
| Prints process and timing information to the ''standard output''.
 
|
 
|
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-V}}
+
| {{Code|-V}}
 
| Prints detailed query information to the ''standard output'', including details on the compilation and profiling steps.
 
| Prints detailed query information to the ''standard output'', including details on the compilation and profiling steps.
 
| <code>[[Options#QUERYINFO|QUERYINFO]]</code>
 
| <code>[[Options#QUERYINFO|QUERYINFO]]</code>
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-w}}
+
| {{Code|-w}}
 
| By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to preserve whitespaces.
 
| By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to preserve whitespaces.
 
| <code>[[Options#CHOP|CHOP]]</code>
 
| <code>[[Options#CHOP|CHOP]]</code>
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-x}}
+
| {{Code|-x}}
 
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
 
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
 
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
 
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-z}}
+
| {{Code|-z}}
 
| Skips the serialization of XQuery results. This flag is useful if the query is profiled or analyzed.
 
| Skips the serialization of XQuery results. This flag is useful if the query is profiled or analyzed.
 
| <code>[[Options#SERIALIZE|SERIALIZE]]</code>
 
| <code>[[Options#SERIALIZE|SERIALIZE]]</code>
Line 130: Line 130:
 
|}
 
|}
  
Multiple query files and {{Mono|-c}}/{{Mono|-i}}/{{Mono|-q}} flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash ({{mono|-}}) as argument.
+
Multiple query files and {{Code|-c}}/{{Code|-i}}/{{Code|-q}} flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash ({{mono|-}}) as argument.
  
 
=BaseX Server=
 
=BaseX Server=
Line 140: Line 140:
 
</pre>
 
</pre>
  
Available command-line flags can be listed with {{Mono|-h}}:
+
Available command-line flags can be listed with {{Code|-h}}:
 
<pre>
 
<pre>
 
$ basexserver -h
 
$ basexserver -h
Line 165: Line 165:
 
! width='165' | Examples
 
! width='165' | Examples
 
|- valign="top"
 
|- valign="top"
| {{Mono|stop}}
+
| {{Code|stop}}
 
| Stops an existing server instance and quits.
 
| Stops an existing server instance and quits.
 
|
 
|
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-c&lt;cmd&gt;}}
+
| {{Code|-c&lt;cmd&gt;}}
 
| Launches database commands before the server itself is started. Several commands can be separated by semicolons.
 
| Launches database commands before the server itself is started. Several commands can be separated by semicolons.
 
|
 
|
 
|
 
|
| {{Mono|-c"open database;info"}}
+
| {{Code|-c"open database;info"}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-d}}
+
| {{Code|-d}}
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| <code>[[Options#DEBUG|DEBUG]]</code>
 
| <code>[[Options#DEBUG|DEBUG]]</code>
Line 182: Line 182:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-e&lt;num&gt;}}
+
| {{Code|-e&lt;num&gt;}}
 
| Specifies the port on which the server will send events to clients.
 
| Specifies the port on which the server will send events to clients.
 
| <code>[[Options#EVENTPORT|EVENTPORT]]</code>
 
| <code>[[Options#EVENTPORT|EVENTPORT]]</code>
| {{Mono|1985}}
+
| {{Code|1985}}
| {{Mono|-e9998}}
+
| {{Code|-e9998}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-i}}
+
| {{Code|-i}}
 
| Starts the interactive console mode, which can be used to enter database commands. This mode is similar to the default standalone and client mode.
 
| Starts the interactive console mode, which can be used to enter database commands. This mode is similar to the default standalone and client mode.
 
|
 
|
Line 194: Line 194:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-p&lt;num&gt;}}
+
| {{Code|-p&lt;num&gt;}}
 
| Specifies the port on which the server will be addressable.
 
| Specifies the port on which the server will be addressable.
 
| <code>[[Options#PORT|PORT]]</code>
 
| <code>[[Options#PORT|PORT]]</code>
| {{Mono|1984}}
+
| {{Code|1984}}
| {{Mono|-p9999}}
+
| {{Code|-p9999}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-S}}
+
| {{Code|-S}}
 
| Starts the server as service (i.e., in the background).
 
| Starts the server as service (i.e., in the background).
 
|
 
|
 
|  
 
|  
 
|- valign="top"
 
|- valign="top"
| {{Mono|-z}}
+
| {{Code|-z}}
 
| Does not generate any [[Logging|log files]].
 
| Does not generate any [[Logging|log files]].
 
|
 
|
Line 211: Line 211:
 
|}
 
|}
  
Multiple {{Mono|-c}} and {{Mono|-i}} flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash ({{mono|-}}) as argument.
+
Multiple {{Code|-c}} and {{Code|-i}} flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash ({{mono|-}}) as argument.
  
 
=BaseX Client=
 
=BaseX Client=
Line 227: Line 227:
 
</pre>
 
</pre>
  
Available command-line flags can be listed with {{Mono|-h}}:
+
Available command-line flags can be listed with {{Code|-h}}:
 
<pre>
 
<pre>
 
$ basexclient -h
 
$ basexclient -h
Line 262: Line 262:
 
! width='165' | Examples
 
! width='165' | Examples
 
|- valign="top"
 
|- valign="top"
| {{Mono|[file]}}
+
| {{Code|[file]}}
 
| Executes the specified XQuery file.
 
| Executes the specified XQuery file.
 
|
 
|
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-b&lt;pars&gt;}}
+
| {{Code|-b&lt;pars&gt;}}
 
| Binds external variables to XQuery expressions. This flag may be specified multiple times. Variables names and their values are delimited by equality signs (<code>=</code>). The names may be optionally prefixed with dollar signs. If a variable uses a namespace different to the default namespace, it can be specified with the [http://www.jclark.com/xml/xmlns.htm Clark Notation] or [http://www.w3.org/TR/xquery-30/#id-basics Expanded QName Notation].
 
| Binds external variables to XQuery expressions. This flag may be specified multiple times. Variables names and their values are delimited by equality signs (<code>=</code>). The names may be optionally prefixed with dollar signs. If a variable uses a namespace different to the default namespace, it can be specified with the [http://www.jclark.com/xml/xmlns.htm Clark Notation] or [http://www.w3.org/TR/xquery-30/#id-basics Expanded QName Notation].
 
| <code>[[Options#BINDINGS|BINDINGS]]</code>
 
| <code>[[Options#BINDINGS|BINDINGS]]</code>
Line 273: Line 273:
 
| <ul><li><code>-b$v=example -q$v</code></li><li><code>-b{URL}ln=value<br/>-q"declare namespace ns='URL'; $ns:ln"</code></li></ul>
 
| <ul><li><code>-b$v=example -q$v</code></li><li><code>-b{URL}ln=value<br/>-q"declare namespace ns='URL'; $ns:ln"</code></li></ul>
 
|- valign="top"
 
|- valign="top"
| {{Mono|-c&lt;cmd&gt;}}
+
| {{Code|-c&lt;cmd&gt;}}
 
| Runs the specified [[commands]] and quits. Several commands can be separated by semicolons.
 
| Runs the specified [[commands]] and quits. Several commands can be separated by semicolons.
 
|
 
|
 
|
 
|
| {{Mono|-c"list;info"}}
+
| {{Code|-c"list;info"}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-C&lt;file&gt;}}
+
| {{Code|-C&lt;file&gt;}}
| Runs all [[commands]] from the specified text file and quits. Empty lines and lines starting with the number sign {{Mono|#}} are skipped.
+
| Runs all [[commands]] from the specified text file and quits. Empty lines and lines starting with the number sign {{Code|#}} are skipped.
 
|
 
|
| {{Mono|-C commands.txt}}
+
| {{Code|-C commands.txt}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-d}}
+
| {{Code|-d}}
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| <code>[[Options#DEBUG|DEBUG]]</code>
 
| <code>[[Options#DEBUG|DEBUG]]</code>
Line 290: Line 290:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-i&lt;input&gt;}}
+
| {{Code|-i&lt;input&gt;}}
 
| Opens a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression.
 
| Opens a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression.
 
|
 
|
 
|
 
|
| {{Mono|-iitems.xml -q"//item"}}
+
| {{Code|-iitems.xml -q"//item"}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-L}}
+
| {{Code|-L}}
 
| Add trailing newline after query result. Useful for batch processing or pipelining on Unix systems.  
 
| Add trailing newline after query result. Useful for batch processing or pipelining on Unix systems.  
 
|
 
|
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-n&lt;name&gt;}}
+
| {{Code|-n&lt;name&gt;}}
 
| Specifies the host name on which the server is running.
 
| Specifies the host name on which the server is running.
 
| <code>[[Options#HOST|HOST]]</code>
 
| <code>[[Options#HOST|HOST]]</code>
| {{Mono|localhost}}
+
| {{Code|localhost}}
| {{Mono|-nserver.basex.org}}
+
| {{Code|-nserver.basex.org}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-o&lt;file&gt;}}
+
| {{Code|-o&lt;file&gt;}}
 
| All command and query output is written to the specified file.
 
| All command and query output is written to the specified file.
 
|
 
|
Line 313: Line 313:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-p&lt;num&gt;}}
+
| {{Code|-p&lt;num&gt;}}
 
| Specifies the port on which the server is running.
 
| Specifies the port on which the server is running.
 
| <code>[[Options#PORT|PORT]]</code>
 
| <code>[[Options#PORT|PORT]]</code>
| {{Mono|1984}}
+
| {{Code|1984}}
| {{Mono|-p9999}}
+
| {{Code|-p9999}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-P&lt;pass&gt;}}
+
| {{Code|-P&lt;pass&gt;}}
 
| Specifies the user password. If this flag is omitted, the password will be requested on command line. ''Warning'': when the password is specified via this flag, it may be visible to others.
 
| Specifies the user password. If this flag is omitted, the password will be requested on command line. ''Warning'': when the password is specified via this flag, it may be visible to others.
 
|
 
|
 
|
 
|
| {{Mono|-Uadmin -Padmin}}
+
| {{Code|-Uadmin -Padmin}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-q&lt;expr&gt;}}
+
| {{Code|-q&lt;expr&gt;}}
 
| Executes the specified string as XQuery expression.
 
| Executes the specified string as XQuery expression.
 
|
 
|
 
|
 
|
| {{Mono|-q"doc('input')//head"}}
+
| {{Code|-q"doc('input')//head"}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-s&lt;pars&gt;}}
+
| {{Code|-s&lt;pars&gt;}}
 
| Specifies parameters for serializing XQuery results; see [[Serialization]] for more details. This flag may be specified multiple times. Key and values are separated by the equality sign (<code>=</code>).
 
| Specifies parameters for serializing XQuery results; see [[Serialization]] for more details. This flag may be specified multiple times. Key and values are separated by the equality sign (<code>=</code>).
 
| <code>[[Options#SERIALIZER|SERIALIZER]]</code>
 
| <code>[[Options#SERIALIZER|SERIALIZER]]</code>
Line 337: Line 337:
 
| <code>-smethod=text</code>
 
| <code>-smethod=text</code>
 
|- valign="top"
 
|- valign="top"
| {{Mono|-U&lt;name&gt;}}
+
| {{Code|-U&lt;name&gt;}}
 
| Specifies the user name. If this flag is omitted, the user name will be requested on command line.  
 
| Specifies the user name. If this flag is omitted, the user name will be requested on command line.  
 
|
 
|
 
|
 
|
| {{Mono|-Uadmin}}
+
| {{Code|-Uadmin}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-v}}
+
| {{Code|-v}}
 
| Prints process and timing information to the ''standard output''.
 
| Prints process and timing information to the ''standard output''.
 
|
 
|
Line 349: Line 349:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-V}}
+
| {{Code|-V}}
 
| Prints detailed query information to the ''standard output'', including details on the compilation and profiling steps.
 
| Prints detailed query information to the ''standard output'', including details on the compilation and profiling steps.
 
| <code>[[Options#QUERYINFO|QUERYINFO]]</code>
 
| <code>[[Options#QUERYINFO|QUERYINFO]]</code>
Line 355: Line 355:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-w}}
+
| {{Code|-w}}
 
| By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to preserve whitespaces.
 
| By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to preserve whitespaces.
 
| <code>[[Options#CHOP|CHOP]]</code>
 
| <code>[[Options#CHOP|CHOP]]</code>
Line 361: Line 361:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-x}}
+
| {{Code|-x}}
 
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
 
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
 
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
 
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
Line 367: Line 367:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-z}}
+
| {{Code|-z}}
 
| Skips the serialization of XQuery results. This flag is useful if the query is profiled or analyzed.
 
| Skips the serialization of XQuery results. This flag is useful if the query is profiled or analyzed.
 
| <code>[[Options#SERIALIZE|SERIALIZE]]</code>
 
| <code>[[Options#SERIALIZE|SERIALIZE]]</code>
Line 374: Line 374:
 
|}
 
|}
  
Multiple query files and {{Mono|-c}}/{{Mono|-i}}/{{Mono|-q}} flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash ({{mono|-}}) as argument.
+
Multiple query files and {{Code|-c}}/{{Code|-i}}/{{Code|-q}} flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash ({{mono|-}}) as argument.
  
 
=BaseX HTTP Server=
 
=BaseX HTTP Server=
Line 387: Line 387:
 
2011-01-02 03:04:05.800:INFO::Started SocketConnector@0.0.0.0:8984</pre>
 
2011-01-02 03:04:05.800:INFO::Started SocketConnector@0.0.0.0:8984</pre>
  
Available command-line flags can be listed with {{Mono|-h}}:
+
Available command-line flags can be listed with {{Code|-h}}:
 
<pre>
 
<pre>
 
$ basexhttp -h
 
$ basexhttp -h
Line 420: Line 420:
 
! width='145' | Examples
 
! width='145' | Examples
 
|- valign="top"
 
|- valign="top"
| {{Mono|stop}}
+
| {{Code|stop}}
| Stops a running HTTP server. By default, the database server will be stopped as well, unless one of the flags {{Mono|-c}} or {{Mono|-l}} is specified.
+
| Stops a running HTTP server. By default, the database server will be stopped as well, unless one of the flags {{Code|-c}} or {{Code|-l}} is specified.
 
|
 
|
 
|
 
|
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-c}}
+
| {{Code|-c}}
 
| Starts the server in ''client mode'', and sends all commands to a database server instance.
 
| Starts the server in ''client mode'', and sends all commands to a database server instance.
 
|
 
|
Line 432: Line 432:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-d}}
+
| {{Code|-d}}
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| Turns on the debugging mode. Debugging information is output to ''standard error''.
 
| <code>[[Options#DEBUG|DEBUG]]</code>
 
| <code>[[Options#DEBUG|DEBUG]]</code>
Line 438: Line 438:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-e&lt;num&gt;}}
+
| {{Code|-e&lt;num&gt;}}
 
| Specifies the port on which the server will send events to clients.
 
| Specifies the port on which the server will send events to clients.
 
| <code>[[Options#EVENTPORT|EVENTPORT]]</code>
 
| <code>[[Options#EVENTPORT|EVENTPORT]]</code>
| {{Mono|1985}}
+
| {{Code|1985}}
| {{Mono|-e9998}}
+
| {{Code|-e9998}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-h&lt;num&gt;}}
+
| {{Code|-h&lt;num&gt;}}
 
| Specifies the port on which the HTTP server will be addressable. This port is e.g. specified in the HTTP URLs.
 
| Specifies the port on which the HTTP server will be addressable. This port is e.g. specified in the HTTP URLs.
 
| <code>[[Options#HTTPPORT|HTTPPORT]]</code>
 
| <code>[[Options#HTTPPORT|HTTPPORT]]</code>
| {{Mono|8984}}
+
| {{Code|8984}}
| {{Mono|-h9999}}
+
| {{Code|-h9999}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-l}}
+
| {{Code|-l}}
 
| Starts the server in ''local mode'', and executes all commands in the embedded database context.
 
| Starts the server in ''local mode'', and executes all commands in the embedded database context.
 
|
 
|
Line 456: Line 456:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-n&lt;name&gt;}}
+
| {{Code|-n&lt;name&gt;}}
 
| Specifies the host name on which the server is running.
 
| Specifies the host name on which the server is running.
 
| <code>[[Options#HOST|HOST]]</code>
 
| <code>[[Options#HOST|HOST]]</code>
| {{Mono|localhost}}
+
| {{Code|localhost}}
| {{Mono|-nserver.basex.org}}
+
| {{Code|-nserver.basex.org}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-p&lt;num&gt;}}
+
| {{Code|-p&lt;num&gt;}}
 
| Specifies the port on which the BaseX Server will be addressable.
 
| Specifies the port on which the BaseX Server will be addressable.
 
| <code>[[Options#SERVERPORT|SERVERPORT]]</code>
 
| <code>[[Options#SERVERPORT|SERVERPORT]]</code>
| {{Mono|1984}}
+
| {{Code|1984}}
| {{Mono|-p9998}}
+
| {{Code|-p9998}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-P&lt;pass&gt;}}
+
| {{Code|-P&lt;pass&gt;}}
 
| Specifies the user password, which will be used by the HTTP services to open a new session. If this flag is omitted, the password will be requested on command line. ''Warning'': when the password is specified on command-line, it may be visible to others.
 
| Specifies the user password, which will be used by the HTTP services to open a new session. If this flag is omitted, the password will be requested on command line. ''Warning'': when the password is specified on command-line, it may be visible to others.
 
|
 
|
| {{Mono|admin}}
+
| {{Code|admin}}
| {{Mono|-Uadmin -Padmin}}
+
| {{Code|-Uadmin -Padmin}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-R}}
+
| {{Code|-R}}
 
| Deactivates the [[REST]] service.
 
| Deactivates the [[REST]] service.
 
|
 
|
Line 480: Line 480:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-s&lt;num&gt;}}
+
| {{Code|-s&lt;num&gt;}}
 
| Specifies the port that will be used to stop the HTTP server.
 
| Specifies the port that will be used to stop the HTTP server.
 
| <code>[[Options#STOPPORT|STOPPORT]]</code>
 
| <code>[[Options#STOPPORT|STOPPORT]]</code>
Line 486: Line 486:
 
|  
 
|  
 
|- valign="top"
 
|- valign="top"
| {{Mono|-S}}
+
| {{Code|-S}}
 
| Starts the server as service (i.e., in the background).
 
| Starts the server as service (i.e., in the background).
 
|
 
|
 
|  
 
|  
 
|- valign="top"
 
|- valign="top"
| {{Mono|-U&lt;name&gt;}}
+
| {{Code|-U&lt;name&gt;}}
 
| Specifies the user name, which will be used by the HTTP services for opening a new session. If this flag is omitted, the password will be requested on command line.
 
| Specifies the user name, which will be used by the HTTP services for opening a new session. If this flag is omitted, the password will be requested on command line.
 
|
 
|
| {{Mono|admin}}
+
| {{Code|admin}}
| {{Mono|-Uadmin}}
+
| {{Code|-Uadmin}}
 
|- valign="top"
 
|- valign="top"
| {{Mono|-W}}
+
| {{Code|-W}}
 
| Deactivates the [[WebDAV]] service.
 
| Deactivates the [[WebDAV]] service.
 
|
 
|
Line 503: Line 503:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-X}}
+
| {{Code|-X}}
 
| Deactivates the [[RESTXQ]] service. {{Mark|Since Version 7.2}}
 
| Deactivates the [[RESTXQ]] service. {{Mark|Since Version 7.2}}
 
|
 
|
Line 509: Line 509:
 
|
 
|
 
|- valign="top"
 
|- valign="top"
| {{Mono|-z}}
+
| {{Code|-z}}
 
| Does not generate any [[Logging|log files]].
 
| Does not generate any [[Logging|log files]].
 
|
 
|
Line 517: Line 517:
 
Some options can also be triggered by setting the following system properties:
 
Some options can also be triggered by setting the following system properties:
  
* {{Mono|org.basex.user}}: user name for opening new sessions
+
* {{Code|org.basex.user}}: user name for opening new sessions
* {{Mono|org.basex.password}}: user password for opening new sessions
+
* {{Code|org.basex.password}}: user password for opening new sessions
* {{Mono|org.basex.mode}}: by default, the HTTP server also starts an instance of the database server. If the mode is set to {{Mono|local}}, an embedded database context is used for executing commands. If the mode is set to {{Mono|client}}, all commands are sent to an existing database server instance.
+
* {{Code|org.basex.mode}}: by default, the HTTP server also starts an instance of the database server. If the mode is set to {{Code|local}}, an embedded database context is used for executing commands. If the mode is set to {{Code|client}}, all commands are sent to an existing database server instance.
* {{Mono|org.basex.path}}: path to the BaseX [[Configuration|Home Directory]]
+
* {{Code|org.basex.path}}: path to the BaseX [[Configuration|Home Directory]]
  
 
=Changelog=
 
=Changelog=
Line 530: Line 530:
 
===Version 7.1.1===
 
===Version 7.1.1===
  
* Added: Options {{Mono|-C}} and {{Mono|-L}} in standalone and client mode
+
* Added: Options {{Code|-C}} and {{Code|-L}} in standalone and client mode
  
 
===Version 7.1===
 
===Version 7.1===
  
* Multiple query files and {{Mono|-c}}/{{Mono|-i}}/{{Mono|-q}} flags can be specified.
+
* Multiple query files and {{Code|-c}}/{{Code|-i}}/{{Code|-q}} flags can be specified.
  
 
[[Category:Beginner]]
 
[[Category:Beginner]]

Revision as of 15:14, 26 May 2012

This article is part of the Getting Started Guide. It gives more details on the command-line options of all BaseX start scripts.

BaseX GUI

Launch the GUI
$ basexgui [file]

One or more XML and XQuery files can be passed on as parameters. If an XML file is specified, a database instance is created from this file, or an existing database is opened. XQuery files are opened in the XQuery editor.

BaseX Standalone

Launch the console mode
$ basex
BaseX [Standalone]
Try "help" to get more information.
> _

Available command-line flags can be listed with -h:

$ basex -h
BaseX [Standalone]
Usage: basex [-bcCdiLoqsuvVwxz] [file]
  [file]      Execute XQuery file
  -b<pars>    Bind external XQuery variables
  -c<cmds>    Execute database commands
  -C<file>    Execute commands from script
  -d          Activate debugging mode
  -i<input>   Open initial file or database
  -L          Add trailing newline after query result
  -o<file>    Write output to file
  -q<expr>    Execute XQuery expression
  -s<pars>    Set serialization parameter(s)
  -u          Write updates back to original files
  -v/V        Show (all) process info
  -w          Preserve whitespaces from input files
  -x          Show query execution plan
  -z          Skip output of results

The meaning of all flags is listed in the following. If an equivalent database option exists (which can be specified via the SET command), it is listed as well:

Flag Description Option Examples
[file] Executes the specified XQuery file.
-b<pars> Binds external variables to XQuery expressions. This flag may be specified multiple times. Variables names and their values are delimited by equality signs (=). The names may be optionally prefixed with dollar signs. If a variable uses a namespace different to the default namespace, it can be specified with the Clark Notation or Expanded QName Notation. BINDINGS
  • -b$v=example -q$v
  • -b{URL}ln=value
    -q"declare namespace ns='URL'; $ns:ln"
-c<cmd> Runs the specified commands and quits. Several commands can be separated by semicolons. -c"list;info"
-C<file> Runs all commands from the specified text file and quits. Empty lines and lines starting with the number sign # are skipped. -C commands.txt
-d Turns on the debugging mode. Debugging information is output to standard error. DEBUG
-i<input> Opens a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression. -iitems.xml -q"//item"
-L Add trailing newline after query result. Useful for batch processing or pipelining on Unix systems.
-o<file> All command and query output is written to the specified file. -o output.txt
-q<expr> Executes the specified string as XQuery expression. -q"doc('input')//head"
-s<pars> Specifies parameters for serializing XQuery results; see Serialization for more details. This flag may be specified multiple times. Key and values are separated by the equality sign (=). SERIALIZER -smethod=text
-u Modifies original files after evaluating XQuery Update expressions. WRITEBACK
-v Prints process and timing information to the standard output.
-V Prints detailed query information to the standard output, including details on the compilation and profiling steps. QUERYINFO
-w By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to preserve whitespaces. CHOP
-x This flags turn on the output of the query execution plan, formatted in XML. XMLPLAN
-z Skips the serialization of XQuery results. This flag is useful if the query is profiled or analyzed. SERIALIZE

Multiple query files and -c/-i/-q flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash (-) as argument.

BaseX Server

Launch the server
$ basexserver
BaseX [Server]
Server was started.

Available command-line flags can be listed with -h:

$ basexserver -h
BaseX [Server]
Usage: basexserver [-cdeipSz] [stop]
  stop      Stop running server
  -c<cmds>  Execute initial database commands
  -d        Activate debugging mode
  -e<num>   Set event port
  -i        Enter interactive mode
  -p<num>   Set server port
  -S        Start as service
  -z        Suppress logging

The flags have the following meaning (equivalent database options are shown in the table as well):

Flag Description Option Default Examples
stop Stops an existing server instance and quits.
-c<cmd> Launches database commands before the server itself is started. Several commands can be separated by semicolons. -c"open database;info"
-d Turns on the debugging mode. Debugging information is output to standard error. DEBUG
-e<num> Specifies the port on which the server will send events to clients. EVENTPORT 1985 -e9998
-i Starts the interactive console mode, which can be used to enter database commands. This mode is similar to the default standalone and client mode.
-p<num> Specifies the port on which the server will be addressable. PORT 1984 -p9999
-S Starts the server as service (i.e., in the background).
-z Does not generate any log files.

Multiple -c and -i flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash (-) as argument.

BaseX Client

Launch the console mode communicating with the server

The user name and password will be requested. The default user/password combination is admin/admin:

$ basexclient
Username: admin
Password: *****
BaseX [Client]
Try "help" to get more information.
> _

Available command-line flags can be listed with -h:

$ basexclient -h
BaseX [Client]
Usage: basexclient [-bcCdiLnopPqsUvVwxz] [file]
  [file]      Execute XQuery file
  -b<pars>    Bind external XQuery variables
  -c<cmds>    Execute database commands
  -C<file>    Execute commands from script
  -d          Activate debugging mode
  -i<input>   Open initial file or database
  -L          Add trailing newline after query result
  -n<name>    Set server (host) name
  -o<file>    Write output to file
  -p<num>     Set server port
  -P<pass>    Specify user password
  -q<expr>    Execute XQuery expression
  -s<pars>    Set serialization parameter(s)
  -U<name>    Specify user name
  -v/V        Show (all) process info
  -w          Preserve whitespaces from input files
  -x          Show query execution plan
  -z          Skip output of results

The flags have the following meaning (equivalent database options are shown in the table as well):

Flag Description Option Default Examples
[file] Executes the specified XQuery file.
-b<pars> Binds external variables to XQuery expressions. This flag may be specified multiple times. Variables names and their values are delimited by equality signs (=). The names may be optionally prefixed with dollar signs. If a variable uses a namespace different to the default namespace, it can be specified with the Clark Notation or Expanded QName Notation. BINDINGS
  • -b$v=example -q$v
  • -b{URL}ln=value
    -q"declare namespace ns='URL'; $ns:ln"
-c<cmd> Runs the specified commands and quits. Several commands can be separated by semicolons. -c"list;info"
-C<file> Runs all commands from the specified text file and quits. Empty lines and lines starting with the number sign # are skipped. -C commands.txt
-d Turns on the debugging mode. Debugging information is output to standard error. DEBUG
-i<input> Opens a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression. -iitems.xml -q"//item"
-L Add trailing newline after query result. Useful for batch processing or pipelining on Unix systems.
-n<name> Specifies the host name on which the server is running. HOST localhost -nserver.basex.org
-o<file> All command and query output is written to the specified file.
-p<num> Specifies the port on which the server is running. PORT 1984 -p9999
-P<pass> Specifies the user password. If this flag is omitted, the password will be requested on command line. Warning: when the password is specified via this flag, it may be visible to others. -Uadmin -Padmin
-q<expr> Executes the specified string as XQuery expression. -q"doc('input')//head"
-s<pars> Specifies parameters for serializing XQuery results; see Serialization for more details. This flag may be specified multiple times. Key and values are separated by the equality sign (=). SERIALIZER -smethod=text
-U<name> Specifies the user name. If this flag is omitted, the user name will be requested on command line. -Uadmin
-v Prints process and timing information to the standard output.
-V Prints detailed query information to the standard output, including details on the compilation and profiling steps. QUERYINFO
-w By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to preserve whitespaces. CHOP
-x This flags turn on the output of the query execution plan, formatted in XML. XMLPLAN
-z Skips the serialization of XQuery results. This flag is useful if the query is profiled or analyzed. SERIALIZE

Multiple query files and -c/-i/-q flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash (-) as argument.

BaseX HTTP Server

Launch the HTTP server
$ basexhttp
BaseX [Server]
Server was started.
2011-01-02 03:04:05.600:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2011-01-02 03:04:05.700:INFO::jetty-6.1.26
2011-01-02 03:04:05.800:INFO::Started SocketConnector@0.0.0.0:8984

Available command-line flags can be listed with -h:

$ basexhttp -h
BaseX [HTTP]
Usage: basexhttp [-dehlnpPRUWz] [stop]
  stop       Stop running server
  -c         Start in client mode
  -d         Activate debugging mode
  -e<num>    Set event port
  -h<num>    Set port of HTTP server
  -l         Start in local mode
  -n<name>   Set host name of database server
  -p<num>    Set port of database server
  -P<pass>   Specify user password
  -R         Deactivate REST service
  -s         Specify port to stop HTTP server
  -S         Start as service
  -U<name>   Specify user name
  -W         Deactivate WebDAV service
  -X         Deactivate RESTXQ service
  -z         Suppress logging

The flags have the following meaning (equivalent database options are shown in the table as well):

Flag Description Option Default Examples
stop Stops a running HTTP server. By default, the database server will be stopped as well, unless one of the flags -c or -l is specified.
-c Starts the server in client mode, and sends all commands to a database server instance.
-d Turns on the debugging mode. Debugging information is output to standard error. DEBUG
-e<num> Specifies the port on which the server will send events to clients. EVENTPORT 1985 -e9998
-h<num> Specifies the port on which the HTTP server will be addressable. This port is e.g. specified in the HTTP URLs. HTTPPORT 8984 -h9999
-l Starts the server in local mode, and executes all commands in the embedded database context.
-n<name> Specifies the host name on which the server is running. HOST localhost -nserver.basex.org
-p<num> Specifies the port on which the BaseX Server will be addressable. SERVERPORT 1984 -p9998
-P<pass> Specifies the user password, which will be used by the HTTP services to open a new session. If this flag is omitted, the password will be requested on command line. Warning: when the password is specified on command-line, it may be visible to others. admin -Uadmin -Padmin
-R Deactivates the REST service.
-s<num> Specifies the port that will be used to stop the HTTP server. STOPPORT
-S Starts the server as service (i.e., in the background).
-U<name> Specifies the user name, which will be used by the HTTP services for opening a new session. If this flag is omitted, the password will be requested on command line. admin -Uadmin
-W Deactivates the WebDAV service.
-X Deactivates the RESTXQ service. Template:Mark
-z Does not generate any log files.

Some options can also be triggered by setting the following system properties:

  • org.basex.user: user name for opening new sessions
  • org.basex.password: user password for opening new sessions
  • org.basex.mode: by default, the HTTP server also starts an instance of the database server. If the mode is set to local, an embedded database context is used for executing commands. If the mode is set to client, all commands are sent to an existing database server instance.
  • org.basex.path: path to the BaseX Home Directory

Changelog

Version 7.2

  • Added: RESTXQ Service

Version 7.1.1

  • Added: Options -C and -L in standalone and client mode

Version 7.1

  • Multiple query files and -c/-i/-q flags can be specified.