basex(1)

NAME

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

SYNOPSIS

   basex [-bcdiIoqrRstuvVwxXz] [input]

DESCRIPTION

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

OPTIONS

   A short description of option can be obtained from

       $ basex -h

   or        by        browsing        http://docs.basex.org/wiki/Command-
   Line_Options#Standalone

DATABASE COMMANDS

   A list of supported Database commands can be obtained from

       $ basex -c help

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

EXAMPLES

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

      $ basex 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 136.84 ms.
       <html>
         <!-- Header -->
         <head id="0">
           <title>XML</title>
         </head>
         <!-- Body -->
         <body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC">
           <h1>Databases &amp; 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: 5.08 ms
       Compiling: 27.2 ms
       Evaluating: 0.87 ms
       Printing: 13.7 ms
       Total Time: 46.86 ms

       Hit(s): 1 Item
       Updated: 0 Items
       Printed: 358 Bytes

       Query executed in 42.52 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('http://files.basex.org/examples/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.1 [Standalone]
       Try "help" to get more information.

       > SET FTINDEX on
       Full-Text Index: ON
       > CREATE DB input /usr/share/doc/basex/examples/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.

   *  Open an input xml file, execute a query and write result into file:

       $ basex -i /usr/share/doc/basex/examples/input.xml -q //div -o out.xml
       $ cat out.xml
       <div align="right">
         <b>Assignments</b>
         <ul>
           <li>Exercise 1</li>
           <li>Exercise 2</li>
         </ul>
       </div>

   *  Query an already existing database called 'input'. If a  file  named
      'input' exists in current working directory it takes precedence:

       $ basex -i input -q //div
       <div align="right">
         <b>Assignments</b>
         <ul>
           <li>Exercise 1</li>
           <li>Exercise 2</li>
         </ul>
       </div>

   *  Let basex process query input from standard in:

      $ echo '19+23' | basex -q-
      42

   *  Execute commands from script file:

      $ cat commands.txt
      create db debian <debian_db/>
      xquery /
      list
      $ basex -C commands.txt | grep debian
      <debian_db/>
      debian              1          4639       debian.xml

   *  Parse non well-formed HTML (needs libtagsoup-java installed):

      $ cat bad.html
      <html>
        <ul>
          <li>A
          <li>B
        </ul>
      </html>

      $ basex -c 'set parser html; set htmlopt method=html,nons=true; create db htmldb bad.html'
      $ basex -q "doc('htmldb')"
      <html>
        <body>
          <ul>
            <li>A</li>
            <li>B</li>
          </ul>
        </body>
      </html>

      Alternative:

      $ basex -q 'declare option db:parser "html"; doc("bad.html")'
      <html xmlns="http://www.w3.org/1999/xhtml">
        <body>
          <ul>
            <li>A</li>
            <li>B</li>
          </ul>
        </body>
      </html>

      For further documentation on how to configure the HTML Parser refer to
      http://docs.basex.org/wiki/Parsers#HTML_Parser

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 <[email protected]>.

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

                              09 May 2016                         basex(1)



Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.


Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.


Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.