2
basex - XML database system and XPath/XQuery processor (command line mode)
5
basex [-diosuvVwz] [-cq] [file]
8
basex is a fast and powerful, yet light-weight and platform independent XML
9
database system and XPath/XQuery processor.
12
[file] Execute the specified XQuery file.
13
-b<pars> Bind external variables to XQuery expression. Flag may be specified
14
multiple times; key/value pairs are separated by equality signs (=)
15
(-bv=example -q"declare variable $v external; $v")
16
-c<cmd> Launch database commands and skip interactive mode.
17
The flag should be placed last, as all remaining characters are
18
interpreted as commands. Several commands can be separated by
20
-d Turn on debugging (to standard error).
21
-i<input> Open a database or XML document specified by the argument.
22
The opened input may be further processed by an XQuery expression.
23
-o<file> Command and query output is written to the specified file.
24
-q<expr> Execute the specified string as XQuery expression. The flag should
25
be placed last, as all remaining characters are interpreted as
27
-s<pars> Specify parameters for serializing XQuery results;
28
see SERIALIZATION for more details. This flag may be specified
29
multiple times; key/value pairs are separated by equality signs (=)
30
-u Modify original files after evaluating XQuery Update expressions
31
-v Process information is written to standard output
32
-V Detailed query information is written to standard output,
33
including compilation and profiling steps.
34
-w By default, whitespaces around text nodes are chopped when a
35
database is created. The flag specifies to suppress chopping.
36
-z Skip the serialization of XQuery results (may be useful for
37
analyzing query plans)
40
A list of supported Database commands can be obtained from
44
or by browsing http://docs.basex.org/wiki/Commands
46
ADD (AS [name]) (TO [target]) [input] Add document to database.
47
ALTER [USER|DATABASE] [...] Alter user password or database name.
48
BACKUP [name] Backup database.
49
CLOSE Close current database.
50
CREATE [DATABASE|FS|INDEX|USER] [...] Create database, index or user.
51
CS [query] Evaluate XQuery and set result as new context set.
52
DELETE [name] Delete documents from database.
53
DROP [DATABASE|INDEX|USER] [...] Drop database, index or user.
54
EXIT Exit application.
55
EXPORT [path] Export database to XML.
56
FIND [query] Evaluate a keyword query.
57
GET [option] Show global option.
58
GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user] Grant user permissions.
59
HELP ([command]) Get help on BaseX commands.
60
INFO ([DATABASE|INDEX|STORAGE]) Show information on current database.
61
KILL [name] Kill user sessions.
62
LIST ([path]) List databases or documents in database.
63
OPEN [path] Open database.
64
OPTIMIZE Optimize the database.
65
PASSWORD ([password]) Change password.
66
RESTORE [name] Restore database.
67
RUN [path] Evaluate file as XQuery.
68
SET [option] ([value]) Set global options.
69
SHOW [DATABASES|SESSIONS|USERS|BACKUPS] Show server information.
70
XQUERY [query] Evaluate XQuery.
74
Serialization parameters define how XQuery items and XML nodes are textually
75
output, i.e., serialized. They have been formalized in a W3C XQuery
76
Serialization 3.0 document available at http://www.w3.org/TR/xslt-xquery-serialization-30
78
In BaseX, they can be specified in several ways:
79
* by using the -s flag of the BaseX command-line clients,
80
* by setting the SERIALIZER option before running a query,
81
* by setting the EXPORTER option before exporting a database,
82
* by setting them via the Output Parameter of the JAX-RX API,
83
* by including them in the prolog of the XQuery expression (since XQuery 3.0), or
84
* by specifying them in the XQuery function file:write().
86
An extensive documentation of all serialization parameters is to be found on:
87
http://docs.basex.org/wiki/Serialization
91
method=xml,encoding=CP1252
94
* XQuery evaluation (no database, no interaction, script mode):
98
$ basex -q "<answer>{ 23+19 }</answer>"
101
* Import an XML file into database, output its content (query its root) and be verbose:
103
$ basex -Vc "CREATE DB input /usr/share/doc/basex/examples/input.xml; XQUERY /"
104
Database 'input' created in 53.64 ms.
111
<body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC">
112
<h1>Databases & XML</h1>
140
Query executed in 13.25 ms.
142
* XPath evaluation (with existing database):
144
$ basex -c "OPEN input; XQUERY //li[1]"
147
* Retrieve XML from the web and perform XPath query:
149
$ basex -q "doc('https://svn.uni-konstanz.de/dbis/basex/tags/6.5/basex/etc/xml/input.xml')//li"
153
* W3C XQuery Full-Text (make use of full-text index and perform fuzzy query with a typing error):
156
BaseX 6.5 [Standalone]
157
Try "help" to get more information.
161
> CREATE DB input /usr/share/doc/basex/examples/input.xml/input.xml
162
Database 'input' created in 94.42 ms.
163
> XQUERY //b[text() contains text 'Asisgnment' using fuzzy]
165
Query executed in 8.37 ms.
167
* Update the database and show result:
169
> XQUERY delete node //ul
170
Query executed in 2.79 ms.
171
> XQUERY replace value of node //b with 'Debian rules'
172
Query executed in 2.94 ms.
177
Query executed in 1.01 ms.
180
basexgui(1), basexserver(1), basexclient(1)
182
~/.basex BaseX (standalone and server) properties
183
~/.basexgui BaseX additional GUI properties
184
~/.basexperm user name, passwords, and permissions
185
~/BaseXData Default database directory
186
~/BaseXData/.logs Server logs
188
BaseX Documentation Wiki: http://docs.basex.org
191
BaseX started as a research project of the Database and Information Systems
192
Group (DBIS) at the University of Konstanz in 2005 and soon turned into a
193
feature-rich open source XML database and XPath/XQuery processor.
196
New (3-clause) BSD License
199
BaseX is primarily developed by Christian Gruen <christian.gruen@gmail.com> with the help of others listed as
200
The BaseX Team on <http://basex.org/about-us/>
202
The man page was written by Alexander Holupirek <alex@holupirek.de> in the progress of packaging BaseX for Debian GNU/Linux.