Changes

Jump to navigation Jump to search
122 bytes removed ,  20:28, 22 June 2015
[[Category:GUI]]
=QueryingInput Bar=
==Keyword Search==The main window of the GUI has an input bar, which provides three modes: '''Find''', '''XQuery''' and '''Command'''. The upcoming example queries can all be used with an instance of the <code>factbook</code> database:
The Keyword Search can be executed in ==Find== 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 elements named {{Code|city}}, and texts containing this token.|-|<code>=India</code>|Find texts matching the exact string {{Code|worldIndia}}.
|-
|<code>=world~Cing</code>|Find exact matching text nodestexts equal or similar to the token {{Code|Cingdom}}.
|-
|<code>~worldid</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 them in the XQuery Panel 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''' Example: Find Countries '''!Description|-|<pre class="brush:xquery"code>//country</precodetells BaseX to look for |Return all <code>country</code> elements in the document. The query is introduced by two slashes |-|<code>//country[name = "Switzerland"]</code>, which trigger |Return the traversal of all document nodes. The queries {{Code|//<code>country}} andd {{Code|</descendant::country}} will return the same resultscode> element of "Switzerland".|-''' Example: Find Cities in Switzerland ''' The following query uses a '''predicate''' |<code>[...]for $city in //city<br/code> to filter all <codewhere $city/population >country1000000<br/code> nodes which have a order by $city ascending<codebr/>return $city/name</code> child, |Return the string value names of which is "Switzerland":all cities with a population larger than one million and order the results by the name of the city.|}
<pre class="brush:xquery">//country[name = "Switzerland"]</pre>Commands==
To return all cities of In the resulting element node'''Command''' mode, the query [[Commands|BaseX Commands]] can be extended by a trailing <code>//city</code> pathentered and executed. Just try the following examples:
* <pre class="brushcode>INFO</code>:xquery"Returns system information.* <code>CREATE DB TEST<//country[name = code>: Creates an empty database named "SwitzerlandTEST"]//city.* <code>LIST</precode>: Lists all databases.
==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.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu