Provided by: basex_7.0.2-1_all bug

NAME

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

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

       [file] Execute the specified XQuery file.

       -b<pars>
              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")

       -c<cmd>
              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).

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

       -o<file>
              Command and query output is written to the specified file.

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

       -s<pars>
              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)

DATABASE COMMANDS

       A list of supported Database commands can be obtained from

           $ basex -c help

       or by browsing http://docs.basex.org/wiki/Commands

       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 [BACKUP|DATABASE|EVENT|INDEX|USER] [...]
              Create database, index or user.

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

       DELETE [path]
              Delete documents from database.

       DROP [BACKUP|DATABASE||EVENTINDEX|USER] [...]
              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.

       INFO ([DATABASE|INDEX|STORAGE])
              Show information on current database.

       KILL [name]
              Kill user sessions.

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

       OPEN [path]
              Open database.

       OPTIMIZE (ALL)
              Optimize the database.

       PASSWORD ([password])
              Change password.

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

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

       REPO [DELETE|INSTALL|LIST]
              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 [BACKUPS|DATABASES|EVENTS|SESSIONS|USERS]
              Show server information.

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

       XQUERY [query]
              Run XQuery.

SERIALIZATION

       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
       at http://www.w3.org/TR/xslt-xquery-serialization-30

       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:
       http://docs.basex.org/wiki/Serialization

       An example would be:

           method=xml,encoding=CP1252

EXAMPLES

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

          $ basex -q 19+23
          42
          $ basex -q "<answer>{ 23+19 }</answer>"
          <answer>42</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.
           <html>
             <!-- Header -->
             <head id="0">
               <title>XML</title>
             </head>
             <!-- Body -->
             <body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC">
               <h1>Databases & XML</h1>
               <div align="right">
                 <b>Assignments</b>
                 <ul>
                   <li>Exercise 1</li>
                   <li>Exercise 2</li>
                 </ul>
               </div>
             </body>
             <?pi bogus?>
           </html>

           Query: /

           Compiling:

           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('https://raw.github.com/BaseXdb/basex/master/etc/test/input.xml')//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
          error):

           $ 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]
           <b>Assignments</b>
           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>
           </div>
           Query executed in 1.01 ms.

SEE ALSO

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

       ~/.basex
              BaseX (standalone and server) properties

       ~/.basexgui
              BaseX additional GUI properties

       ~/.basexperm
              user name, passwords, and permissions

       ~/.basexevents
              contains all existing events

       ~/BaseXData
              Default database directory

       ~/BaseXData/.logs
              Server logs

       ~/BaseXRepo
              Package repository

       BaseX Documentation Wiki: http://docs.basex.org

HISTORY

       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.

LICENSE

       New (3-clause) BSD License

AUTHOR

       BaseX is developed by a bunch of people called 'The BaseX  Team'  <http://basex.org/about-
       us/> led by Christian Gruen <cg@basex.org>.

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

                                         14 October 2011                                 basex(1)