Difference between revisions of "Graphical User Interface"
Line 28: | Line 28: | ||
As an example, <code>//country</code> is equivalent to <code>/descendant::country</code>. | As an example, <code>//country</code> is equivalent to <code>/descendant::country</code>. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==== Find the Names of all Cities in Switzerland ==== | ==== Find the Names of all Cities in Switzerland ==== | ||
Line 46: | Line 38: | ||
<code> //country[name = "Switzerland"]//city</code> | <code> //country[name = "Switzerland"]//city</code> | ||
+ | |||
+ | == Visualizations == | ||
+ | |||
+ | The BaseX GUI offers various visualizations, | ||
+ | which help you to explore your XML data instances from different perspectives: | ||
+ | |||
+ | <table cellpadding="0" cellspacing="0"><tr><td valign="top" width="49%"> | ||
+ | [[Image:TextView.jpg|thumb|Text View]] | ||
+ | ;→ ''Text'' | ||
+ | :Displays query results and other textual output. Query results can be saved in a file. | ||
+ | </td><td valign="top" width="2%"> </td><td valign="top" width="49%"> | ||
+ | [[Image:MapView.jpg|thumb|Map View]] | ||
+ | ;→ ''Map'' | ||
+ | :This visualization represents all data in a TreeMap. All nodes of the XML document are represented as rectangles, filling the complete area. You can choose one of the following layout algorithms in the Menu ''Options'' → ''Map Layout'': Split, Strip, Squarified, Slice&Dice and Binary Layout. | ||
+ | </td></tr><tr><td valign="top"> | ||
+ | [[Image:TreeView.jpg|thumb|Tree View]] | ||
+ | ;→ ''Tree'' | ||
+ | :This visualization displays all XML nodes in a top down tree with edges and nodes. You can change some settings of the Tree in the Menu ''Options'' → ''Tree Options''. | ||
+ | </td><td valign="top" width="2%"> </td><td valign="top" width="49%"> | ||
+ | [[Image:FolderView.jpg|thumb|Folder View]] | ||
+ | ;→ ''Folder'' | ||
+ | :This visualization displays all nodes in a usual folder view. | ||
+ | </td></tr><tr><td valign="top"> | ||
+ | [[Image:Scatterplot.jpg|thumb|Scatterplot View]] | ||
+ | ;→ ''Plot'' | ||
+ | :This visualization displays all nodes in a scatterplot. There are drop down menus to configure the allocation of the Y- and X-axis. | ||
+ | </td><td valign="top" width="2%"> </td><td valign="top" width="49%"> | ||
+ | [[Image:TableView.jpg|thumb|The Table View]] | ||
+ | ;→ ''Table'' | ||
+ | :This visualization displays all nodes in a table with rows and columns. | ||
+ | </td></tr><tr><td valign="top"> | ||
+ | [[Image:ExplorerView.jpg|thumb|Explorer View]] | ||
+ | ;→ ''Explorer'' | ||
+ | :With this visualization you can explore the contents of your database via drop-down menus, search fields and some sliders. | ||
+ | </td><td valign="top" width="2%"> </td><td valign="top" width="49%"> | ||
+ | [[Image:InfoView.png|thumb|Info View]] | ||
+ | ;→ ''Info'' | ||
+ | :This visualization gives details on the execution of database commands and XQuery expressions. | ||
+ | </td></tr></table> | ||
== What's Next? == | == What's Next? == |
Revision as of 07:22, 22 September 2011
The BaseX homepage gives you a visual impression of the graphical user interface (GUI) of BaseX, and the introductory video presents some of the interactive features that the BaseX GUI provides. This small tutorial demonstrates how easy it is to perform simple XPath queries.
Contents
Startup
First of all, please launch a GUI instance of BaseX. Depending on your operating system, double click on the BaseX GUI start icon or run the basexgui
script. Follow this link for more information (or check out the additional command-line options).
Create Database
Select Database → New and browse to the factbook.xml document. This XML file contains statistical information on the worlds' countries. It is included in the official releases of BaseX, and it can also be downloaded here.
Next, choose the OK button, and BaseX will create a database that you can visually explore.
Example Queries
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
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
//country
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 /descendant::country
.
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 //city
path:
//country[name = "Switzerland"]//city
Visualizations
The BaseX GUI offers various visualizations, which help you to explore your XML data instances from different perspectives:
|
| |
|
| |
|
| |
|
|
What's Next?
For more information on BaseX, XQuery and XPath, we invite you to...
- check out more Documentation, and
- have a look at the XQuery Tutorial at W3Schools.