1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
NAME
basex - XML database system and XPath/XQuery processor (command line mode)
SYNOPSIS
basex [-bcdiLosuvVwxz] [query]
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/Startup_Options#BaseX_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 \-Lq 19+23
42
$ basex \-Lq "<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 & 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 \-Lc "OPEN input; XQUERY //li[1]"
<li>Exercise 1</li>
* Retrieve XML from the web and perform XPath query:
$ basex \-Lq "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 \-Li /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 \-Li 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 \-Lq\-
42
* Execute commands from script file:
$ cat commands.txt
create db debian <debian_db/>
xquery /
list
$ basex \-LC 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>
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 <cg@basex.org>.
The man page was written by Alexander Holupirek <alex@holupirek.de> while packaging BaseX for Debian GNU/Linux.
|