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 ).
3 Once completed the installation, Double click on the icon for BaseX to launch it. BaseX should look as below:
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,
Choose Yes if asked that no database exists ….
6 Browse for the factbook.xml file that you have downloaded. Click Ok once done.
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:
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:
Dr. Imed, this post of your’s is of a very rare kind. I’ve been a XQuery fan and have been sort of evangelizing usage of NXD’s, especially Basex. Thanks to you for being probably the first person to write a tutorial. Would like to liaise with you in writing complete web application sample totally in XQuery so that all can appreciate the power of XQuery language applicable in all three tiers of an application.
Regards
Manish.
Certainly Manish ! I would love to write more about xQuery whenever I get sometime for it.
If you have anything to help or we can make a link towards, do please let me know
Imed
Dr imed,thanks for the post.
i was just wondering is there a way by which we could capture /proxy xqueries or xpath queries issued by web applications ,before they hit the backend xml database BasiX,BasiX comes with an option of proxy port but i just cant figure out how to use it.
Any help would be greatly appritiated.