Difference between revisions of "Graphical User Interface"
(→What's Next?: link to documentation => getting started)
|Line 2:||Line 2:|
a the [[Startup]] .
== Create Database ==
== Create Database ==
Revision as of 23:40, 23 January 2011
This small tutorial demonstrates how to launch the graphical user interface (GUI) of BaseX and perform simple XPath queries.
First of all, please launch a GUI instance of BaseX. Double click on the BaseX GUI icon, or run the
basexgui script. Follow this link for more information.
Select Database → New and browse to the factbook.xml file. This XML document is included in the Windows, Mac and ZIP distributions of BaseX, and it contains statistical information on the worlds' countries.
Next, choose the OK button, and BaseX will create a database that you can visually explore.
The introductory video gives you a glimpse of some of the features that the BaseX GUI provides.
Apart from the basic search facilities, BaseX offers far more sophisticated processing options to query your documents. Below are some examples you might give a try. This guide is far from being a comprehensive XQuery reference, but might point you in the right direction.
To execute the following queries, enter them in the XQuery Panel and hit the PLAY button.
XPath provides an easy facility to query your documents in a navigational manner. It is the basic tool of all node-related operations that you encounter when using XQuery. We will start with a trivial example and extend it to our needs.
Find all Countries
tells BaseX to look for all
country elements in the document. The query is introduced by two slashes
//, which trigger the traversal of all document nodes. XPath knows several location steps that determine which nodes to consider next for evaluation.
As an example,
//country is equivalent to
Find the Names of all Countries
This query returns the
name children of all
country elements. The result looks as follows:
Find the Names of all Cities in Switzerland
The following query uses a predicate
[...] to filter all
country nodes which have a
name child, the string value of which is "Switzerland":
//country[name = "Switzerland"]
To return all cities of the resulting element node, the query can be extended by a trailing
//country[name = "Switzerland"]//city
For more information on BaseX, XQuery and XPath, we invite you to...