Quick Start Guide

Below you can find general instructions on how to install the plugin and work with RDF and SPARQL in IDEA, DataGrip, and other JetBrains IDEs. Menu paths and dialog appearance may slightly vary depending on a particular IDE.

Install RDF and SPARQL

Go to File / Settings | Plugins in your IDE, switch to Marketplace, and search for RDF and SPARQL.

RDF and SPARQL in Marketplace

Click Install and restart the IDE.

Create an RDF or SPARQL file

Go to File / New, then select SPARQL File or RDF Turtle File or RDF Trig File option and put file name in the popup without an extension.

Create a file with File / New

Also you can press Ctrl+Alt+Insert to open New in This Directory popup and search for one of the options, then put file name in the popup without an extension.

Create a file with New in This Directory popup

Execute a SPARQL query

The plugin supports execution of all query forms of SPARQL 1.1 Query Language and SPARQL 1.1 Update. To execute a query you need to have a SPARQL endpoint registered and a SPARQL file with a query.

Register a SPARQL endpoint

Open SPARQL Endpoint tool window, press + button on the top or Alt+Insert and you should see the New SPARQL endpoint dialog.

Register a SPARQL endpoint

Enter the name and connection details, after that it is recommended to test the connection settings with Test connection button. If the connection settings are okay, you should see a green check sign.

Open and execute a SPARQL file

Create a SPARQL file with a query or open an existing one. Press the Run button in the editor toolbar or Ctrl+Enter shortcut.

SPARQL query execution

The 8:Services tool window will open up and show the query results, like on the screenshot below. The prefix declarations from the query are used to replace URIs with corresponding prefixed names.

SPARQL query results

Press Execute button or Ctrl+Enter to rerun the query or Export to file button to export the query results in a file in CSV, TSV, XML, JSON, Apache Thrift or Text formats.

Declare a well-known or a custom URI prefix with a keyboard shortcut

The plugin can automatically declare a well-known URI prefix or a custom one registered in the current project. Place the cursor on a prefixed name if an undeclared prefix, press Alt+Enter and select Try to lookup prefix URI to declare it option.

Declare an URI prefix

The well-known URI prefixes provided by prefix.cc are used here. You can override a well-known URI prefix or declare your own one in File / Settings | Languages & Frameworks / RDF and SPARQL / Prefix Declarations.

Register an URI prefix mapping

Such custom URI prefixes are used on a per project basis. If you want to share them with your team members, then commit .idea/rdfandsparql.xml to the project’s version control system.

Use completion suggestions for prefixed names

The plugin provides completion suggestions for prefixed names of classes and properties based on:

Use Ctrl+Space shortcut anywhere in file or after the colon in a prefixed name to see completion suggestion like on the screenshot below:

Turtle autocomplete suggestions

The prefix should be defined with PREFIX or @prefix earlier in the file than the prefixed name you want to autocomplete. Don’t forget to download ontologies for better and faster completion suggestions.

Download an RDFS/OWL ontology for local indexing

The completion suggestions and quick documentation work the best with locally indexed ontologies. The plugin supports both RDFS and OWL ontologies. To download an ontology do the following steps:

  • define a namespace with PREFIX or @prefix for it,
  • use Alt+Enter shortcut on its URI,
  • select Try to download to enable autocompletion, etc. option.

Download ontology

You need to download an ontology only once and then it is available for all projects in the IDE.