BaseX : Tutorial for using an XML Native Database Management System

XML is defined as a textual structured format for storing, representing and communicating data. The XML format is based on opening and closing tags for enclosing data content. As opposed to traditional databases, XML documents are portable and can be opened on any platform using any programming language.

BaseX is a native and light-weight XML database management system and XQuery processor. BaseX is specialized in storing, querying, and visualizing large XML documents. The XML DBMS is platform-independent and distributed under a free software license.

In this tutorial, we will show you how to install and use BaseX as well as to submit xPath or xQueries to the DBMS.

1 Download the BaseX DBMS from the link below, save it to your computer ( size is 9 Megs).
[info]http://files.basex.org/releases/7.7.2/BaseX772.exe[/info]

2 Double Click to Install, Follow on screen instructions to complete the installation. Make sure that you set a password and Data correctly. ( default password is admin ).
baseX-how-install1

3 Once completed the installation, Double click on the icon for BaseX to launch it. BaseX should look as below:
baseX-how-install2

4 Download the following XML file (factbook.xml) that can be used for testing. Save the on your PC, preferably with the XML data folder you have created or chosen within step 2.
[info]Download factbook.xml[/info]

5 In BaseX, Choose : Database–>Open and Manage …. as shown below,
baseX-how-install3

Choose Yes if asked that no database exists ….

6 Browse for the factbook.xml file that you have downloaded. Click Ok once done.
baseX-how-install5

7 To use xPath, type in the following xPath Expression within the Editor window: //name Then click the Green button. The results would be shown below:
baseX-how-install6

8 To use or practice xQuery, Type in the following statements instead inside the editor:

for $x in doc("factbook")//country
let $var1 :=number($x/@population)
where $var1<1000000
order by $x/@population
return $x/name

Click the Green Button to execute, the results would be shown below:
baseX-how-to-use-xQuery

Latest Comments

Leave a Reply

Your email address will not be published. Required fields are marked *