Changes

Jump to navigation Jump to search
2,198 bytes added ,  14:50, 18 April 2018
m
Fixed wiki syntax for links
It gives more details on the command-line options of all BaseX [[Startup]] modes.
Options can be specified multiple times. All Please note that all options are will be evaluated in the given order (in earlier versions, the sequential evaluation was limited to the specified inputs, query files, queries and commands, while all other options were initially set). The standard input can be parsed by specifying a single dash ({{Code|-}}) as argument.
=BaseX GUIStandalone=;Launch the GUI:<pre>$ basexgui [file]</pre> 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:
<pre>
$ basex -h
BaseX [Standalone]
Usage: basex [-bcdiLosuvVwxzbcdiLoqrRsuvVwxXz] [input]
[input] Execute input file or expression
-b<pars> Bind external query variables
-c<input> Execute commands from file or string
-d Activate debugging mode
-i<input> Open initial XML file or database -L Append newlines I<input> Assign input string to query resultscontext
-o<output> Write output to file
-q<expr> Execute XQuery expression
-r<num> Set number of query executions
-R Turn query execution on/off
-s<pars> Set serialization parameter(s)
-t[path] Run tests in file or directory
-u Write updates back to original files
-v/V Show (all) process info
-w Preserve whitespaces from input files
-x Show query execution plan
-X Show query plan before/after compilation
-z Skip output of results
</pre>
The meaning of all flags is listed in the following table. If an equivalent database option exists (which can be specified via the <code>[[Commands#SET|SET]] </code> command), it is listed as well. For the examples to work escaping some characters might be necessary, depending on your Operating System.
{| class="wikitable"
! width="40%" | Description
! Option
! Default
! Examples
|- valign="top"
| {{Code|[input]}}
|Evaluates the specified input:
* The input string may point to an existing file. If the file suffix is {{Code|.bxs}}, the file content contents will be evaluated as [[Commands#Basics|Command Script]]; otherwise, it will be evaluated as XQuery expression.
* Otherwise, the input string itself is evaluated as XQuery expression.
|
|
|• {{Code|"doc('X')//head"}}<br/>• {{Code|query.xq}}<br/>• {{Code|commands.bxs}}<br/>
| 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].
| <code>[[Options#BINDINGS|BINDINGS]]</code>
||• <code>-b$vbv=example "declare variable $v external; $v"</code><br/>• <code>-b{URL}ln=value<br/>"declare namespace ns='URL'; declare variable $ns:ln external; $ns:ln"</code>
|- valign="top"
| {{Code|-c&lt;input&gt;}}
| Executes [[Commands]]:
* Several commands in the input can be separated by semicolons ({{Code|;}}).
* If the specified input is a valid URL or file reference or URL, its content this file will be executed insteadevaluated as [[Commands#Command_Scripts|Command Script]]. Empty lines and lines starting with the number sign {{Code|#}} will be ignored.
|
|• {{Code|-c"list;info"}}<br/>• {{Code|-ccommands.txt}}<br/>• {{Code|-c"<info/>"}}
| Toggles the debugging mode. Debugging information is output to ''standard error''.
| <code>[[Options#DEBUG|DEBUG]]</code>
| <code>false</code>
|
|- valign="top"
| {{Code|-i&lt;input&gt;}}
| Opens a an XML file or database or XML document specified by the argument. The opened input may can then be further processed by an a command or XQuery expression.|
|
| {{Code|-iitems.xml "//item"}}
|- valign="top"
| {{Code|-LI&lt;input&gt;}}| Separates returned query items by newlines (instead Assigns an input string as item of spaces) and appends a newline type {{Code|xs:untypedAtomic}} to the end of a resultquery context.
|
|
| {{Code|-I "Hello Universe" -q "."}}
|- valign="top"
| {{Code|-o&lt;file&gt;}}
| All command and query output is written to the specified file.
|
|
| {{Code|-o output.txt}}
| {{Code|-q&lt;expr&gt;}}
| Executes the specified string as XQuery expression.
|
|
| {{Code|-q"doc('input')//head"}}
|- valign="top"
| {{Code|-r&lt;num&gt;}}
| Specifies how often a specified query will be evaluated.
| <code>[[Options#RUNS|RUNS]]</code>
| <code>1</code>
| {{Code|-V -r10 "1"}}
|- valign="top"
| {{Code|-R}}
| Specifies if a query will be executed or parsed only.
| <code>[[Options#RUNQUERY|RUNQUERY]]</code>
| <code>true</code>
| {{Code|-V -R "1"}}
|- valign="top"
| {{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>).
| <code>[[Options#SERIALIZER|SERIALIZER]]</code>
|
| <code>-smethod=text</code>
|- valign="top"
| {{Code|-t}}
| Runs all [[Unit Module|Unit tests]] in the specified file or directory.
|
|
| -t project/tests
|- valign="top"
| {{Code|-u}}
| Modifies original Propagates updates on input files after evaluating XQuery Update expressionsback to disk.
| <code>[[Options#WRITEBACK|WRITEBACK]]</code>
| <code>false</code>
|
|- valign="top"
| Prints process and timing information to the ''standard output''.
|
| <code>false</code>
|
|- valign="top"
| Prints detailed query information to the ''standard output'', including details on the compilation and profiling steps.
| <code>[[Options#QUERYINFO|QUERYINFO]]</code>
| <code>false</code>
|
|- valign="top"
| {{Code|-w}}
| By default, Specifies if whitespaces around in XML text nodes are should be chopped when a database (which is created. This flag can be specified to preserve whitespacesthe default) or preserved.
| <code>[[Options#CHOP|CHOP]]</code>
| <code>true</code>
|
|- valign="top"
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
| <code>false</code>
|
|- valign="top"
| {{Code|-X}}
| Generates the query plan before or after query compilation. {{Code|-x}} needs to be activated to make the plan visible.
| <code>[[Options#COMPPLAN|COMPPLAN]]</code>
| <code>true</code>
|
|- valign="top"
| {{Code|-z}}
| Skips Turns the serialization of XQuery resultson/off. This flag is useful if the query is profiled or analyzed.
| <code>[[Options#SERIALIZE|SERIALIZE]]</code>
| <code>true</code>
|
|}
=BaseX Server= {{Mark|Updated with Version 9.0:}} {{Code|-c}} flag now accepts valid URLs and file references. 
;Launch the server
<pre>
$ basexserver -h
BaseX [Server]
Usage: basexserver [-cdeinpSzcdinpSz] [stop] stop Stop running server -c<cmdsinput> Execute initial database commandsfrom file or string -d Activate debugging mode -e<port> Set event port -i Enter interactive mode -n<name> Set host the server is bound to -p<port> Set server port -S Start as service -z Suppress logging
</pre>
|- valign="top"
| {{Code|stop}}
| Stops an existing a local database server instance and quits.
|
|
|- valign="top"
| {{Code|-c&lt;cmd&gt;}}
| Launches database Executes [[Commands]]:* Several commands before in the server itself is started. Several commands input can be separated by semicolons ({{Code|;}}).* If the specified input is a valid URL or file reference, this file will be evaluated as [[Commands#Command_Scripts|Command Script]].
|
|
| Turns on the debugging mode. Debugging information is output to ''standard error''.
| <code>[[Options#DEBUG|DEBUG]]</code>
|||- valign="top"| {{Code|-e&lt;num&gt;}}| Specifies the port on which the server will send events to clients.| <code>[[Options#EVENTPORT|EVENTPORT]]false</code>| {{Code|1985}}| {{Code|-e9998}}|- valign="top"| {{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.||
|
|- valign="top"
| {{Code|-n&lt;name&gt;}}
| Specifies the host the server will be bound to. {{Version|7.7}}
| <code>[[Options#SERVERHOST|SERVERHOST]]</code>
|
|- valign="top"
| {{Code|-S}}
| Starts the server as service (i.e., in the background). Use [[YAJSW]], or start BaseX as an ordinary background process, to get more options.
|
|
| Does not generate any [[Logging|log files]].
| <code>[[Options#LOG|LOG]]</code>
| <code>true</code>
|
|}
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 ({{Code|-}}) as argument.
=BaseX Client=
;Launch the console mode communicating with the server
$ basexclient -h
BaseX [Client]
Usage: basexclient [-bcdiLnopPsUvVwxzbcdiLnopPqrRsUvVwxXz] [input]
[input] Execute input file or expression
-b<pars> Bind external query variables
-c<input> Execute commands from file or string
-d Activate debugging mode
-i<input> Open initial XML file or database -L Append newlines I<input> Assign input string to query resultscontext
-n<name> Set server (host) name
-o<output> Write output to file
-P<pass> Specify user password
-q<expr> Execute XQuery expression
-r<num> Set number of query executions
-R Turn query execution on/off
-s<pars> Set serialization parameter(s)
-U<name> Specify user name
-w Preserve whitespaces from input files
-x Show query execution plan
-X Show query plan before/after compilation
-z Skip output of results
</pre>
The flags have the following meaning (equivalent database options are shown in the table as well).
For the examples to work escaping some characters might be necessary, depending on your Operating System.
 
{| class="wikitable"
| {{Code|[input]}}
|Evaluates the specified input:
* The input string may point to an existing file. If the file suffix is {{Code|.bxs}}, the file content contents will be evaluated as [[Commands#Basics|Command Script]]; otherwise, it will be evaluated as XQuery expression.
* Otherwise, the input string itself is evaluated as XQuery expression.
|
| <code>[[Options#BINDINGS|BINDINGS]]</code>
|
|• <code>-b$v=example "declare variable $v external; $v"</code><br/>• <code>-b{URL}ln=value<br/>"declare namespace ns='URL'; declare variable $ns:ln external; $ns:ln"</code>
|- valign="top"
| {{Code|-c&lt;input&gt;}}
| Toggles the debugging mode. Debugging information is output to ''standard error''.
| <code>[[Options#DEBUG|DEBUG]]</code>
|<code>false</code>
|
|- valign="top"
| {{Code|-i&lt;input&gt;}}
| Opens a an XML file or database or XML document specified by the argument. The opened input may can then be further processed by an a command or XQuery expression.
|
|
| {{Code|-iitems.xml "//item"}}
|- valign="top"
| {{Code|-LI&lt;input&gt;}}| Separates returned query items by newlines (instead Assigns an input string as item of spaces) and appends a newline type {{Code|xs:untypedAtomic}} to the end of a resultquery context.
|
|
| {{Code|-I "Hello Universe" -q "."}}
|- valign="top"
| {{Code|-n&lt;name&gt;}}
|
| {{Code|-q"doc('input')//head"}}
|- valign="top"
| {{Code|-r&lt;num&gt;}}
| Specifies how often a specified query will be evaluated.
| <code>[[Options#RUNS|RUNS]]</code>
| <code>1</code>
| {{Code|-V -r10 "1"}}
|- valign="top"
| {{Code|-R}}
| Specifies if a query will be executed or parsed only.
| <code>[[Options#RUNQUERY|RUNQUERY]]</code>
| <code>true</code>
| {{Code|-V -R "1"}}
|- valign="top"
| {{Code|-s&lt;pars&gt;}}
| Prints process and timing information to the ''standard output''.
|
|<code>false</code>
|
|- valign="top"
| Prints detailed query information to the ''standard output'', including details on the compilation and profiling steps.
| <code>[[Options#QUERYINFO|QUERYINFO]]</code>
|<code>false</code>
|
|- valign="top"
| {{Code|-w}}
| By default, Specifies if whitespaces around in XML text nodes are should be chopped when a database (which is created. This flag can be specified to preserve whitespacesthe default) or preserved.
| <code>[[Options#CHOP|CHOP]]</code>
|<code>chop</code>
|
|- valign="top"
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
| <code>false</code>
|
|- valign="top"
| {{Code|-X}}
| Generates the query plan before or after query compilation. {{Code|-x}} needs to be activated to make the plan visible.
| <code>[[Options#COMPPLAN|COMPPLAN]]</code>
| <code>after</code>
|
|- valign="top"
| {{Code|-z}}
| Skips Turns the serialization of XQuery resultson/off. This flag is useful if the query is profiled or analyzed.
| <code>[[Options#SERIALIZE|SERIALIZE]]</code>
|<code>true</code>
|
|}
=BaseX HTTP Server= {{Mark|Introduced with Version 9.0:}} {{Code|-c}} flag accepts commands and valid URLs and file references.
;Launch the HTTP server:
$ basexhttp -h
BaseX [HTTP]
Usage: basexhttp [-dehlnpPRUWzdhlnpPRUWz] [stop] stop Stop running server -c<input> Execute commands from file or string -d Activate debugging mode -eh<port> Set event port -h<port> Set port of HTTP server -l Start in local mode -n<name> Set host name of database server -p<port> Set port of database server -P<pass> Specify user password -s<port> Specify port to stop HTTP server -S Start as service -U<name> Specify user name -z Suppress logging
</pre>
The flags have the following meaning (equivalent database options are shown in the table as well).
For the examples to work escaping some characters might be necessary, depending on your Operating System.
 
{| class="wikitable"
|- valign="top"
| {{Code|stop}}
| Stops a running local HTTP serverand quits. By default, the The database server will be stopped as well, unless {{Code|-l}} has been is specified.
| <code>pom.xml</code>
|
|
|- valign="top"
| {{Code|-c&lt;cmd&gt;}}
| Executes [[Commands]]:
* Several commands in the input can be separated by semicolons ({{Code|;}}).
* If the specified input is a valid URL or file reference, this file will be evaluated as [[Commands#Command_Scripts|Command Script]].
|
|
| {{Code|-c"open database"}}
|- valign="top"
| {{Code|-d}}
|
|
|- valign="top"
| {{Code|-e&lt;num&gt;}}
| Specifies the port on which the server will send events to clients.
| <code>[[Options#EVENTPORT|EVENTPORT]]</code>
| {{Code|1985}}
| {{Code|-e9998}}
|- valign="top"
| {{Code|-h&lt;num&gt;}}
| {{Code|1984}}
| {{Code|-p9998}}
|- valign="top"
| {{Code|-P&lt;pass&gt;}}
| Specifies a user password, which will be used by the HTTP services to open a new session. If this flag is omitted, and if {{Code|-U}} was specified, the password will be requested on command line. ''Warning'': when the password is specified with this flag, it may get visible to others.
| <code>[[Options#PASSWORD|PASSWORD]]</code>
|
| {{Code|-Uadmin -Padmin}}
|- valign="top"
| {{Code|-s&lt;num&gt;}}
| Specifies the port that will be used to stop the HTTP server.
| <code>[[Options#STOPPORT|STOPPORT]]</code> or<br/><code>pom.xml</code>
| <code>89838985</code>
|
|- valign="top"
| {{Code|-S}}
| Starts the server as service (i.e., in the background). Use [[YAJSW]], or start BaseX as an ordinary background process, to get more options.
|
|
|
|}
 
=GUI=
;Launch the GUI:
<pre>
$ basexgui [file]
</pre>
 
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.
=Changelog=
 
;Version 9.0
 
* Added: BaseXHTTP, command-line option {{Code|-c}}.
* Updated: BaseXHTTP, command-line option {{Code|-c}}, additionally accepts valid URLs and file references.
 
;Version 8.2
 
* Removed: Event ports, {{Code|-e}}.
 
;Version 8.1
 
* Added: Bind input strings to the query context with {{Code|-I}}.
 
;Version 8.0
 
* Removed: Command-line option <code>-L</code> (results will now be automatically separated by newlines).
 
;Version 7.9
 
* Added: Runs tests in file or directory with {{Code|-t}}.
* Removed: interactive server mode.
 
;Version 7.8
 
* Added: Specify if a query will be executed or parsed only with {{Code|-R}}.
;Version 7.7
* Added: {{Code|-n}} binds a Bind host to the [[#BaseX Server|BaseX Server]]with {{Code|-n}}.
;Version 7.5
; Version 7.3:
* Updated: all options are now evaluated in the given order.* Updated: Create main-memory representations for specified sources with {{Code|-i}} creates main-memory representations for specified sources.* Updated: Options {{Code|-C}}/{{Code|-c}} and {{Code|-q}}/{{Code|[input]}} merged.* Updated: Option {{Code|-L}} also separates serialized items with newlines (instead of spaces).
; Version 7.2:
; Version 7.1.1:
* Added: Options {{Code|-C}} and {{Code|-L}} in standalone and client mode.
; Version 7.1:
* Updated: Multiple query files and {{Code|-c}}/{{Code|-i}}/{{Code|-q}} flags can be specified.
 
[[Category:Beginner]]
administrator, editor
43

edits

Navigation menu