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 IntelliJ-based IDEs. Menu paths and dialog appearance may slightly vary depending on a particular IDE.
Install RDF and SPARQL
File / Settings | Plugins in your IDE, switch to Marketplace, and search for RDF and SPARQL.
Click install and restart the IDE.
Create an RDF or SPARQL file
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.
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.
Execute a SPARQL query
The plugin currently supports execution of SELECT and ASK query forms of SPARQL 1.1 Query Language. To execute a query you need to have a SPARQL endpoint registered and a SPARQL file with a query.
If you want to see support of INSERT, DELETE and other query forms, vote for the issue #15.
Register a SPARQL endpoint
SPARQL Endpoint tool window, press
+ button on the top or Alt+Insert and you should see the
New SPARQL endpoint dialog.
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 on the editor toolbar or Ctrl+Enter shortcut.
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.
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.
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.
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:
- the Linked Open Vocabularies’ Autocompete Term API,
- the index of locally cached RDFS/OWL ontologies,
- and the index of ontologies embedded in the plugin, such as XML Schema Built-n Datatypes.
Use Ctrl+Space shortcut anywhere in file or after the colon in a prefixed name to see completion suggestion like on the screenshot below:
The prefix should be defined with
@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
- define a namespace with
- use Alt+Enter shortcut on its URI,
- select Try to download to enable autocompletion, etc. option.
You need to download an ontology only once and then it is available for all projects in the IDE.