Provided by: basex_7.0.2-1_all bug


       basex - XML database system and XPath/XQuery processor (command line mode)


       basex [-bdiosuvVwz] [-cq] [file]


       basex  is  a  fast  and  powerful,  yet light-weight and platform independent XML database
       system and XPath/XQuery processor.


       [file] Execute the specified XQuery file.

              Bind external variables to XQuery expression. Flag may be specified multiple times;
              key/value  pairs  are  separated  by  equality  signs  (=)  (-bv=example -q"declare
              variable $v external; $v")

              Launch database commands and skip interactive mode.   The  flag  should  be  placed
              last, as all remaining characters are interpreted as commands. Several commands can
              be separated by semicolons.

       -d     Turn on debugging (to standard error).

              Open a database or XML document specified by the argument.  The opened input may be
              further processed by an XQuery expression.

              Command and query output is written to the specified file.

              Execute  the specified string as XQuery expression. The flag should be placed last,
              as all remaining characters are interpreted as XQuery.

              Specify parameters for serializing  XQuery  results;  see  SERIALIZATION  for  more
              details.  This  flag may be specified multiple times; key/value pairs are separated
              by equality signs (=)

       -u     Modify original files after evaluating XQuery Update expressions

       -v     Process information is written to standard output

       -V     Detailed query information is written to standard output, including compilation and
              profiling steps.

       -w     By  default,  whitespaces around text nodes are chopped when a database is created.
              The flag specifies to suppress chopping.

       -z     Skip the serialization of XQuery results (may be useful for analyzing query plans)


       A list of supported Database commands can be obtained from

           $ basex -c help

       or by browsing

       ADD (AS [name]) (TO [target]) [input]
              Add document to database.

       ALTER [DATABASE|USER] [...]
              Alter database name or user password.

       CHECK [input]
              Open or create database.

       CLOSE  Close current database.

       COPY [name] [newname]
              Copy database.

              Create database, index or user.

       CS [query]
              Run XQuery and set result as new context set.

       DELETE [path]
              Delete documents from database.

              Drop database, index or user.

       EXIT   Exit application.

       EXPORT [path]
              Export database to XML.

       FIND [keywords]
              Run a keyword query.

       FLUSH  Flush database.

       GET [option]
              Show global option.

       GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [database]) TO [user]
              Grant user permissions.

       HELP ([command])
              Get help on BaseX commands.

              Show information on current database.

       KILL [name]
              Kill user sessions.

       LIST ([path])
              List databases or documents in database.

       OPEN [path]
              Open database.

              Optimize the database.

       PASSWORD ([password])
              Change password.

       RENAME [path] [newpath]
              Rename document paths in database.

       REPLACE [path] [input]
              Replace documents in database.

              Install, delete or list packages.

       RESTORE [name-(date)]
              Restore database.

       RETRIEVE [path]
              Retrieve raw data.

       RUN [path]
              Run file as XQuery.

       SET [option] ([value])
              Set global options.

              Show server information.

       STORE (TO [path]) [input]
              Store raw data.

       XQUERY [query]
              Run XQuery.


       Serialization parameters define how XQuery items and XML nodes are textually output, i.e.,
       serialized. They have been formalized in a W3C XQuery Serialization 3.0 document available

       In BaseX, they can be specified in several ways:

       ·  by using the -s flag of the BaseX command-line clients,

       ·  by setting the SERIALIZER option before running a query,

       ·  by setting the EXPORTER option before exporting a database,

       ·  by setting them as Output Parameter of the REST API,

       ·  by including them in the prolog of the XQuery expression (since XQuery 3.0), or

       ·  by specifying them in the XQuery function file:write().

       An  extensive  documentation  of  all  serialization  parameters  is  to  be   found   on:

       An example would be:



       ·  XQuery evaluation (no database, no interaction, script mode):

          $ basex -q 19+23
          $ basex -q "<answer>{ 23+19 }</answer>"

       ·  Import an XML file into database, output its content (query its root) and be verbose:

           $ basex -Vc "CREATE DB input /usr/share/doc/basex/examples/input.xml; XQUERY /"
           Database 'input' created in 53.64 ms.
             <!-- Header -->
             <head id="0">
             <!-- Body -->
             <body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC">
               <h1>Databases & XML</h1>
               <div align="right">
                   <li>Exercise 1</li>
                   <li>Exercise 2</li>
             <?pi bogus?>

           Query: /


           Result: root()

           Parsing: 0.19 ms
           Compiling: 9.27 ms
           Evaluating: 0.33 ms
           Printing: 3.08 ms
           Total Time: 12.88 ms
           Results: 1 Item
           Updated: 0 Items
           Printed: 375 Bytes
           Memory: 5834 KB

           Query executed in 13.25 ms.

       ·  XPath evaluation (with existing database):

           $ basex -c "OPEN input; XQUERY //li[1]"
           <li>Exercise 1</li>

       ·  Retrieve XML from the web and perform XPath query:

           $ basex -q "doc('')//li"
           <li>Exercise 1</li>
           <li>Exercise 2</li>

       ·  W3C XQuery Full-Text (make use of full-text index and perform fuzzy query with a typing

           $ basex
           BaseX 7.0 [Standalone]
           Try "help" to get more information.

           > SET FTINDEX on
           Full-Text Index: ON
           > CREATE DB input /usr/share/doc/basex/examples/input.xml/input.xml
           Database 'input' created in 94.42 ms.
           > XQUERY //b[text() contains text 'Asisgnment' using fuzzy]
           Query executed in 8.37 ms.

       ·  Update the database and show result:

           > XQUERY delete node //ul
           Query executed in 2.79 ms.
           > XQUERY replace value of node //b with 'Debian rules'
           Query executed in 2.94 ms.
           > XQUERY //div
           <div align="right">
             <b>Debian rules</b>
           Query executed in 1.01 ms.


       basexgui(1), basexserver(1), basexclient(1)

              BaseX (standalone and server) properties

              BaseX additional GUI properties

              user name, passwords, and permissions

              contains all existing events

              Default database directory

              Server logs

              Package repository

       BaseX Documentation Wiki:


       BaseX started as a research project of the Database and Information Systems  Group  (DBIS)
       at  the University of Konstanz in 2005 and soon turned into a feature-rich open source XML
       database and XPath/XQuery processor.


       New (3-clause) BSD License


       BaseX is developed by a bunch of people called 'The BaseX  Team'  <
       us/> led by Christian Gruen <>.

       The  man page was written by Alexander Holupirek <> while packaging BaseX
       for Debian GNU/Linux.

                                         14 October 2011                                 basex(1)