Difference between revisions of "Graphical User Interface"
Line 5: | Line 5: | ||
==Startup== | ==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 <code>basexgui</code> script. | + | 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 <code>basexgui</code> script. Beside that, some more [[Startup#BaseX GUI|startup options]] are available. |
== Create Database == | == Create Database == |
Revision as of 21:53, 31 March 2012
This page is part of the Getting Started Section. 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. Beside that, some more startup options are available.
Create Database
Select Database → New and browse to an XML document of your choice. As an example, the factbook.xml
document, which contains statistical information on the worlds' countries, 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.
Realtime Options
Via the Options menu, you can change the way how queries are executed and visualized:
- Realtime Execution: If realtime execution is enabled, your searches and queries will be executed with each key click and the results will be instantly shown.
- Realtime Filtering: If enabled, all visualizations will be limited to the actual results in realtime. If this feature is disabled, the query results are highlighted in the visualizations and can be ecplicitly filtered with the 'Filter' button.
Querying
Keyword Search
The Keyword Search can be executed in the Search mode in the combo box of the main window. This options allows for a simple, keyword-based search in the opened database.
The following syntax is supported:
Query | Description |
---|---|
world
|
Find tags and texts containing world
|
=world
|
Find exact matching text nodes |
~world
|
Find text nodes similar to world
|
@world
|
Find attributes and attribute values |
@=world
|
Find exact attribute values |
"united world"
|
Find tags and texts containing the phrase "united world"
|
XPath/XQuery
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 press ENTER or click on the START 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.
Example: Find 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. The queries //country
andd /descendant::country
will return the same results.
Example: Find 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:
Text
|
Map
| |
Tree
|
Folder
| |
Plot
|
Table
| |
Explorer
|
Info
|
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.