<p>This tutorial is part of the [[Getting Started]] Section.It describes how to use the access BaseX XQuery Processorto execute queries in from the [httphttps://www.oxygenxml.com oXygen XML Editor].You can access the existing databases from Currently, there are two alternatives how to use BaseX within in oXygen: * Resources in BaseX [[databases]] can be opened and work with the results as XMLmodified.</p> <h2>Required Downloads<* XPath/h2> XQuery 1.0 expressions can be run by the [[Query|query processor]] of BaseX.<ul> <li><* '''Note:''' BaseX itself is a href="maven/org/basex/basex/6.highly compliant XQuery 3.1/basex-6.3processor.The restriction to XQuery 1.jar">basex0 arises from the XQJ Interface which is used to establish the connection between oXygen and BaseX.jarWe strongly encourage you to use the [[Graphical_User_Interface#Text_Editor|XML editor]] integrated into the BaseX GUI to edit and query your XML data!<br/a>: Main code<br/li> <li><a href=Access Database Resources= ===Preparations==="maven # Download one of the [https:/org/basex.org/basex-api/6download BaseX distributions].# Start BaseX (see [[Startup]]).# Create a BaseX database, if necessary (see [[Databases]]).3# Start the BaseX [[WebDAV]] service.1/basex-api-6 ===Configuration=== # In oXygen, go to menu ''Options'' → ''Preferences'' → ''Data Sources''.3# In the Connections panel (in the lower half of the screen), click the ''New'' button ({{Code|+}}).1# Enter "BaseX WebDAV" as connection name.jar# Select "WebDAV (S)FTP">basex-apiin the Data Source dropdown box.jar</a># Fill in the appropriate connection details as follows: Implementation of #* Set the XQJ APIWebDAV/FTP URL to </licode> <linowiki><a href="mavenhttp:/javax/xmllocalhost:8080/xquerywebdav</xqj-apinowiki></1code>.0#* Set the username to <code>admin</xqjcode> and enter your password.#: [[File:Oxygen-apiWebDAV-1.0png]]# Now press ''OK'', and your Data Source is ready for use. You can then access your database file(s) via the Data Source Explorer: ''Window'' → ''Show View'' → ''Data Source Explorer''.jar">xqj [[File:Oxygen-WebDAV-api2.jar</a>: XQuery for Java (Interface)</li> png]] =Perform Queries= ==One-Time Setup== ===Preparations=== <li># Download one of the complete [httphttps://wwwbasex.oxygenxmlorg/download BaseX distributions] (ZIP, EXE), if necessary.com oXygen XML Editor# Start BaseX (see [[Startup]]). '''Note: Install ''' Charles Foster's XQJ implementation provides a default (client/server) and a local driver. If you want to use the oXygen XML Editor on your computer</li> first flavor, you need to start a [[Startup#Server|BaseX Server]] instance.</ul> <h2>Setting up</h2> <h3>===Configure Data Source</h3> ===<ol start="1"> <li>Start # In oXygen and go to <code>, select ''Options » '' → ''Preferences » '' → ''Data Sources</code>''.</li> <li>Add # In the Data Sources panel, add a new Data Source with data source using the <code>''New</code> '' button({{Code|+}}).</li> <li># Enter Name <code>"BaseX"</code> as name and choose <code>select ''XQuery API for Java(XQJ)</code> as type'' from the ''Type'' dropdown box.</li> <li># Add the three following JAR files (downloaded in Preparations procedure) with the <code>''Add</code> Files'' Button.<The versions of the JAR files may differ.#* {{Code|basex/lib/li> xqj-api-1.0.jar}}<li>Now press <code>OK<#* {{Code|basex/lib/code>, and your Data Source is readyxqj2-0.2.0.<jar}}#* {{Code|basex/lib/li> basex-xqj-9.0.jar}}<#* {{Code|basex/ol> BaseX.jar}}, if you want to use BaseX embedded # Under "Driver class", choose the preferred driver class:<h3>Connection<#* Client/h3> server communication: {{Code|net.xqj.basex.BaseXXQDataSource}}#* Embedded use (standalone): {{Code|net.xqj.basex.local.BaseXXQDataSource}}# Click ''OK''. <ol start="1"> ==Configure Connection=== <li>Now press <code>New</code> in # In the Connection Panel Connections section (located in the lower half of the Data SourcesSource dialog), click ''New'' ({{Code|+}}).</li> <li># Enter Name <code>"BaseXConnectionBaseX XQJ"</code> as name and select <code>"BaseX"</code> in the Data Source Boxas data source.</li> <li>Now press <code>OK</code># If you use the default driver, and your enter the following values in the Connection is ready.</li> Details section:#* port: {{Code|1984}}</ol> #* serverName: {{Code|localhost}} #* user: {{Code|admin}}<h2>Usage</h2> #* password: ''your password'' # Click ''OK'' to complete the connection configuration.<p>The query execution works as follows:</p> # Click ''OK'' again to close the Preferences dialog. <ol start="1"> ==Configure New Transformation Scenario=== <li>Configure a new transformation scenario in <code># Select ''Window » '' → ''Show View » '' → ''Transformation Scenarios</code>''.</li> <li>Press # In the ''Transformation Scenarios'' panel, click {{Code|+}} and select ''XQuery transformation'' in the lower part of the <code>plus</code> sign to add a new scenariodropdown list.</li> <li># Enter a Namename for your transformation, e.g. "BaseX" like in the screenshot below.# Specify an optional XML and XQuery URL (your xml file or .#* If you would like to query the BaseX database you connected to via WebDAV, leave it the ''XML URL'' field empty) and . To access your database, you can use the following function from the BaseX [[Database_Module|Database Module]] in your ''XQuery URL '' file:#: [[File:Oxygen-query-example.png]]#* If you specify an XML document in the ''XML URL'' field, you can query its content using {{Code|.}} (dot operator) in your query ''XQuery URL'' file).</li> <li># Choose <code>"BaseXConnectionBaseX XQJ"</code> in as Transformer from the combo box.</li> <li>Press <code># Click ''OK</code>'' to complete the scenario configuration. [[File:Oxygen-WebDAV-3.png]] ==Execute Query== After the one-time setup steps are complete, and you can execute your query using the new transformation scenario is ready. Now you can start Start the transformationby clicking the red Run button (''Apply associated scenarios'') in the Transformation Scenarios window, while your scenario is selected.</li> <li>The results should be immediately occur displayed in the result panel.</li> </ol>