Blog
RDF and SPARQL - Blog

How to get completion suggestions based on RDF Schema/OWL ontologies?

How-Tos
Manually typing out long URIs and prefixes when writing RDF or SPARQL queries can be a tedious and time-consuming task. Fortunately, with the RDF and SPARQL plugin for JetBrains IDEs, there's a faster and more efficient way to autocomplete your code.

In this article, we'll show you how to use the plugin to get completion suggestions based on RDF schema and OWL ontologies, along with two fallback options - providing a download URL for the ontology in the plugin settings or using the Linked Open Vocabularies API.

Let's get started!

Step 1: Download an RDF Schema/OWL Ontology

The first step is to download an RDF schema/OWL ontology by pressing Alt+Enter (or ⌥ ⏎) on the RDF prefix declaration. This will prompt the intention action to download the corresponding ontology and index its content for completion suggestions.
In the event that the ontology cannot be downloaded by its IRI, there is an option to provide a download URL in the plugin settings (Languages & Frameworks -> RDF and SPARQL -> Vocabularies) or click on Fix download URL.

For example, a download URL for https://schema.org is https://raw.githubusercontent.com/schemaorg/schemaorg/main/data/schema.ttl.

Step 2: Get Completion Suggestions

Once the ontology is downloaded and indexed, you can get completion suggestions in your RDF and SPARQL files by pressing Ctrl+Space. The plugin will suggest possible completions based on the ontology content. You can also start typing and the plugin will suggest completions based on the characters you've typed so far.

Fallback Option: Linked Open Vocabularies API

In case an ontology is not indexed by the plugin, the plugin will fetch the completion suggestions from the Linked Open Vocabularies, but only if you register and type the prefix, e.g. dcterms:. Of course, the quality of the suggestions will depend on the version of the ontology in the LOV, frequently it's not the latest one, as well as on the correctly specified prefix IRI.

Conclusion

In conclusion, the RDF and SPARQL plugin for JetBrains IDEs is a powerful tool that can help you code more efficiently by providing completion suggestions based on RDF schema and OWL ontologies. With the fallback option, you can ensure that you always have access to the completion suggestions you need. Download the plugin today and start coding smarter, not harder!