~ludovicc/uj/basex

« back to all changes in this revision

Viewing changes to debian/man/basex.txt

  • Committer: Ludovic Claude
  • Date: 2011-02-20 20:06:43 UTC
  • Revision ID: ludovic.claude@laposte.net-20110220200643-637a86ip3rux9oe2
* Initial

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
NAME
 
2
  basex - XML database system and XPath/XQuery processor (command line mode)
 
3
 
 
4
SYNOPSIS
 
5
  basex [-diosuvVwz] [-cq] [file]
 
6
 
 
7
DESCRIPTION
 
8
  basex is a fast and powerful, yet light-weight and platform independent XML
 
9
  database system and XPath/XQuery processor.
 
10
 
 
11
OPTIONS
 
12
  [file]     Execute the specified XQuery file.
 
13
  -b<pars>   Bind external variables to XQuery expression. Flag may be specified
 
14
             multiple times; key/value pairs are separated by equality signs (=)
 
15
             (-bv=example -q"declare variable $v external; $v")
 
16
  -c<cmd>    Launch database commands and skip interactive mode.
 
17
             The flag should be placed last, as all remaining characters are
 
18
             interpreted as commands. Several commands can be separated by 
 
19
             semicolons.
 
20
  -d         Turn on debugging (to standard error).
 
21
  -i<input>  Open a database or XML document specified by the argument.
 
22
             The opened input may be further processed by an XQuery expression.
 
23
  -o<file>   Command and query output is written to the specified file.
 
24
  -q<expr>   Execute the specified string as XQuery expression. The flag should
 
25
             be placed last, as all remaining characters are interpreted as
 
26
             XQuery.
 
27
  -s<pars>   Specify parameters for serializing XQuery results;
 
28
             see SERIALIZATION for more details. This flag may be specified
 
29
             multiple times; key/value pairs are separated by equality signs (=)
 
30
  -u         Modify original files after evaluating XQuery Update expressions
 
31
  -v         Process information is written to standard output
 
32
  -V         Detailed query information is written to standard output, 
 
33
             including compilation and profiling steps.
 
34
  -w         By default, whitespaces around text nodes are chopped when a 
 
35
             database is created. The flag specifies to suppress chopping.
 
36
  -z         Skip the serialization of XQuery results (may be useful for 
 
37
             analyzing query plans)
 
38
 
 
39
DATABASE COMMANDS
 
40
  A list of supported Database commands can be obtained from
 
41
 
 
42
    $ basex -c help
 
43
 
 
44
  or by browsing http://docs.basex.org/wiki/Commands
 
45
 
 
46
  ADD (AS [name]) (TO [target]) [input]  Add document to database.
 
47
  ALTER [USER|DATABASE] [...]            Alter user password or database name.
 
48
  BACKUP [name]                          Backup database.
 
49
  CLOSE                                  Close current database.
 
50
  CREATE [DATABASE|FS|INDEX|USER] [...]  Create database, index or user.
 
51
  CS [query]                             Evaluate XQuery and set result as new context set.
 
52
  DELETE [name]                          Delete documents from database.
 
53
  DROP [DATABASE|INDEX|USER] [...]       Drop database, index or user.
 
54
  EXIT                                   Exit application.
 
55
  EXPORT [path]                          Export database to XML.
 
56
  FIND [query]                           Evaluate a keyword query.
 
57
  GET [option]                           Show global option.
 
58
  GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]  Grant user permissions.
 
59
  HELP ([command])                       Get help on BaseX commands.
 
60
  INFO ([DATABASE|INDEX|STORAGE])        Show information on current database.
 
61
  KILL [name]                            Kill user sessions.
 
62
  LIST ([path])                          List databases or documents in database.
 
63
  OPEN [path]                            Open database.
 
64
  OPTIMIZE                               Optimize the database.
 
65
  PASSWORD ([password])                  Change password.
 
66
  RESTORE [name]                         Restore database.
 
67
  RUN [path]                             Evaluate file as XQuery.
 
68
  SET [option] ([value])                 Set global options.
 
69
  SHOW [DATABASES|SESSIONS|USERS|BACKUPS]  Show server information.
 
70
  XQUERY [query]                         Evaluate XQuery.
 
71
 
 
72
 
 
73
SERIALIZATION
 
74
  Serialization parameters define how XQuery items and XML nodes are textually
 
75
  output, i.e., serialized. They have been formalized in a W3C XQuery
 
76
  Serialization 3.0 document available at http://www.w3.org/TR/xslt-xquery-serialization-30
 
77
 
 
78
  In BaseX, they can be specified in several ways: 
 
79
  * by using the -s flag of the BaseX command-line clients,
 
80
  * by setting the SERIALIZER option before running a query,
 
81
  * by setting the EXPORTER option before exporting a database,
 
82
  * by setting them via the Output Parameter of the JAX-RX API,
 
83
  * by including them in the prolog of the XQuery expression (since XQuery 3.0), or
 
84
  * by specifying them in the XQuery function file:write().
 
85
 
 
86
  An extensive documentation of all serialization parameters is to be found on:
 
87
  http://docs.basex.org/wiki/Serialization
 
88
 
 
89
  An example would be:
 
90
 
 
91
    method=xml,encoding=CP1252
 
92
 
 
93
EXAMPLES
 
94
  * XQuery evaluation (no database, no interaction, script mode):
 
95
 
 
96
   $ basex -q 19+23
 
97
   42
 
98
   $ basex -q "<answer>{ 23+19 }</answer>"
 
99
   <answer>42</answer>
 
100
 
 
101
  * Import an XML file into database, output its content (query its root) and be verbose:
 
102
 
 
103
    $ basex -Vc "CREATE DB input /usr/share/doc/basex/examples/input.xml; XQUERY /"
 
104
    Database 'input' created in 53.64 ms.
 
105
    <html>
 
106
      <!-- Header -->
 
107
      <head id="0">
 
108
        <title>XML</title>
 
109
      </head>
 
110
      <!-- Body -->
 
111
      <body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC">
 
112
        <h1>Databases & XML</h1>
 
113
        <div align="right">
 
114
          <b>Assignments</b>
 
115
          <ul>
 
116
            <li>Exercise 1</li>
 
117
            <li>Exercise 2</li>
 
118
          </ul>
 
119
        </div>
 
120
      </body>
 
121
      <?pi bogus?>
 
122
    </html>
 
123
    
 
124
    Query: /
 
125
    
 
126
    Compiling:
 
127
    
 
128
    Result: root()
 
129
    
 
130
    Parsing: 0.19 ms
 
131
    Compiling: 9.27 ms
 
132
    Evaluating: 0.33 ms
 
133
    Printing: 3.08 ms
 
134
    Total Time: 12.88 ms
 
135
    Results: 1 Item
 
136
    Updated: 0 Items
 
137
    Printed: 375 Bytes
 
138
    Memory: 5834 KB
 
139
    
 
140
    Query executed in 13.25 ms.
 
141
 
 
142
  * XPath evaluation (with existing database):
 
143
 
 
144
    $ basex -c "OPEN input; XQUERY //li[1]"
 
145
    <li>Exercise 1</li>
 
146
 
 
147
  * Retrieve XML from the web and perform XPath query: 
 
148
 
 
149
    $ basex -q "doc('https://svn.uni-konstanz.de/dbis/basex/tags/6.5/basex/etc/xml/input.xml')//li"
 
150
    <li>Exercise 1</li>
 
151
    <li>Exercise 2</li>
 
152
 
 
153
  * W3C XQuery Full-Text (make use of full-text index and perform fuzzy query with a typing error):
 
154
 
 
155
    $ basex
 
156
    BaseX 6.5 [Standalone]
 
157
    Try "help" to get more information.
 
158
 
 
159
    > SET FTINDEX on 
 
160
    Full-Text Index: ON
 
161
    > CREATE DB input /usr/share/doc/basex/examples/input.xml/input.xml
 
162
    Database 'input' created in 94.42 ms.
 
163
    > XQUERY //b[text() contains text 'Asisgnment' using fuzzy] 
 
164
    <b>Assignments</b>
 
165
    Query executed in 8.37 ms.
 
166
 
 
167
  * Update the database and show result:
 
168
 
 
169
    > XQUERY delete node //ul
 
170
    Query executed in 2.79 ms.
 
171
    > XQUERY replace value of node //b with 'Debian rules'
 
172
    Query executed in 2.94 ms.
 
173
    > XQUERY //div
 
174
    <div align="right">
 
175
      <b>Debian rules</b>
 
176
    </div>
 
177
    Query executed in 1.01 ms.
 
178
 
 
179
SEE ALSO
 
180
  basexgui(1), basexserver(1), basexclient(1)
 
181
 
 
182
  ~/.basex                BaseX (standalone and server) properties
 
183
  ~/.basexgui             BaseX additional GUI properties 
 
184
  ~/.basexperm            user name, passwords, and permissions
 
185
  ~/BaseXData             Default database directory
 
186
  ~/BaseXData/.logs       Server logs
 
187
 
 
188
  BaseX Documentation Wiki: http://docs.basex.org
 
189
 
 
190
HISTORY
 
191
  BaseX started as a research project of the Database and Information Systems
 
192
  Group (DBIS) at the University of Konstanz in 2005 and soon turned into a
 
193
  feature-rich open source XML database and XPath/XQuery processor.
 
194
 
 
195
LICENSE
 
196
  New (3-clause) BSD License
 
197
 
 
198
AUTHOR
 
199
  BaseX is primarily developed by Christian Gruen <christian.gruen@gmail.com> with the help of others listed as
 
200
  The BaseX Team on <http://basex.org/about-us/> 
 
201
 
 
202
  The man page was written by Alexander Holupirek <alex@holupirek.de> in the progress of packaging BaseX for Debian GNU/Linux.