Difference between revisions of "Graphical User Interface"

From BaseX Documentation
Jump to navigation Jump to search
(44 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This page is part of the [[Getting Started]] Section.
 
This page is part of the [[Getting Started]] Section.
The BaseX homepage gives you a [http://basex.org/products/gui visual impression] of the graphical user interface (GUI) of BaseX,
 
and the [http://www.youtube.com/watch?v=xILHKGPGaJ4&hd=1 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.
 
  
==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. Beside that, some more [[Startup#BaseX GUI|startup options]] are available.
+
First of all, 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==
+
Select ''Database'' → ''New'' and browse to an XML document of your choice. As an example, you can start with the {{Code|factbook.xml}} document, which contains statistical information on the worlds' countries. It is included in our full releases (in the {{Code|etc}} directory) and can also be [http://files.basex.org/xml/factbook.xml downloaded] (1.3 MB). If you type nothing in the input field, an empty database will be created. Next, choose the ''OK'' button, and the database will be created.
  
Select ''Database'' → ''New'' and browse to an XML document of your choice. As an example, you can start with the {{Code|factbook.xml}} document, which contains statistical information on the worlds' countries. It is included in our official releases and can also be [http://files.basex.org/xml/factbook.xml downloaded] (1.3 MB). If you type nothing in the input field, an empty database will be created. Next, choose the ''OK'' button, and BaseX will create a database that you can visually explore and query.
+
If no XML document is available, the [[#Text Editor|Text Editor]] can also be used to create an initial XML document. After saving the entered XML document to disk, it can be supplied as database input in the above dialog.
  
If no XML document is available, the [[#Text Editor|Text Editor]] can also be used to create an initial XML document. After saving the entered XML document to harddisk, it can be specified in the above dialog.
+
=Input Bar=
  
==Realtime Options==
+
On top of the main window, you can find an input bar. The attached dropdown menu provides three modes: '''Find''', '''XQuery''' and '''Command''':
  
Via the ''Options'' menu, you can change the way how queries are executed and visualized:
+
[[Image:InputBar.png|Input Bar]]
  
* '''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.
+
The upcoming example queries can all be used with an instance of the <code>factbook</code> database:
* '''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.
 
[[Category:GUI]]
 
  
==Querying==
+
==Find==
  
===Keyword Search===
+
In the '''Find''' mode, the input bar can be used to find single elements and texts in the currently opened database. The following syntax is supported:
  
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:
 
 
{| class="wikitable"
 
{| class="wikitable"
 
!Query
 
!Query
 
!Description
 
!Description
 
|-
 
|-
|<code>world</code>
+
|<code>city</code>
|Find tags and texts containing {{Code|world}}
+
|Find elements named {{Code|city}}, and texts containing this token.
 
|-
 
|-
|<code>=world</code>
+
|<code>=India</code>
|Find exact matching text nodes
+
|Find texts matching the exact string {{Code|India}}.
 
|-
 
|-
|<code>~world</code>
+
|<code>~Cing</code>
|Find text nodes similar to {{Code|world}}
+
|Find texts equal or similar to the token {{Code|Cingdom}}.
 
|-
 
|-
|<code>@world</code>
+
|<code>id</code>
|Find attributes and attribute values
+
|Find attributes named {{Code|id}} and attribute values containing this token.
 
|-
 
|-
|<code>@=world</code>
+
|<code>@=f0_119</code>
|Find exact attribute values
+
|Find attribute values matching the exact string {{Code|f0_119}}.
 
|-
 
|-
|<code>"united world"</code>
+
|<code>"European Chinese"</code>
|Find tags and texts containing the phrase {{Code|"united world"}}
+
|Find texts containing the phrase {{Code|"European Chinese"}}.
 +
|-
 +
|<code>//city</code>
 +
|Leading slash: Interpret the input as XPath expression (see below).
 
|}
 
|}
  
===XPath/XQuery===
+
==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.
+
In the '''XQuery''' mode, XPath and XQuery expressions can be entered in the input bar.
  
To execute the following queries, enter them in the XQuery Panel and press ENTER or click on the START button.
+
To evaluate the following example queries: enter them in the input bar, 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.
+
{| class="wikitable"
 +
!Query
 +
!Description
 +
|-
 +
|<code>//country</code>
 +
|Return all <code>country</code> elements.
 +
|-
 +
|<code>//country[name = "Switzerland"]</code>
 +
|Return the <code>country</code> element of "Switzerland".
 +
|-
 +
|<code>for $city in //city<br/>where $city/population > 1000000<br/>order by $city ascending<br/>return $city/name</code>
 +
|Return the names of all cities with a population larger than one million and order the results by the name of the city.
 +
|}
  
''' Example: Find Countries '''
+
==Command==
  
<pre class="brush:xquery">//country</pre>
+
In the '''Command''' mode, [[Commands|BaseX Commands]] can be entered and executed. Just try the following examples:
  
tells BaseX to look for all <code>country</code> elements in the document. The query is introduced by two slashes <code>//</code>, which trigger the traversal of all document nodes. The queries {{Code|//country}} andd {{Code|/descendant::country}} will return the same results.
+
* <code>INFO</code>: Returns system information.
 +
* <code>CREATE DB TEST</code>: Creates an empty database named "TEST".
 +
* <code>LIST</code>: Lists all databases.
  
''' Example: Find Cities in Switzerland '''
+
=Text Editor=
  
The following query uses a '''predicate''' <code>[...]</code> to filter all <code>country</code> nodes which have a <code>name</code> child, the string value of which is "Switzerland":
+
The built-in text editor is a helpful tool for writing [[XQuery]] code that spans multiple lines or files. It can also be used to edit XML documents, [[Commands#Basics|Command Scripts]], and any other textual files:
  
<pre class="brush:xquery">//country[name = "Switzerland"]</pre>
+
* XQuery and XML files will be '''parsed''' with each key click, and '''errors''' will be highlighted.
 +
* XQuery and command scripts can be '''executed''' by clicking on the green triangle.
 +
* '''Syntax highlighting''' is available for XQuery, XML, JSON and JavaScript files.
  
To return all cities of the resulting element node, the query can be extended by a trailing <code>//city</code> path:
+
Numerous [[Shortcuts|keyboard shortcuts]] are available to speed up editing and debugging.
  
<pre class="brush:xquery">//country[name = "Switzerland"]//city</pre>
+
==Project View==
  
===Text Editor===
+
The Project View is attached to the editor panel. It displays all files of the current project directory in a tree structure. Files can be renamed and deleted by right-clicking on the files. The project directory can be changed as well; the most recent directories will be kept in the history.
  
The text editor can be used to type in [[XQuery]] expressions, [[Commands#Basics|Command Scripts]], XML documents, or any other text files. Query files and XML documents can be started by clicking on the green triangle. They will automatically parsed with each key click, and errors will be highlighted. Various [[Shortcuts|keyboard shortcuts]] are available to speed up editing and debugging.
+
All XQuery files in the project directory will be parsed in the background. Buggy XQuery modules, and files importing these modules, will be marked red. With the text fields on top, you can interactively search for file names and contents.
  
==Visualizations==
+
=Realtime Options=
 +
 
 +
Via the ''Options'' menu, you can change 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 explicitly filtered with the 'Filter' button.
 +
 
 +
=Visualizations=
  
 
The BaseX GUI offers various visualizations,
 
The BaseX GUI offers various visualizations,
 
which help you to explore your XML data instances from different perspectives:
 
which help you to explore your XML data instances from different perspectives:
  
<table cellpadding="0" cellspacing="0"><tr><td valign="top" width="49%">
+
<table cellpadding="0" cellspacing="10"><tr><td valign="top">
[[Image:TextView.jpg|thumb|Text View]]
+
[[Image:Result.png|thumb|Text View]]
  
'''Text'''
+
'''Result'''
 
:Displays query results and other textual output. Query results can be saved in a file.
 
:Displays query results and other textual output. Query results can be saved in a file.
</td><td valign="top" width="2%">&nbsp;</td><td valign="top" width="49%">
+
</td><td valign="top">
[[Image:MapView.jpg|thumb|Map View]]
+
[[Image:Map.png|thumb|Map View]]
  
 
'''Map'''
 
'''Map'''
:This visualization represents all data in a [http://en.wikipedia.org/wiki/Treemap TreeMap]. All nodes of the XML document are represented as rectangles, filling the complete area. You can choose different layout algorithms in the Menu ''Options'' → ''Map Layout''.
+
:Displays all data in a [http://en.wikipedia.org/wiki/Treemap TreeMap]. All nodes of the XML document are represented as rectangles, filling the complete area. You can choose different layout algorithms in the Menu ''Options'' → ''Map Layout''.
 
</td></tr><tr><td valign="top">
 
</td></tr><tr><td valign="top">
[[Image:TreeView.jpg|thumb|Tree View]]
+
[[Image:Tree.png|thumb|Tree View]]
  
 
'''Tree'''
 
'''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''.
+
: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%">&nbsp;</td><td valign="top" width="49%">
+
</td><td valign="top">
[[Image:FolderView.jpg|thumb|Folder View]]
+
[[Image:Folder.png|thumb|Folder View]]
  
 
'''Folder'''
 
'''Folder'''
:This visualization displays all nodes in an Explorer-like folder view. Nodes can be expanded or closed by clicking on the arrows.
+
:Displays all nodes in an Explorer-like folder view. Nodes can be expanded or closed by clicking on the arrows.
 
</td></tr><tr><td valign="top">
 
</td></tr><tr><td valign="top">
[[Image:Scatterplot.jpg|thumb|Scatterplot View]]
+
[[Image:Scatterplot.png|thumb|Scatterplot View]]
  
 
'''Plot'''
 
'''Plot'''
:This visualization displays all nodes in a scatterplot, which is particularly helpful if you want to explore analyze your data. Three drop down menus allow custom axis assignments.
+
:Displays all nodes in a scatterplot, which is particularly helpful if you want to explore analyze your data. Three drop down menus allow custom axis assignments.
</td><td valign="top" width="2%">&nbsp;</td><td valign="top" width="49%">
+
</td><td valign="top">
[[Image:TableView.jpg|thumb|The Table View]]
+
[[Image:Table.png|thumb|The Table View]]
  
 
'''Table'''
 
'''Table'''
:This visualization comes in handy if your data is highly regular. It displays all nodes in a table with rows and columns. Different assignments can be chosen by clicking on the arrow in the right upper corner.
+
:Comes in handy if your data is highly regular. It displays all nodes in a table with rows and columns. Different assignments can be chosen by clicking on the arrow in the right upper corner.
 
</td></tr><tr><td valign="top">
 
</td></tr><tr><td valign="top">
[[Image:ExplorerView.jpg|thumb|Explorer View]]
+
[[Image:Explorer.png|thumb|Explorer View]]
  
 
'''Explorer'''
 
'''Explorer'''
:With this visualization you can explore the contents of your database via drop-down menus, search fields and double sliders.
+
:Can be used to explore the contents of your database via drop-down menus, search fields and double sliders.
</td><td valign="top" width="2%">&nbsp;</td><td valign="top" width="49%">
+
</td><td valign="top">
 
[[Image:InfoView.png|thumb|Info View]]
 
[[Image:InfoView.png|thumb|Info View]]
  
 
'''Info'''
 
'''Info'''
:This view is helpful for analyzing the query plans of your XQuery expressions. It also displays information on the compilation and evaluation of queries.
+
:Helpful for analyzing the query plans of your XQuery expressions. It also displays information on the compilation and evaluation of queries.
 
</td></tr></table>
 
</td></tr></table>
  
==What’s Next?==
+
=Look and Feels=
 +
 
 +
<table>
 +
  <tr>
 +
    <td>
 +
By default, the Look and Feel of your operating system will be used in the GUI.
 +
In the ''Preferences'' dialog, you can choose among some more window themes.
 +
 
 +
The [http://www.jtattoo.net/ScreenShots.html JTattoo library] offers some more
 +
look and feels. If you download and copy the JTattoo jar file into the {{Code|lib}}
 +
directory provided by the ZIP and EXE distribution of BaseX,
 +
13 additional looks and feels will get available.
 +
    </td>
 +
    <td>[[Image:defaultlaf.png|thumb|Default Look & Feel]]</td>
 +
    <td>[[Image:hifilaf.png|thumb|HiFi Look & Feel]]</td>
 +
  </tr>
 +
</table>
 +
 
 +
=Changelog=
 +
 
 +
;Version 8.4
 +
 
 +
* Added: highlighting of erroneous XQuery modules in the project view.
  
Various tutorials on XPath are available in the internet. We invite you to e.g. have a look at the [http://www.w3schools.com/xquery/ XQuery Tutorial at W3Schools].
+
;Version 8.0
  
[[Category:Beginner]]
+
* Updated: support for dark look and feels; support for JTatto library
[[Category:GUI]]
 
[[Category:XQuery]]
 

Revision as of 14:03, 19 March 2018

This page is part of the Getting Started Section.

Startup

First of all, 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.

Select DatabaseNew and browse to an XML document of your choice. As an example, you can start with the factbook.xml document, which contains statistical information on the worlds' countries. It is included in our full releases (in the etc directory) and can also be downloaded (1.3 MB). If you type nothing in the input field, an empty database will be created. Next, choose the OK button, and the database will be created.

If no XML document is available, the Text Editor can also be used to create an initial XML document. After saving the entered XML document to disk, it can be supplied as database input in the above dialog.

Input Bar

On top of the main window, you can find an input bar. The attached dropdown menu provides three modes: Find, XQuery and Command:

Input Bar

The upcoming example queries can all be used with an instance of the factbook database:

Find

In the Find mode, the input bar can be used to find single elements and texts in the currently opened database. The following syntax is supported:

Query Description
city Find elements named city, and texts containing this token.
=India Find texts matching the exact string India.
~Cing Find texts equal or similar to the token Cingdom.
id Find attributes named id and attribute values containing this token.
@=f0_119 Find attribute values matching the exact string f0_119.
"European Chinese" Find texts containing the phrase "European Chinese".
//city Leading slash: Interpret the input as XPath expression (see below).

XQuery

In the XQuery mode, XPath and XQuery expressions can be entered in the input bar.

To evaluate the following example queries: enter them in the input bar, and press ENTER or click on the START button:

Query Description
//country Return all country elements.
//country[name = "Switzerland"] Return the country element of "Switzerland".
for $city in //city
where $city/population > 1000000
order by $city ascending
return $city/name
Return the names of all cities with a population larger than one million and order the results by the name of the city.

Command

In the Command mode, BaseX Commands can be entered and executed. Just try the following examples:

  • INFO: Returns system information.
  • CREATE DB TEST: Creates an empty database named "TEST".
  • LIST: Lists all databases.

Text Editor

The built-in text editor is a helpful tool for writing XQuery code that spans multiple lines or files. It can also be used to edit XML documents, Command Scripts, and any other textual files:

  • XQuery and XML files will be parsed with each key click, and errors will be highlighted.
  • XQuery and command scripts can be executed by clicking on the green triangle.
  • Syntax highlighting is available for XQuery, XML, JSON and JavaScript files.

Numerous keyboard shortcuts are available to speed up editing and debugging.

Project View

The Project View is attached to the editor panel. It displays all files of the current project directory in a tree structure. Files can be renamed and deleted by right-clicking on the files. The project directory can be changed as well; the most recent directories will be kept in the history.

All XQuery files in the project directory will be parsed in the background. Buggy XQuery modules, and files importing these modules, will be marked red. With the text fields on top, you can interactively search for file names and contents.

Realtime Options

Via the Options menu, you can change 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 explicitly filtered with the 'Filter' button.

Visualizations

The BaseX GUI offers various visualizations, which help you to explore your XML data instances from different perspectives:

Text View

Result

Displays query results and other textual output. Query results can be saved in a file.
Map View

Map

Displays all data in a TreeMap. All nodes of the XML document are represented as rectangles, filling the complete area. You can choose different layout algorithms in the Menu OptionsMap Layout.
Tree View

Tree

Displays all XML nodes in a top down tree with edges and nodes. You can change some settings of the Tree in the Menu OptionsTree Options.
Folder View

Folder

Displays all nodes in an Explorer-like folder view. Nodes can be expanded or closed by clicking on the arrows.
Scatterplot View

Plot

Displays all nodes in a scatterplot, which is particularly helpful if you want to explore analyze your data. Three drop down menus allow custom axis assignments.
The Table View

Table

Comes in handy if your data is highly regular. It displays all nodes in a table with rows and columns. Different assignments can be chosen by clicking on the arrow in the right upper corner.
Explorer View

Explorer

Can be used to explore the contents of your database via drop-down menus, search fields and double sliders.
Info View

Info

Helpful for analyzing the query plans of your XQuery expressions. It also displays information on the compilation and evaluation of queries.

Look and Feels

By default, the Look and Feel of your operating system will be used in the GUI. In the Preferences dialog, you can choose among some more window themes.

The JTattoo library offers some more look and feels. If you download and copy the JTattoo jar file into the lib directory provided by the ZIP and EXE distribution of BaseX, 13 additional looks and feels will get available.

Default Look & Feel
HiFi Look & Feel

Changelog

Version 8.4
  • Added: highlighting of erroneous XQuery modules in the project view.
Version 8.0
  • Updated: support for dark look and feels; support for JTatto library