Integrating oXygen

From BaseX Documentation
Revision as of 09:49, 21 January 2019 by Sabine Teubner (talk | contribs)
Jump to navigation Jump to search

This tutorial is part of the Getting Started Section. It describes how to access BaseX from the oXygen XML Editor. Currently, there are two variants 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 recommend you to use the XML editor integrated into the BaseX GUI to edit and query your XML data!

Access Database Resources

Preparations

  • First, start the BaseX WebDAV service.

Configuration

  1. Go to menu OptionsPreferencesData Sources
  2. In the Connections panel (in the lower area of the screen), click the New button (+)
  3. Enter "BaseX-WebDAV" as connection name
  4. Select "WebDAV" in the Data Source combo box
  5. Fill in the appropriate connection details. Below, the default values are shown:
    • Set the URL to http://localhost:8984/webdav
    • Set the user name to admin
    • Set the password to admin
  6. Now press OK, and your Data Source is ready for use

Oxygen-WebDAV-1.png

You can then access the database files via the Data Source Explorer: WindowsShow ViewData Source Explorer

Oxygen-WebDAV-2.png

Perform Queries

One-Time Setup

Preparations

  1. Download one of the complete BaseX distributions (ZIP, EXE).
  2. 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. Start oXygen and select OptionsPreferencesData 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) as type.
  4. Add the following JAR files (downloaded in Preparations procedure) with the Add Files Button. The versions of the JAR files may differ.
    • lib/xqj-api-1.0.jar
    • lib/xqj2-0.2.0.jar
    • lib/basex-xqj-8.6.jar
    • basex.jar, if you want to use BaseX embedded
  5. Under "Driver class", choose the preferred driver class:
    • Embedded: net.xqj.basex.BaseXXQDataSource
    • Client/server: net.xqj.basex.local.BaseXXQDataSource
  6. Click OK.

Configure Connection

  1. In the Connections section (in the same Preferences dialog from the Configure Data Source procedure), click New (+).
  2. Enter "BaseX" as name and select "BaseX XQJ" as data source.
  3. If you use the default driver, enter these values in the Connection Details section:
    • port: 1984
    • serverName: localhost
    • user: admin
    • password: admin
  4. Click OK to complete the connection configuration.
  5. Click OK again to close the Preferences dialog.

Configure New Transformation Scenario

  1. Select WindowShow ViewTransformation Scenarios.
  2. Select the XQuery transformation tree entry, and click + to add a new scenario.
    If this entry does not appear in the tree, click + and select XQuery transformation in the dropdown list.
  3. Enter a name and an optional XML and XQuery URL (e.g. your query document/file).
  4. Choose "BaseX XQJ" as Transformer from the combo box.
  5. Click OK to complete the scenario configuration.

Execute Query

After the one-time setup steps are complete, execute a query using the transformation scenario. Start the transformation by clicking the red Apply associated scenarios button in the Transformation Scenarios window.


Oxygen-WebDAV-3.png

The results should immediately occur in the result panel.