Difference between revisions of "Databases"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | + | ==Introduction== | |
− | + | In BaseX you can create databases with single XML files or | |
− | |||
databases with a bunch of XML files, called collections. | databases with a bunch of XML files, called collections. | ||
− | + | ||
− | + | ==Database== | |
+ | |||
− | + | ==Collection== | |
+ | ===Creation of a collection=== | ||
<p>You can create a collection either within the GUI or in the console version of BaseX.</p> | <p>You can create a collection either within the GUI or in the console version of BaseX.</p> | ||
<ul> | <ul> | ||
Line 13: | Line 14: | ||
</ul> | </ul> | ||
− | + | ===Manage Collections=== | |
<p>Additionaly to the creation with your choosen xml files you can start with creating an empty | <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> | collection and then add your xml files to it. Note that the <code>add</code> and <code>delete</code> | ||
Line 25: | Line 26: | ||
<p>For more information see our [[BaseX & Collections|collection tutorial]].</p> | <p>For more information see our [[BaseX & Collections|collection tutorial]].</p> | ||
− | + | ===Access documents in collections=== | |
<p>The XQuery <code>collection()</code> function can be used to access documents in collections:</p> | <p>The XQuery <code>collection()</code> function can be used to access documents in collections:</p> | ||
<ul> | <ul> |
Revision as of 14:57, 7 December 2010
Contents
Introduction
In BaseX you can create databases with single XML files or databases with a bunch of XML files, called collections.
Database
Collection
Creation of a collection
You can create a collection either within the GUI or in the console version of BaseX.
- GUI: choose File » New » Browse » choose directory and press OK
- Console: enter
basex -c "create db dbname /path/to/collection"
Manage Collections
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 add
and delete
commands just operate on an opened database.
- Create an empty database:
create db example
- Add a document:
add example.xml
- Delete a document:
delete example.xml
For more information see our collection tutorial.
Access documents in collections
The XQuery collection()
function can be used to access documents in collections:
- Returning all documents of collection ("dbname"):
for $doc in collection("dbname") return base-uri($doc)
- Access a specific document ("test") in collection ("dbname"):
collection("dbname/test")//*