1,596 bytes added
, 15:00, 6 December 2010
<h3>Introduction</h3>
<p>In BaseX you can create databases with single XML files or
databases with a bunch of XML files, called collections.
The creation, management and access of these collections is described
in the follwing sections.</p>
<h3>Creation of a collection</h3>
<p>You can create a collection either within the GUI or in the console version of BaseX.</p>
<ul>
<li><b>GUI</b>: choose File » New » Browse » choose directory and press OK</li>
<li><b>Console</b>: enter <code>basex -c "create db dbname /path/to/collection"</code><br/></li>
</ul>
<h3>Manage Collections</h3>
<p>Additionaly to the creation with your choosen xml files you can start with creating an empty
collection and then add your xml files to it. Note that the <code>add</code> and <code>delete</code>
commands just operate on an opened database.</p>
<ul>
<li>Create an empty database: <code>create db example</code></li>
<li><a href="commands#add">Add</a> a document: <code>add example.xml</code></li>
<li><a href="commands#delete">Delete</a> a document: <code>delete example.xml</code></li>
</ul>
<p>For more information see our <a href="tutcolls">tutorial</a>.</p>
<h3>Access documents in collections</h3>
<p>The XQuery <code>collection()</code> function can be used to access documents in collections:</p>
<ul>
<li>Returning all documents of collection ("dbname"):<br/> <code>for $doc in collection("dbname") return base-uri($doc)</code></li>
<li>Access a specific document ("test") in collection ("dbname"):<br/> <code>collection("dbname/test")//*</code></li>
</ul>