Difference between revisions of "Command-Line Options"
m (Text replace - "BaseX Command Scripts" to "Command Scripts") |
m (Text replace - "#Command Scripts" to "#Basics") |
||
Line 49: | Line 49: | ||
| {{Code|[input]}} | | {{Code|[input]}} | ||
|Updated with {{Version|7.4}}. Evaluates the specified input: | |Updated with {{Version|7.4}}. Evaluates the specified input: | ||
− | * The input string may point to an existing file. If the file suffix is {{Code|.bxs}}, the file content will be evaluated as [[Commands# | + | * The input string may point to an existing file. If the file suffix is {{Code|.bxs}}, the file content 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. | * Otherwise, the input string itself is evaluated as XQuery expression. | ||
| | | | ||
Line 255: | Line 255: | ||
| {{Code|[input]}} | | {{Code|[input]}} | ||
|Updated with {{Version|7.4}}. Evaluates the specified input: | |Updated with {{Version|7.4}}. Evaluates the specified input: | ||
− | * The input string may point to an existing file. If the file suffix is {{Code|.bxs}}, the file content will be evaluated as [[Commands# | + | * The input string may point to an existing file. If the file suffix is {{Code|.bxs}}, the file content 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. | * Otherwise, the input string itself is evaluated as XQuery expression. | ||
| | | | ||
Line 512: | Line 512: | ||
;Version 7.4 | ;Version 7.4 | ||
− | * Added: detection of [[Commands# | + | * Added: detection of [[Commands#Basics|Command Scripts]]. |
; Version 7.3: | ; Version 7.3: |
Revision as of 23:35, 22 August 2012
This article is part of the Getting Started Guide. It gives more details on the command-line options of all BaseX start scripts.
Contents
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 [-bcdiLosuvVwxz] [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 file or database -L Append newlines to query results -o<output> Write output to file -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 |
---|---|---|---|
[input]
|
Updated with Version 7.4. Evaluates the specified input:
|
• "doc('X')//head" • query.xq • commands.bxs | |
-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.
|
BINDINGS
|
• -b$v=example -q$v • -b{URL}ln=value
|
-c<input>
|
Executes Commands:
|
• -c"list;info" • -ccommands.txt • -c"<info/>"
| |
-d
|
Toggles 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
|
Separates returned query items by newlines (instead of spaces) and appends a newline to the end of a result. | ||
-o<file>
|
All command and query output is written to the specified file. | -o output.txt
| |
-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
|
Alls options can be specified multiple times. With Version 7.3, all options 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 (-
) 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 [-bcdiLnopPsUvVwxz] [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 file or database -L Append newlines to query results -n<name> Set server (host) name -o<output> Write output to file -p<num> Set server port -P<pass> Specify user password -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 |
---|---|---|---|---|
[input]
|
Updated with Version 7.4. Evaluates the specified input:
|
• "doc('X')//head" • query.xq • commands.bxs | ||
-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
| |
-c<input>
|
Executes Commands:
|
• -c"list;info" • -ccommands.txt • -c"<info/>"
| ||
-d
|
Toggles 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
|
Separates returned query items by newlines (instead of spaces) and appends a newline to the end of a result. | |||
-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
| ||
-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
|
Alls options can be specified multiple times. With Version 7.3, all options 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 (-
) 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 a default user password, which will be used by the HTTP services to open a new session. If this flag is omitted, and if -U was specified, the password will be requested on command line. Warning: when the password is specified on command-line, it may be visible to others.
|
-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 a default user, which will be used by the HTTP services for opening a new session. | -Uadmin
| ||
-W
|
Deactivates the WebDAV service. | |||
-X
|
Deactivates the RESTXQ service. | |||
-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 sessionsorg.basex.password
: user password for opening new sessionsorg.basex.mode
: by default, the HTTP server also starts an instance of the database server. If the mode is set tolocal
, an embedded database context is used for executing commands. If the mode is set toclient
, all commands are sent to an existing database server instance.org.basex.path
: path to the BaseX Home Directory
Changelog
- Version 7.4
- Added: detection of Command Scripts.
- Version 7.3
- Updated: all options are now evaluated in the given order
- Updated:
-i
creates main-memory representations for specified sources - Updated: Options
-C
/-c
and-q
/[input]
merged - Updated: Option
-L
also separates serialized items with newlines (instead of spaces)
- Version 7.2
- Added: RESTXQ Service
- Version 7.1.1
- Added: Options
-C
and-L
in standalone and client mode
- Version 7.1
- Updated: Multiple query files and
-c
/-i
/-q
flags can be specified.