.\" Text automatically generated by txt2man .TH basex 1 "09 May 2016" "" "The XML Database" .SH NAME \fBbasex \fP- XML database system and XPath/XQuery processor (command line mode) \fB .SH SYNOPSIS .nf .fam C \fBbasex\fP [\fB-bcdiIoqrRstuvVwxXz\fP] [\fIinput\fP] .fam T .fi .fam T .fi .SH DESCRIPTION \fBbasex\fP is a fast and powerful, yet light-weight and platform independent XML database system and XPath/XQuery processor. .SH OPTIONS A short description of option can be obtained from .PP .nf .fam C $ basex \-h .fam T .fi or by browsing http://docs.basex.org/wiki/Command-Line_Options#Standalone .SH DATABASE COMMANDS A list of supported Database commands can be obtained from .PP .nf .fam C $ basex \-c help .fam T .fi or by browsing http://docs.basex.org/wiki/Commands .SH EXAMPLES .IP \(bu 3 XQuery evaluation (no database, no interaction, script mode): .PP .nf .fam C $ basex 19+23 42 $ basex -q "{ 23+19 }" 42 .fam T .fi .IP \(bu 3 Import an XML file into database, output its content (query its root) and be verbose: .PP .nf .fam C $ basex \-Vc "CREATE DB input /usr/share/doc/basex/examples/input.xml; XQUERY /" Database 'input' created in 136.84 ms. XML

Databases & XML

Assignments
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. .fam T .fi .IP \(bu 3 XPath evaluation (with existing database): .PP .nf .fam C $ basex \-c "OPEN input; XQUERY //li[1]"
  • Exercise 1
  • .fam T .fi .IP \(bu 3 Retrieve XML from the web and perform XPath query: .PP .nf .fam C $ basex \-q "doc('http://files.basex.org/examples/input.xml')//li"
  • Exercise 1
  • Exercise 2
  • .fam T .fi .IP \(bu 3 W3C XQuery Full-Text (make use of full-text index and perform fuzzy query with a typing error): .PP .nf .fam C $ 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] Assignments Query executed in 8.37 ms. .fam T .fi .IP \(bu 3 Update the database and show result: .PP .nf .fam C > 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
    Debian rules
    Query executed in 1.01 ms. .fam T .fi .IP \(bu 3 Open an \fIinput\fP xml file, execute a query and write result into file: .PP .nf .fam C $ basex \-i /usr/share/doc/basex/examples/input.xml \-q //div \-o out.xml $ cat out.xml
    Assignments
    .fam T .fi .IP \(bu 3 Query an already existing database called '\fIinput\fP'. If a file named '\fIinput\fP' exists in current working directory it takes precedence: .PP .nf .fam C $ basex \-i input \-q //div
    Assignments
    .fam T .fi .IP \(bu 3 Let \fBbasex\fP process query \fIinput\fP from standard in: .PP .nf .fam C $ echo '19+23' | basex \-q\- 42 .fam T .fi .IP \(bu 3 Execute commands from script file: .PP .nf .fam C $ cat commands.txt create db debian xquery / list $ basex \-C commands.txt | grep debian debian 1 4639 debian.xml .fam T .fi .IP \(bu 3 Parse non well-formed HTML (needs libtagsoup-java installed): .PP .nf .fam C $ cat bad.html $ basex \-c 'set parser html; set htmlopt method=html,nons=true; create db htmldb bad.html' $ basex \-q "doc('htmldb')" Alternative: $ basex -q 'declare option db:parser "html"; doc("bad.html")' For further documentation on how to configure the HTML Parser refer to http://docs.basex.org/wiki/Parsers#HTML_Parser .fam T .fi .SH SEE ALSO \fBbasexgui\fP(1), \fBbasexserver\fP(1), \fBbasexclient\fP(1) .TP .B ~/.\fBbasex\fP BaseX (standalone and server) properties .TP .B ~/.basexgui BaseX additional GUI properties .TP .B ~/.basexperm user name, passwords, and permissions .TP .B ~/.basexevents contains all existing events .TP .B ~/BaseXData Default database directory .TP .B ~/BaseXData/.logs Server logs .TP .B ~/BaseXRepo Package repository .PP BaseX Documentation Wiki: http://docs.basex.org .SH 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. .SH LICENSE New (3-clause) BSD License .SH AUTHOR BaseX is developed by a bunch of people called 'The BaseX Team' led by Christian Gruen . .PP The man page was written by Alexander Holupirek while packaging BaseX for Debian GNU/Linux.