Integrating IntelliJ IDEA

From BaseX Documentation

(Difference between revisions)
Jump to: navigation, search
Line 52: Line 52:
==Querying Your Data==
==Querying Your Data==
-
===Create a New Project===
+
 
 +
'''Create a New Project'''
* To create a new project choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
* To create a new project choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
* In the ''New Project'' dialog, choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
* In the ''New Project'' dialog, choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
-
* Enter a name and location for your project.
+
* Enter a name and location for your project and click on the ''Finish'' button.
-
===Customize the XQuery Module===
+
'''Customize the XQuery Module'''
* Click the ''Add Configuration'' button below the IntelliJ IDEA menu bar.
* Click the ''Add Configuration'' button below the IntelliJ IDEA menu bar.
[[File:Intellij-add-configuration.png]]
[[File:Intellij-add-configuration.png]]
Line 78: Line 79:
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
-
===Create a Query File===
+
'''Create a Query File'''
* In the project view, create a new XQuery file, either by right-clicking on the project name and choosing ''New''→''File'' or by selecting ''New''→''File'' from the File menu. Enter a file name and click ''OK''.
* In the project view, create a new XQuery file, either by right-clicking on the project name and choosing ''New''→''File'' or by selecting ''New''→''File'' from the File menu. Enter a file name and click ''OK''.
* Type in your query and save your file.
* Type in your query and save your file.
-
===Create a New Configuration===
+
'''Create a New Configuration'''
* Click on the ''Add Configuration'' button once again.
* Click on the ''Add Configuration'' button once again.
* In the ''Run/Debug Configurations'' dialog, click the {{Code|+}} button to create a new configuration based on a template.
* In the ''Run/Debug Configurations'' dialog, click the {{Code|+}} button to create a new configuration based on a template.
Line 94: Line 95:
[[File:Intellij-run-button.png]]
[[File:Intellij-run-button.png]]
-
===Execute Your Query===
+
'''Execute Your Query'''
* If the configuration does not run as a standalone instance, make sure that BaseX is up and running.
* If the configuration does not run as a standalone instance, make sure that BaseX is up and running.
* Click the ''Run'' button to execute your query.
* Click the ''Run'' button to execute your query.
Line 161: Line 162:
==Querying Your Data==
==Querying Your Data==
 +
 +
'''Create a New Project'''
* To create a new project choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
* To create a new project choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
* In the ''New Project'' dialog, choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
* In the ''New Project'' dialog, choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
-
* Enter a name and location for your project.
+
* Enter a name and location for your project and click on the ''Finish'' button.
-
* In the project view, create a new XQuery file, either by right-clicking on the project name and choosing ''New''''XQuery File'' or by selecting ''New''''XQuery File'' from the File menu. Enter a file name and click ''OK''.
+
 
-
* Type in your query.
+
'''Customize the XQuery Module'''
 +
* Click the ''Add Configuration'' button below the IntelliJ IDEA menu bar.
 +
[[File:Intellij-add-configuration.png]]
 +
* In the ''Run/Debug Configurations'' dialog, expand the Templates list and choose the ''XQuery Main Module'' entry.
 +
* Click on the ''Configure'' button next to the ''Data Source'' field and either choose the previously configured standalone version (''BaseX (native embedded)'' item) or the client version (''BaseX'' item) from the list.
 +
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
 +
 
 +
'''Create a Query File'''
 +
* In the project view, create a new XQuery file by right-clicking on the project name and choosing New→XQuery File. Enter a file name, select ''Main Module'' from the ''Kind'' dropdown and click OK.
 +
* Type in your query and save your file.
 +
 
 +
'''Create a New Configuration'''
 +
* Click on the ''Add Configuration'' button once again.
 +
* In the ''Run/Debug Configurations'' dialog, click the {{Code|+}} button to create a new configuration based on a template.
 +
* Choose the "XQuery Main Module" template you configured earlier.
 +
* Enter a name, e.g. "BaseX", into the ''Name'' field.
 +
* The data source should be preset either to "BaseX (native embedded)" or ''BaseX'' depending on your processor configuration.
 +
* In the ''Main file'' field, enter the path to your query file.
 +
[[File:Intellij-xquery-configuration2.png]]
 +
* Click ''Apply'' and then ''OK'' to close the ''Run/Debug Configurations'' dialog.
 +
* Now, the configuration should be set and the green ''Run'' button should be available below the IntelliJ IDEA menu bar.
 +
[[File:Intellij-run-button.png]]
 +
 
 +
 
 +
'''Execute Your Query'''
 +
* If the configuration does not run as a standalone instance, make sure that BaseX is up and running.
 +
* Click the ''Run'' button to execute your query.
[[File:Intellij-query.png]]
[[File:Intellij-query.png]]
-
* Click the green ''Run'' button below the IntelliJ IDEA menu bar.
 
-
* In the ''Edit Configuration'' dialog, choose one of the two data sources from the dropdown box, either "BaseX" or "BaseX (native embedded)". If you select "BaseX", make sure that BaseX is up and running.
 
-
* Click ''Run'' to execute your query.
 

Revision as of 11:21, 8 March 2019

This article is part of the Getting Started Section. It describes how to run XPath/XQuery code from within the IntelliJ IDEA IDE. There are currently two XQuery plugins for IntelliJ IDEA on the market:

Contents

Preparations

The following steps apply to all operating systems and both plugins:

xquery-intellij-plugin

This section focuses on Reece H. Dunn's xquery-intellij-plugin.

Installation

After installing IntelliJ IDEA and BaseX, install the xquery-intellij-plugin by one of the following methods:

From the Start Screen

Intellij-startbildschirm.png

From the IntelliJ IDEA Menu

Configuring The Processor

Intellij-xquery-settings-2.png

Querying Your Data

Create a New Project

Customize the XQuery Module

Intellij-add-configuration.png

Intellij-new-query-processor.png

Create a Query File

Create a New Configuration

Intellij-xquery-configuration.png

Intellij-run-button.png

Execute Your Query

XQuery Support

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

From the IntelliJ IDEA Menu

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

Client

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

Intellij-basex-data-source.png

Querying Your Data

Create a New Project

Customize the XQuery Module

Intellij-add-configuration.png

Create a Query File

Create a New Configuration

Intellij-xquery-configuration2.png

Intellij-run-button.png


Execute Your Query

Intellij-query.png

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export