Difference between revisions of "Integrating oXygen"

From BaseX Documentation
Jump to navigation Jump to search
(Clarified Perform Queries section, referring to oXygen 17.0 and distinguishing between one-time setup and recurring steps)
Line 30: Line 30:
  
 
=Perform Queries=
 
=Perform Queries=
 +
==One-Time Setup==
  
===Preparations===  
+
===Preparations===
# Download one of the complete [http://basex.org/download BaseX distributions] (ZIP, EXE)
+
# Download one of the complete [http://basex.org/download BaseX distributions] (ZIP, EXE).
# 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 [[Startup#BaseX Server|BaseX Server]] instance
+
# 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 [[Startup#BaseX Server|BaseX Server]] instance.
  
===Data Source===  
+
===Configure Data Source===
# Start oXygen and go to ''Options'' → ''Preferences'' → ''Data Sources''
+
# Start oXygen and select ''Options'' → ''Preferences'' → ''Data Sources''.
# Add a new Data Source with the ''New'' button ({{Code|+}})
+
# In the Data Sources section, add a new data source using the ''New'' button ({{Code|+}}).
# Enter "BaseX-XQJ" as connection name and choose ''XQuery API for Java (XQJ)'' as type
+
# Enter "BaseX-XQJ" as Name and select ''XQuery API for Java (XQJ)'' as type.
# Add the following JAR files above with the ''Add'' Button: {{Code|xqj-api-1.0.jar}}, {{Code|xqj2-0.2.0.jar}} and {{Code|basex-xqj-1.3.0.jar}} (the versions of the JAR file may differ). If you add the BaseX library as well {{Code|basex7.9.jar}}, you can also use the local XQJ driver.
+
# Add the following JAR files above with the ''Add Files'' Button: {{Code|xqj-api-1.0.jar}}, {{Code|xqj2-0.2.0.jar}} and {{Code|basex-xqj-1.3.0.jar}} (the versions of the JAR file may differ). If you add the BaseX library as well {{Code|basex.jar}}, you can also use the local XQJ driver.
# Unter "Driver class", choose the default or the local XQJ driver ({{Code|net.xqj.basex.BaseXXQDataSource}} vs. {{Code|net.xqj.basex.local.BaseXXQDataSource}}).
+
# Under "Driver class", choose the default or the local XQJ driver ({{Code|net.xqj.basex.BaseXXQDataSource}} vs. {{Code|net.xqj.basex.local.BaseXXQDataSource}}).
# Press ''OK''
+
# Click ''OK''.
  
==Connection==
+
===Configure Connection===
# Press ''New'' ({{Code|+}}) in the Connection Panel below.  
+
# In the Connections section (in the same Preferences dialog from the Configure Data Source procedure), click ''New'' ({{Code|+}}).  
# Enter Name "BaseX" and select "BaseX-XQJ" in the Data Source box.  
+
# Enter "BaseX" as Name and select "BaseX-XQJ" as Data Source.  
# If you use the default driver, you need to enter connection details:
+
# If you use the default driver, enter these values in the Connection Details section:
#* Port: {{Code|1984}}
+
#* port: {{Code|1984}}
#* Server name: {{Code|localhost}}
+
#* serverName: {{Code|localhost}}
#* User: {{Code|admin}}
+
#* user: {{Code|admin}}
#* Password: {{Code|admin}}
+
#* password: {{Code|admin}}
# Now press ''OK'', and your connection is ready.
+
# Click ''OK'' to complete the connection configuration.
 +
# Click ''OK'' again to close the Preferences dialog.
  
==Usage==
+
===Configure New Transformation Scenario===
The query execution works as follows:
+
# Select ''Window'' → ''Show View'' → ''Transformation Scenarios''.
 
+
# Select the ''XQuery transformation'' tree entry, and click {{Code|+}} to add a new scenario.
# Configure a new transformation scenario in ''Window'' → ''Show View'' → ''Transformation Scenarios''.
+
#:If this entry does not appear in the tree, click {{Code|+}} and select ''XQuery transformation'' in the dropdown list.
# Choose the ''XQuery Transformation'' tree entry.
 
# Press the <code>plus</code> sign to add a new scenario.  
 
 
# Enter a Name and an optional XML and XQuery URL (e.g. your query document/file).
 
# Enter a Name and an optional XML and XQuery URL (e.g. your query document/file).
 
# Choose "BaseX" as Transformer from the combo box.  
 
# Choose "BaseX" as Transformer from the combo box.  
# Press ''OK'', and your scenario is ready. Now you can start the transformation, e.g. by clicking on the red ''Play'' button.  
+
# Click ''OK'' to complete the scenario configuration.
# The results should immediately occur in the result panel.
+
 
 +
==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.  
 +
 
 +
The results should immediately occur in the result panel.
 +
 
 
--[[User:CG|CG]] 14:45, 29 January 2015 (CET)
 
--[[User:CG|CG]] 14:45, 29 January 2015 (CET)

Revision as of 13:49, 10 June 2015

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:

Access Database Resources

Preparations

  • First, start the BaseX WebDAV service.

Configuration

  1. Go to menu OptionsPreferencesData Sources
  2. In the Connections panel, 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

You can now open single database files as follows:

  • Choose FileOpen URL....

File:Webdav-oxygen01.png

  • Enter the corresponding user name and password (if needed), the URL of the BaseX WebDAV Server, and then click "Browse".

File:Webdav-oxygen02.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 section, add a new data source using the New button (+).
  3. Enter "BaseX-XQJ" as Name and select XQuery API for Java (XQJ) as type.
  4. Add the following JAR files above with the Add Files Button: xqj-api-1.0.jar, xqj2-0.2.0.jar and basex-xqj-1.3.0.jar (the versions of the JAR file may differ). If you add the BaseX library as well basex.jar, you can also use the local XQJ driver.
  5. Under "Driver class", choose the default or the local XQJ driver (net.xqj.basex.BaseXXQDataSource vs. 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" 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.

The results should immediately occur in the result panel.

--CG 14:45, 29 January 2015 (CET)