Integrating IntelliJ IDEA

From BaseX Documentation

Revision as of 12:17, 24 January 2019 by Sabine Teubner (Talk | contribs)
Jump to: navigation, search

This article is part of the Getting Started Section. It describes how to run XPath/XQuery code from within the IntelliJ IDEA IDE.

Contents

Preparations

The following steps apply to all operating systems:

XQuery Support + MarkLogic Debugger

This section focuses on Grzegorz Ligas' XQuery Support plugin.

Installation

After installing IntelliJ IDEA and BaseX, install the XQuery Support plugin by one of the following methods:

From the Start Screen

Intellij-startbildschirm.png

  1. Start IntelliJ IDEA and select ConfigurePlugins.
  2. In the Plugins window select the tab Marketplace.
  3. Type "XQuery Support" into the Search plugins in marketplace field.
  4. Click the Install button below the XQuery Support + MarkLogic Debugger plugin.
  5. You will be prompted to restart IDEA to load the new plugin.

From the IntelliJ IDEA Menu

  1. Select Settings/Preferences in the IntelliJ IDEA menu.
  2. In the Settings/Preferences window select Plugins.
  3. In the Plugins window select the tab Marketplace.
  4. Type "XQuery Support" into the Search plugins in marketplace field.
  5. Click the Install button below the XQuery Support + MarkLogic Debugger plugin.
  6. You will be prompted to restart IDEA to load the new plugin.

Setting Up

File Extensions and XQuery Flavor

Intellij-xquery-settings.png

Configuring The Processor

You can set up the plugin as a standalone processor or client.

Standalone

  1. In the Settings/Preferences window, expand the Languages & Frameworks item and select XQuery Data Sources.
  2. Click on the + button in the middle column, to add a new data source.
  3. Select BaseX (native embedded) from the dropdown box.
  4. In the right-hand column, check the User defined XQJ Driver check box.
  5. Use the + button below the check box to add the following jars from your BaseX distribution:
    • basex/BaseX.jar
    • basex/lib/basex-apj-9.1.1.jar
    • basex/lib/basex-xqj-9.0.jar
    • basex/lib/xqj2-0.2.0.jar
  6. Click Apply to store your settings.

Client

This assumes that you already have a BaseX database named factbook.

  1. In the Settings/Preferences window, expand the Languages & Frameworks item and select XQuery Data Sources.
  2. Click on the + button in the middle column, to add a new data source.
  3. Select BaseX from the dropdown box.
  4. In the right-hand column, fill in the appropriate connection details; e.g. default values:
    • Host = localhost
    • Port = 1984
    • Database name = factbook
    • Username = admin
    • Password = admin
  5. Select Apply, then OK and your BaseX factbook database is ready to query.

Intellij-basex-data-source.png

Querying Your Data

  1. To create a new project, choose the Create new project option from the start screen or select NewProject... from the File menu.
  2. In the New Project dialog choose Empty Project from the left-hand column and click the Next button.
  3. Enter a name and location for your project.
  4. Click Finish to create the project.
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export