Changes

Jump to navigation Jump to search
5,325 bytes added ,  16:24, 25 July 2022
This page is part of the [[Getting Started]] Section.The BaseX homepage gives you comes with a [http://basex.org/products/gui visual impression] of the graphical user interface (GUI) of BaseXthat offers you great tools for managing, querying and an [http://www.youtube.com/watch?v=xILHKGPGaJ4&hd=1 introductory video] is available, which presents some of its interactive featuresvisualizing your data and write complex applications in XQuery.
==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.The graphical user interface can be started as follows:
==Create Database==* If you have installed BaseX on ''Windows'', click on the '''BaseX GUI''' icon.* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basex|basexgui]]}} or {{Code|[[Start Scripts#Windows: basex.bat|basexgui.bat]]}} scripts.* You can also double-click on the {{Code|BaseX.jar}} file (this way, no libraries will be added).* For developers: type in {{Code|mvn exec:java}} in the main directory of the {{Code|basex}} project.
Select ''Database'' → ''New'' and browse to an XML document of your choice. As an example, you can start with the {{CodeSome additional [[Command-Line_Options#GUI|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 downloadedcommand-line options]] (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 queryare available.
If no XML document It is available, worth mentioning that the standalone client must not be used if you perform parallel (concurrent) read and write operations on your databases. See [[Startup#Text EditorConcurrent Operations|Text EditorConcurrent Operations]] 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 dialogfor more details.
==Realtime Options=Introduction=
Via At the top of the BaseX window, the menu bar resides. It houses all important features of the BaseX GUI. Use the ''Database'' menu to [[Graphical_User_Interface#Database Management|create and manage your XML databases]]. The ''Editor'' menu gives you access to a variety of tools and options for working with files. The ''View'' menu lets you toggle between the bars and panels described below. The ''Visualization'' menu offers you a comprehensive set of data representations that will help you to understand your data even better. Use the ''Options'' menuto set your preferences regarding real-time execution, colors, fonts, you can change how queries are executed and visualized:packages.
* Right below the menu bar, you can find the ''Buttons'Realtime Execution'bar and just below that the '': If realtime execution is enabled, your searches and queries will be executed with each key click and the results will be instantly shown.* Input Bar''. The 'Realtime Filtering'Buttons'': If enabledbar offers you a wide range of shortcuts, all mostly for menu options, such as managing databases and displaying views and visualizations will be limited to the actual results in realtime, but also for navigating through your data. If this feature is disabled, the query results are highlighted in the visualizations and can be explicitly filtered with With the [[Graphical_User_Interface#Input Bar|''Input Bar'Filter' button.[[Category:GUI]], you can query your data using three different kinds of query syntax.
==Querying==[[File:GUI-Header.png|600px]]
===Keyword Search===The ''Status Bar'' is situated at the bottom of the BaseX window.
The Keyword Search BaseX [[Graphical_User_Interface#Editor|editor]] consists of the ''Project'' view, a file browser with optional input fields for searching files, and the actual ''Editor'' panel with buttons for creating, opening, saving, searching, executing and debugging your files. [[File:GUI-Editor.png|600px]] In addition to that, the ''Result'' view displays the output of queries and database operations and the ''Info'' view shows you information about database processes and query execution. [[File:GUI-ResultInfo.png|600px]] To gain further insights into your data, you can choose to display various [[Graphical_User_Interface#Visualizations|visualizations]] such as ''Map'', ''Tree'', ''Folder'', ''Plot'', ''Table'' and ''Explorer''. =Database Management= The BaseX GUI is a great place for creating and managing your XML databases. To '''create a new database''', select ''Database'' → ''New'' from the menu and browse to an XML document of your choice. You can start with the {{Code|factbook.xml}} document, which contains statistical information on the worlds' countries. It is included in the {{Code|etc}} directory of our [https://basex.org/download full distributions] (ZIP Package and Windows Installer) or can be downloaded [https://files.basex.org/xml/factbook.xml here] (1.3 MB). In the ''Create Database'' dialog, specify the path to your input file and the name of the new database. If you leave the input file field empty, an empty database will be created. Click the ''OK'' button to create the database. '''Note:''' You can also use the GUI's [[Graphical_User_Interface#Editor|editor]] to create and edit your own XML document. Just specify it as input file for the creation of a new database after saving the document to disk. To '''open, rename, copy or drop a database''', choose ''Database'' → ''Open & Manage...'' from the menu. Select one of the available databases on the left-hand side and click on one of the buttons on the right: ''Open'', ''Rename'', ''Copy'' or ''Drop''. To open a database, you can also double-click on the database name. Opening a database activates three more options in the ''Database'' menu: * The ''Properties'' item gives you access to a variety of database options and information:** Add resources and/or set parsing preferences.** Gain insights into element and attribute names, paths and other meta information.** Create and manage text, attribute, token and full-text indexes. Customize indexes by specifying language, stemming, case-sensitivity and diacritics settings or include a stop word list.* With the ''Export'' item, you can serialize your database into a whole range of different output formats, including XML, JSON and CSV.* The ''Close'' item closes the database. An open database is closed automatically as soon as another database is opened. '''Note:''' You can also access the menu options ''New'', ''Open & Manage'', ''Properties'' and ''Close'' from BaseX's Buttons bar. [[File:GUI-Menu.png|600px]] =Editor= The built-in editor of BaseX is a powerful tool for write XQuery code and [[Commands#Basics|Command Scripts]], editing text documents (XML, JSON, JavaScript, …), and developing [[RESTXQ]] applications: * The editor offers native '''syntax highlighting''' for XQuery, XML, JSON and JavaScript.* XQuery, XML and JSON files will be '''parsed''' in real time and '''errors''' will be highlighted.* XQuery code and command scripts can be '''executed ''' (via Ctrl Enter or by clicking on the green triangle). Numerous [[Shortcuts|keyboard shortcuts]] are available to speed up editing and debugging. Some examples: * Ctrl H: Search for the currently selected string in your complete project.* Ctrl .: Jump to the next erroneous code in your project. If you right-click on an XML document in the ''Project''Searchview, the selected file will be parsed and bound to the context item: [[File:GUI-Context.png|600px]] ==Project View== The ''Project'' view is attached to the ''Editor'' mode 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 inthe 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 combo box text fields on top, you can interactively search for file names and contents. If a directory contains a {{Code|.ignore}} file, its files and contents will be ignored. =Input Bar= The ''Input Bar'' is situated on top of the main window. This options allows for a simpleIt offers you three different modes to query your XML databases: '''Find''','''XQuery''' and '''Command'''. keyword[[Image:GUI-based search Input.png|600px]] The upcoming example queries can all be used with an instance of the <code>factbook</code> 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:
The following syntax is supported:
{| class="wikitable"
!Query
!Description
|-
|<code>worldcity</code>|Find tags elements named {{Code|city}}, and texts containing this token.|-|<code>=India</code>|Find texts matching the exact string {{Code|worldIndia}}.
|-
|<code>=world~Cingdom</code>|Find exact matching text nodestexts equal or similar to the token {{Code|Cingdom}}.
|-
|<code>~world@id</code>|Find text nodes similar to attributes named {{Code|worldid}}and attribute values containing this token.
|-
|<code>@world=f0_119</code>|Find attributes and attribute valuesmatching the exact string {{Code|f0_119}}.
|-
|<code>@=world"European Chinese"</code>|Find exact attribute valuestexts containing the phrase {{Code|"European Chinese"}}.
|-
|<code>"united world"//city</code>|Find tags and texts containing Leading slash: Interpret the phrase {{Code|"united world"}}input as XPath expression (see below).
|}
===XPath/XQuery===
Apart from In the basic search facilities'''XQuery''' mode, 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 XPath and XQuery reference, but might point you expressions can be entered in the right directioninput bar.
To execute evaluate the following example queries, enter type them in the XQuery Panel input bar and press ENTER Enter or click on the START ''Run query'' button.(green triangle) adjacent to the input bar:
XPath provides an easy facility to query your documents {| 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 a navigational manner. It is //city<br/>where $city/population > 1000000<br/>order by $city ascending<br/>return $city/name</code>|Return the basic tool names of all node-related operations that you encounter when using XQuery. We will start cities with a trivial example population larger than one million and extend it to our needsorder the results by the name of the city.|}
''' Example: Find Countries '''==Command==
<pre class="brushIn the '''Command''' mode, BaseX [[Commands|Commands]] can be entered and executed. Just try the following examples:xquery">//country</pre>
tells BaseX to look for all * <code>countryINFO</code> elements in the document: Returns system information. The query is introduced by two slashes * <code>//CREATE DB TEST</code>, which trigger the traversal of all document nodes: Creates an empty database named "TEST". The queries {{Code|* <code>LIST<//country}} andd {{Code|/descendantcode>::country}} will return the same resultsLists all databases.
''' Example: Find Cities in Switzerland ''' 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": <pre class="brush:xquery">//country[name = "Switzerland"]</pre> To return all cities of the resulting element node, the query can be extended by a trailing <code>//city</code> path: <pre class="brush:xquery">//country[name = "Switzerland"]//city</pre> ===Text Editor=== 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. ==Visualizations==
The BaseX GUI offers various visualizations,
which help you to explore your XML data instances from different perspectives:
<table cellpadding="0" cellspacing="10"><tr><td valign="top" width="50%">[[Image:Result.png|thumb|Text View200px]]
'''Result'''(''View'' menu):Displays query results and other textual output(e.g., content of the currently open database). Query results can be saved in a file.</td><td valign="top" width="50%">[[Image:InfoView.png|thumb|200px]] '''Info''' (''View'' menu):Helpful for analyzing the query plans of your XQuery expressions. It also displays information on the compilation and evaluation of queries.</td></tr><tr><td valign="top" width="50%">[[Image:Map.png|thumb|Map View200px]]
'''Map'''
:Displays all data in a [httphttps://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" width="50%">[[Image:Tree.png|thumb|Tree View200px]]
'''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 ''Options'' → ''Tree Options''.</td></tr><tr><td valign="top" width="50%">[[Image:Folder.png|thumb|Folder View200px]]
'''Folder'''
: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" width="50%">[[Image:Scatterplot.png|thumb|Scatterplot View200px]]
'''Plot'''
:Displays all nodes in a scatterplotscatter plot, which is particularly helpful if you want to explore analyze your data. Three drop down dropdown menus allow custom axis assignments.</td></tr><tr><td valign="top" width="50%">[[Image:Table.png|thumb|The Table View200px]]
'''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.
</td></tr><tr><td valign="top" width="50%">[[Image:Explorer.png|thumb|Explorer View200px]]
'''Explorer'''
:Can be used to explore the contents of your database via drop-down menus, search fields and double sliders.
</td><td valign="top"/tr></table>[[Image:InfoView.png|thumb|Info View]]
=Real-time Options= In the ''Options'Info'menu, you can change how queries are executed and visualized: * '''Real-time Execution''': If real-time execution is enabled, your searches and queries will be executed with each key click and the results will be instantly shown.* '''Real-time Filtering''':Helpful for analyzing If enabled, all visualizations will be limited to the actual results in real-time. If this feature is disabled, the query plans of your XQuery expressions. It also displays information on results are highlighted in the compilation visualizations and evaluation of queriescan be explicitly filtered with the 'Filter' button.</td></tr></table>
==Look and Feels=Feel=
<table>
<tr>
<tdvalign="top">
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 from additional 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 themes will get available.
</td>
<td>[[Image:defaultlaf.png|thumb|Default Look & Feel]]</td>
=Changelog=
;Version 89.3* Updated: Project View: ignore directories with {{Code|.ignore}} file ;Version 9.1* Added: Project View, set XML document as context.0
;Version 8.4* UpdatedAdded: support for dark look and feels; support for JTatto libraryhighlighting of erroneous XQuery modules in the project view.
[[Category:Beginner]][[Category:GUI]];Version 8.0[[Category* Updated:XQuery]]support for dark look and feels; support for JTattoo library
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu