Changes

Jump to navigation Jump to search
5,981 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 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 queriesvisualizing your data and write complex applications in XQuery.
==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. [[Startup#BaseX GUI|Follow this link]] for more information (or check out the additional [[Startup Options#BaseX GUI|command-line options]]).
== Create Database ==The graphical user interface can be started as follows:
Select * If you have installed BaseX on ''DatabaseWindows'' , click on the ''New'BaseX GUI''' and browse to an XML document icon.* Run one of your choicethe {{Code|[[Start_Scripts#Linux. As an example, the 2FMac:_basex|basexgui]]}} or {{MonoCode|factbook[[Start Scripts#Windows: basex.xmlbat|basexgui.bat]]}} document, which contains statistical information scripts.* You can also double-click on the worlds' countries{{Code|BaseX.jar}} file (this way, is included no libraries will be added).* For developers: type in {{Code|mvn exec:java}} in the official releases main directory of BaseX, and it can also be [http://files.the {{Code|basex.org/xml/factbook.xml downloaded here]}} project.
Next, choose the ''OK'' button, and BaseX will create a database that you can visually exploreSome additional [[Command-Line_Options#GUI|command-line options]] are available.
== Visualizations ==It is worth mentioning that the standalone client must not be used if you perform parallel (concurrent) read and write operations on your databases. See [[Startup#Concurrent Operations|Concurrent Operations]] for more details.
=Introduction= 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'' menu to set your preferences regarding real-time execution, colors, fonts, and packages. Right below the menu bar, you can find the ''Buttons'' bar and just below that the ''Input Bar''. The ''Buttons'' bar offers you a wide range of shortcuts, mostly for menu options, such as managing databases and displaying views and visualizations, but also for navigating through your data. With the [[Graphical_User_Interface#Input Bar|''Input Bar'']], you can query your data using three different kinds of query syntax.  [[File:GUI-Header.png|600px]] The ''Status Bar'' is situated at the bottom of the BaseX window. The 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 offers -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 help 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 explore create the database. '''Note:''' You can also use the GUI's [[Graphical_User_Interface#Editor|editor]] to create and edit your own XML data instances 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 perspectivesoutput 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.
<table cellpadding="0" cellspacing="0"><tr><td valign="top" width="49%">[[ImageIf you right-click on an XML document in the ''Project'' view, the selected file will be parsed and bound to the context item: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%">&nbsp;</td><td valign="top" width="49%">[[ImageFile:MapViewGUI-Context.jpg|thumbpng|Map View600px]]
'''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''.</td></tr><tr><td valign="top">[[Image:TreeView.jpg|thumb|Tree =Project View]]==
The ''Project'Tree'view is attached to the ''Editor'':This visualization panel. It displays all XML nodes files of the current project directory in a top down tree with edges structure. Files can be renamed and nodesdeleted by right-clicking on the files. You The project directory can change some settings of be changed as well; the Tree most recent directories will be kept in the Menu ''Options'' → ''Tree Options''.</td><td valign="top" width="2%">&nbsp;</td><td valign="top" width="49%">[[Image:FolderViewhistory.jpg|thumb|Folder View]]
'''Folder''':This visualization displays all nodes All XQuery files in an Explorer-like folder viewthe project directory will be parsed in the background. Nodes can Buggy XQuery modules, and files importing these modules, will be expanded or closed by clicking marked red. With the text fields on the arrows.</td></tr><tr><td valign="top">[[Image:Scatterplot, you can interactively search for file names and contents.jpg|thumb|Scatterplot View]]
'''Plot''':This visualization displays all nodes in If a scatterplotdirectory contains a {{Code|.ignore}} file, which is particularly helpful if you want to explore analyze your dataits files and contents will be ignored. Three drop down menus allow custom axis assignments.</td><td valign="top" width="2%">&nbsp;</td><td valign="top" width="49%">[[Image:TableView.jpg|thumb|The Table View]]
'''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.</td></tr><tr><td valign="top">[[Image:ExplorerView.jpg|thumb|Explorer View]]Input Bar=
The ''Input Bar'Explorer' is situated on top of the main window. It offers you three different modes to query your XML databases: '''Find''':With this visualization you can explore the contents of your database via drop-down menus, search fields '''XQuery''' and double sliders.</td><td valign="top" width="2%">&nbsp;</td><td valign="top" width="49%">[[Image:InfoView'''Command'''.png|thumb|Info View]]
'''Info'''[[Image:This view is helpful for analyzing the query plans of your XQuery expressionsGUI-Input. It also displays information on the compilation and evaluation of queries.</td></tr></table>png|600px]]
== 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>foocity</code>|Find tags elements named {{Code|city}}, and texts containing this token.|-|<code>foo=India</code>|Find texts matching the exact string {{Code|India}}.|-|<code>~Cingdom</code>|Find texts equal or similar to the token {{Code|Cingdom}}.|-|<code>@id</code>|Find attributes named {{Code|id}} and attribute values containing this token.|-|<code>@=f0_119</code>|Find attribute values matching the exact string {{Code|f0_119}}.|-|<code>"European Chinese"</code>|Find texts containing the phrase {{Code|"European Chinese"}}.|-|<code>//city</code>|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, type them in the input bar and press Enter or click on the ''Run query'' button (green triangle) adjacent to the input bar: {| class="wikitable"!Query!Description
|-
|<code>=foo//country</code>|Find exact matching text nodesReturn all <code>country</code> elements.
|-
|<code>@foo//country[name = "Switzerland"]</code>|Find attributes and attribute valuesReturn the <code>country</code> element of "Switzerland".
|-
|<code>@=foofor $city in //city<br/>where $city/population > 1000000<br/>order by $city ascending<br/>return $city/name</code>|Find exact attribute valuesReturn the names of all cities with a population larger than one million and order the results by the name of the city.
|}
==Command= XPath= In the '''Command''' mode, BaseX [[Commands|Commands]] can be entered and executed. Just try the following examples: * <code>INFO</code>: Returns system information.* <code>CREATE DB TEST</code>: Creates an empty database named "TEST".* <code>LIST</XQuery ===code>: Lists all databases.
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.=Visualizations=
To execute the following queriesThe BaseX GUI offers various visualizations, enter them in the XQuery Panel and press ENTER or click on the START button.which help you to explore your XML data instances from different perspectives:
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<table cellpadding="0" cellspacing="10"><tr><td valign="top" width="50%">[[Image:Result.png|thumb|200px]]
''' Example: Find Countries 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.<code/td> <//countrytr><tr></codetd valign="top" width="50%">[[Image:Map.png|thumb|200px]]
tells BaseX to look for '''Map''':Displays all <code>country<data in a [https://code> elements in the documenten.wikipedia. The query is introduced by two slashes <code>org/wiki/</code>Treemap TreeMap]. All nodes of the XML document are represented as rectangles, which trigger filling the traversal of all document nodescomplete area. XPath knows several You can choose different layout algorithms in the Menu ''Options'location steps''' that determine which nodes to consider next for evaluationMap Layout''.</td><td valign="top" width="50%">[[Image:Tree.png|thumb|200px]]
As an example, '''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''.<code/td>//country</codetr> is equivalent to <codetr>/descendant::country</codetd valign="top" width="50%">[[Image:Folder.png|thumb|200px]]
''' ExampleFolder''':Displays all nodes in an Explorer-like folder view. Nodes can be expanded or closed by clicking on the arrows.</td><td valign="top" width="50%">[[Image:Scatterplot.png|thumb|200px]] '''Plot''':Displays all nodes in a scatter plot, which is particularly helpful if you want to explore analyze your data. Three dropdown menus allow custom axis assignments.</td></tr><tr><td valign="top" width="50%">[[Image:Table.png|thumb|200px]] '''Table''': Find Cities 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 Switzerland the right upper corner.</td><td valign="top" width="50%">[[Image:Explorer.png|thumb|200px]] '''Explorer''':Can be used to explore the contents of your database via drop-down menus, search fields and double sliders.</td></tr></table>
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":=Real-time Options=
<code> //country[name = "Switzerland"]</code>In the ''Options'' menu, you can change how queries are executed and visualized:
To return * '''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''': If enabled, all cities of visualizations will be limited to the resulting element nodeactual results in real-time. If this feature is disabled, the query results are highlighted in the visualizations and can be extended by a trailing <code>//city</code> path:explicitly filtered with the 'Filter' button.
<code> //country[name = "Switzerland"]//city</code>Look and Feel=
<table> <tr> <td valign==Realtime Options=="top">By default, the Look and Feel of your operating system will be used in the GUI.In the ''Preferences'' dialog, you can choose from additional window themes.
Via The [http://www.jtattoo.net/ScreenShots.html JTattoo library] offers some morelook and feels. If you download and copy the ''Options'' menu, you can change JTattoo jar file into the {{Code|lib}}directory provided by the way how queries are executed ZIP and visualizedEXE distribution of BaseX,13 additional themes will get available. </td> <td>[[Image:defaultlaf.png|thumb|Default Look & Feel]]</td> <td>[[Image:hifilaf.png|thumb|HiFi Look & Feel]]</td> </tr></table>
* '''Realtime Execution''': If realtime execution is enabled, the entered query (if valid) will be executed on the fly and the results will be immediately shown. So if you aren't interested in partial results of your query disable this option, because it can lead to delays during entering your query. * '''Realtime Filtering''': If enabled, all visualizations directly show the query results while entering the query. If this feature is disabled, the query results are highlighted in the visualizations and can be ecplicitly filtered using the 'Filter' button.[[Category:GUI]]=Changelog=
== What's Next? ==;Version 9.3* Updated: Project View: ignore directories with {{Code|.ignore}} file
For more information on BaseX, XQuery and XPath;Version 9.1* Added: Project View, we invite you to..set XML document as context.
* check out more [[Getting_Started|Documentation]], and;Version 8.4* have a look at the [httpAdded://www.w3schools.com/xquery/ highlighting of erroneous XQuery Tutorial at W3Schools]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