Integrating oXygen

This tutorial is part of the Getting Started Section. It describes how to access BaseX from the oXygen XML Editor. Currently, there are two alternatives how to use BaseX in oXygen:


 * Resources in BaseX databases can be opened and modified.
 * XPath/XQuery 1.0 expressions can be run by the query processor of BaseX.
 * Note: BaseX itself is a highly compliant XQuery 3.1 processor. The restriction to XQuery 1.0 arises from the XQJ Interface which is used to establish the connection between oXygen and BaseX. We strongly encourage you to use the XML editor integrated into the BaseX GUI to edit and query your XML data!

=Access Database Resources=

Preparations

 * 1) Download one of the BaseX distributions.
 * 2) Start BaseX (see Startup).
 * 3) Create a BaseX database, if necessary (see Databases).
 * 4) Start the BaseX WebDAV service.

Configuration

 * 1) In oXygen, go to menu Options → Preferences → Data Sources.
 * 2) In the Connections panel (in the lower half of the screen), click the New button (+).
 * 3) Enter "BaseX WebDAV" as connection name.
 * 4) Select "WebDAV (S)FTP" in the Data Source dropdown box.
 * 5) Fill in the appropriate connection details as follows:
 * 6) * Set the WebDAV/FTP URL to.
 * 7) * Set the user name to.
 * 8) * Set the password to.
 * [[File:Oxygen-WebDAV-1.png]]
 * 1) 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.



=Perform Queries=

Preparations

 * 1) Download one of the complete BaseX distributions (ZIP, EXE), if necessary.
 * 2) Start BaseX (see Startup). Note: Charles Foster's XQJ implementation provides a default (client/server) and a local driver. If you want to use the first flavor, you need to start a BaseX Server instance.

Configure Data Source

 * 1) In oXygen, select Options → Preferences → Data Sources.
 * 2) In the Data Sources panel, add a new data source using the New button (+).
 * 3) Enter "BaseX" as name and select XQuery API for Java(XQJ) from the Type dropdown box.
 * 4) Add the following JAR files (downloaded in Preparations procedure) with the Add Files Button. The versions of the JAR files may differ.
 * 5) * basex/lib/xqj-api-1.0.jar
 * 6) * basex/lib/xqj2-0.2.0.jar
 * 7) * basex/lib/basex-xqj-9.0.jar
 * 8) * basex/BaseX.jar, if you want to use BaseX embedded
 * 9) Under "Driver class", choose the preferred driver class:
 * 10) * Embedded: net.xqj.basex.BaseXXQDataSource
 * 11) * Client/server: net.xqj.basex.local.BaseXXQDataSource
 * 12) Click OK.

Configure Connection

 * 1) In the Connections section (in the lower half of the Data Source dialog), click New (+).
 * 2) Enter "BaseX XQJ" as name and select "BaseX" as data source.
 * 3) If you use the default driver, enter the following values in the Connection Details section:
 * 4) * port: 1984
 * 5) * serverName: localhost
 * 6) * user: admin
 * 7) * password: admin
 * 8) Click OK to complete the connection configuration.
 * 9) Click OK again to close the Preferences dialog.

Configure New Transformation Scenario

 * 1) Select Window → Show View → Transformation Scenarios.
 * 2) In the Transformation Scenarios panel, click + and select XQuery transformation in the lower part of the dropdown list.
 * 3) Enter a name for your transformation, e.g. "BaseX" like in the screenshot below.
 * 4) Specify an optional XML and XQuery URL.
 * 5) * If you would like to query the BaseX database you connected to via WebDAV, leave the XML URL field empty. To access your database, you can use the following function from the BaseX Database Module in your XQuery URL file:
 * [[File:Oxygen-query-example.png]]
 * 1) * If you specify an XML document in the XML URL field, you can query its content using . (dot operator) in your XQuery URL file.
 * 2) Choose "BaseX XQJ" as Transformer from the combo box.
 * 3) Click OK to complete the scenario configuration.



Execute Query
After the one-time setup steps are complete, you can execute your query using the new transformation scenario. Start the transformation by clicking the red Run button (Apply associated scenarios) in the Transformation Scenarios window, while your scenario is selected. The results should be immediately displayed in the result panel.