Changes

Jump to navigation Jump to search
638 bytes added ,  15:03, 19 March 2018
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 an [http://www.youtube.com/watch?v=xILHKGPGaJ4&hd=1 introductory video] is available, which presents some of its interactive features.
==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 <code>basexgui</code> script. Beside that, some more [[Startup#BaseX GUI|startup options]] are available.
==Create 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 If no XML document of your choice. As an exampleis available, you can start with the {{Code[[#Text Editor|factbook.xml}} document, which contains statistical information on the worlds' countries. It is included in our official releases and Text Editor]] can also be [http://filesused to create an initial XML document.basex.org/xml/factbook.xml downloaded] (1.3 MB). If you type nothing in After saving the input fieldentered XML document to disk, an empty it can be supplied as database will be created. Next, choose input in the ''OK'' button, and BaseX will create a database that you can visually explore and queryabove 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 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.[[CategoryImage:GUIInputBar.png|Input Bar]]
==Querying==The upcoming example queries can all be used with an instance of the <code>factbook</code> database:
===Keyword Search=Find==
The Keyword Search can be executed in In the '''SearchFind''' mode in, the combo box of the main window. This options allows for a simple,keyword-based search input bar can be used to find single elements and texts in the currently opened database.The following syntax is supported:
The following syntax is supported:
{| class="wikitable"
!Query
!Description
|-
|<code>worldcity</code>|Find tags and texts containing elements named {{Code|worldcity}}, and texts containing this token.
|-
|<code>=worldIndia</code>|Find texts matching the exact matching text nodesstring {{Code|India}}.
|-
|<code>~worldCing</code>|Find text nodes texts equal or similar to the token {{Code|worldCingdom}}.
|-
|<code>@worldid</code>|Find attributes named {{Code|id}} and attribute valuescontaining this token.
|-
|<code>@=worldf0_119</code>|Find exact attribute valuesmatching the exact string {{Code|f0_119}}.
|-
|<code>"united worldEuropean Chinese"</code>|Find tags and texts containing the phrase {{Code|"united worldEuropean Chinese"}}.|-|<code>//city</code>|Leading slash: Interpret the input as XPath expression (see below).
|}
==XQuery== In the '''XQuery''' mode, XPath/and XQueryexpressions 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: {| 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.|}
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.==Command==
To execute In the following queries'''Command''' mode, enter them in the XQuery Panel [[Commands|BaseX Commands]] can be entered and press ENTER or click on executed. Just try the START button.following examples:
XPath provides * <code>INFO</code>: Returns system information.* <code>CREATE DB TEST</code>: Creates an easy facility to query your documents in a navigational mannerempty database named "TEST". It is the basic tool of * <code>LIST</code>: Lists all node-related operations that you encounter when using XQuery. We will start with a trivial example and extend it to our needsdatabases.
''' Example: Find Countries '''=Text Editor=
<pre class="brushThe 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:xquery">//country</pre>
tells BaseX to look for all <code>country</code> elements in * 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 documentgreen triangle. The query * '''Syntax highlighting''' is introduced by two slashes <code>//</code>available for XQuery, XML, which trigger the traversal of all document nodes. The queries {{Code|//country}} andd {{Code|/descendant::country}} will return the same resultsJSON and JavaScript files.
''' Example: Find Cities in Switzerland '''Numerous [[Shortcuts|keyboard shortcuts]] are available to speed up editing and debugging.
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":==Project View==
<pre class="brush:xquery">//country[name = "Switzerland"]</pre>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.
To return all cities of All XQuery files in the resulting element nodeproject directory will be parsed in the background. Buggy XQuery modules, and files importing these modules, will be marked red. With the query text fields on top, you can be extended by a trailing <code>//city</code> path:interactively search for file names and contents.
<pre class="brush:xquery">//country[name Realtime Options= "Switzerland"]//city</pre>
===Text Editor===Via the ''Options'' menu, you can change how queries are executed and visualized:
The text editor can be used to type in [[XQuery]] expressions, [[Commands#Basics|Command Scripts]], XML documents* '''Realtime Execution''': If realtime execution is enabled, or any other text files. Query files your searches and XML documents can queries will be started by clicking on the green triangle. They will automatically parsed executed with each key clickand the results will be instantly shown.* '''Realtime Filtering''': If enabled, and errors all visualizations will be highlightedlimited to the actual results in realtime. Various [[Shortcuts|keyboard shortcuts]] If this feature is disabled, the query results are available to speed up editing highlighted in the visualizations and debuggingcan be explicitly filtered with the 'Filter' button.
==Visualizations==
The BaseX GUI offers various visualizations,
</td></tr></table>
==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 different Look and Feelssome more window themes. If you download and embed the  The [http://www.jtattoo.net/ScreenShots.html JTattoo library] in your classpathoffers some morelook 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 more additional looks and feels will be get available. Two of these window themes provide a dark color scheme.
</td>
<td>[[Image:defaultlaf.png|thumb|Default Look & Feel]]</td>
</table>
=Changelog=
 
;Version 8.4
 
* Added: highlighting of erroneous XQuery modules in the project view.
 
;Version 8.0
[[Category* Updated:Beginner]][[Category:GUI]][[Category:XQuery]]support for dark look and feels; support for JTatto library
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu