Changes

Jump to navigation Jump to search
2,795 bytes removed ,  12:22, 23 January 2016
no edit summary
This article is part of the [[Getting Started]] Section.
It lists all database commands supported by BaseX.
Commands can e.g. be executed from the [[Command-Line Options#BaseX_Standalone|Command Line]],
[[#Command Scripts|Scripts]], the [[Clients]], [[REST]], the input field in the [[GUI]]
and other ways. If the GUI is used, all commands that are triggered by the GUI itself
will show up in the [[GUI#Visualizations|Info View]].
The [[User_Management|Permission]] fields indicate which
rights are required by a user to perform a command in the client/server architecture.
 
=Basics=
 
==Command Scripts==
 
Multiple commands can be written down in a single line – separated by semicolons – or stored as command script. Database commands in both string and XML syntax can be placed in a text file and stored as file with the BaseX command script suffix {{Code|.bxs}}. If the path to a script file is passed on to BaseX on command-line, or if it is opened in the GUI editor, it will automatically be recognized and evaluated as such.
 
===String Syntax===
 
Lines starting with <code>#</code> are interpreted as comments and are skipped. The following script creates a database, adds two documents to it and performs a query:
 
<pre class="brush:xml">
CREATE DB test
ADD input.xml
ADD TO embedded.xml <root>embedded</root>
# run query
XQUERY count(//text())
</pre>
 
===XML Syntax===
 
The string syntax is limited when XML snippets need to be embedded in a command,
or when complex queries are to be specified.
 
This is why database commands can also be specified in XML.
Multiple commands can be enclosed by a {{Code|<commands/>}} root element:
 
<pre class="brush:xml">
<commands>
<create-db name='test'/>
<add>input.xml</add>
<add path='embedded.xml'><root>embedded</root></add>
<xquery>count(//text())</xquery>
</commands>
</pre>
 
==Glob Syntax==
 
Some commands support the glob syntax to address more than one database or user. Question marks and asterisks can be used to match one or more characters, and commas can be used to separate multiple patterns. Some examples:
 
* {{Code|AB?}} addresses all names with the characters {{Code|AB}} and one more character.
* {{Code|*AB}} addresses all names ending with the characters {{Code|AB}}.
* {{Code|X*,Y*,Z*}} addresses all names starting with the characters {{Code|X}}, {{Code|Y}}, or {{Code|Z}}.
 
==Valid Names==
 
Database and user names follow the same naming constraints: Names are restricted to ASCII characters. They must at least have one character, and they may contain letters, numbers and any of the special characters <code>!#$%&'()+-=@[]^_`{}~</code>. The following characters are reserved for other features:
 
* <code>,?*</code>: [[#Glob Syntax|glob syntax]]
* <code>;</code>: Separator for multiple database commands on the This article is part of the [[Getting Started]] Section.
It lists all database commands supported by BaseX.
Commands can e.g. be executed from the [[Command-Line Options#BaseX_Standalone|Command Line]],
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu