File: basex.1

package info (click to toggle)
basex 7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,924 kB
  • sloc: java: 86,870; xml: 921; sh: 149; makefile: 5
file content (283 lines) | stat: -rw-r--r-- 5,786 bytes parent folder | download | duplicates (4)
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
.\"Text automatically generated by txt2man
.TH basex 1 "26 June 2012" "" "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-bcdiLosuvVwxz\fP] [\fIquery\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/Startup_Options#BaseX_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 \-Lq 19+23
   42
   $ basex \-Lq "<answer>{ 23+19 }</answer>"
   <answer>42</answer>

.fam T
.fi
.IP \(bu 3
Import an XML file into database, output its content (\fIquery\fP 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.
    <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.

.fam T
.fi
.IP \(bu 3
XPath evaluation (with existing database):
.PP
.nf
.fam C
    $ basex \-Lc "OPEN input; XQUERY //li[1]"
    <li>Exercise 1</li>

.fam T
.fi
.IP \(bu 3
Retrieve XML from the web and perform XPath \fIquery\fP:
.PP
.nf
.fam C
    $ basex \-Lq "doc('http://files.basex.org/examples/input.xml')//li"
    <li>Exercise 1</li>
    <li>Exercise 2</li>

.fam T
.fi
.IP \(bu 3
W3C XQuery Full-Text (make use of full-text index and perform fuzzy \fIquery\fP 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] 
    <b>Assignments</b>
    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
    <div align="right">
      <b>Debian rules</b>
    </div>
    Query executed in 1.01 ms.

.fam T
.fi
.IP \(bu 3
Open an input xml file, execute a \fIquery\fP and write result into file:
.PP
.nf
.fam C
    $ 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>

.fam T
.fi
.IP \(bu 3
Query an already existing database called 'input'. If a file named 'input' exists in current working directory it takes precedence:
.PP
.nf
.fam C
    $ basex \-Li input \-q //div
    <div align="right">
      <b>Assignments</b>
      <ul>
        <li>Exercise 1</li>
        <li>Exercise 2</li>
      </ul>
    </div> 

.fam T
.fi
.IP \(bu 3
Let \fBbasex\fP process \fIquery\fP input from standard in:
.PP
.nf
.fam C
   $ echo '19+23' | basex \-Lq\-
   42

.fam T
.fi
.IP \(bu 3
Execute commands from script file:
.PP
.nf
.fam C
   $ cat commands.txt
   create db debian <debian_db/>
   xquery /
   list
   $ basex \-LC commands.txt | grep debian
   <debian_db/>
   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         
   <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

.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'
<http://basex.org/about-us/> led by Christian Gruen <cg@basex.org>.
.PP
The man page was written by Alexander Holupirek <alex@holupirek.de> while packaging BaseX for Debian GNU/Linux.