Changes

Jump to navigation Jump to search
441 bytes added ,  16:05, 10 January 2011
no edit summary
To get familiar with BaseX we suggest to execute the following basic operations.
===Create Creating a database===
* To create a database you need an XML document, e.g. [http://www.w3.org/XML/Binary/2005/03/test-data/Over100/factbook.xml factbook.xml].
* Save this document to the /basex directory.
Databases are stored in the BaseXData directory which is located in your home folder. Depending on your operating system the location of your home folder varies. For example, on a mac it's /Users/John, if your name is John.
===Execute Executing a query===
The [[Commands|xquery]] command lets you run a query.
* For example, this query returns all country nodes in the currently opened database.
</code>
===Create Creating a new database / switch between databases===
Now we will create another database. You can find the example document here: [http://phobos101.inf.uni-konstanz.de/basex/demo].
: > xquery //people/person/name
</code>
 
===Switching the database===
* You can explicitly query the factbook database with the doc()-funtion, no matter what the current context is.
<code>
: > xquery doc("factbook")//country
</code>
 
* Otherwise, to set factbook as the current context, execute the following:
<code>
: > open factbook
</code>
 
* To list the current context, type:
<code>
: > show databases
</code>
 
That yields the following lines:
 
<pre>
1 opened database(s):
- factbook (1x)
</pre>
 
===Close or delete a database===
administrator, Bureaucrats, editor, reviewer, Administrators
408

edits

Navigation menu