A Visual Studio Code extension that provides support for the SPARQL query language (.rq, .sparql files):
-
Qlue-ls language server developed by Ioannis Nezis
- Language intelligence: relevant autocomplete, diagnostics, hover info
- Query quality: formatting, refactoring, code actions
- Configurable: queries used for completion, formatting behavior, etc
-
Syntax highlighting with semantic tokens to adapt to themes
-
Query execution & results inspection with the YASGUI YASR component, against remote endpoints, or a local embedded oxigraph triplestore
Install this extension from the Visual Studio Marketplace or open-vsx.
Once installed in Visual Studio Code, SPARQL Qlue will automatically run when you open or edit a .rq or .sparql file.
Completion and hover requires a target endpoint URL (a Backend for Qlue-ls). It can be provided through different ways:
- Define it using a
#+ endpoint:comment at the start of the query (recommended) endpoint.txtfile in folder or parent folders of the query (grlc.io compatible)- Change the endpoint URL in the input box of the query panel.
The extension automatically disables the SPARQL language server from the
semantic-web-lspextension with settings"swls.sparql": falseto avoid running two SPARQL language servers. We recommend to install it for RDF files support.
This extension uses the Qlue-ls language server compiled to WebAssembly, running in-process.
- Context-aware autocomplete: suggests subjects, predicates, and objects based on the SPARQL endpoint content and the current query context, by running a SPARQL query to explore available options
- Hover information: shows labels and descriptions for IRIs by querying the endpoint
- Diagnostics: reports syntax errors and warnings as you type
- Auto-formatting: formats SPARQL documents, configurable
- Code actions: quick fixes for common issues, e.g. contract triples with the same subject
Run the opened query file with Ctrl+Enter / Cmd+Enter, the ▶ file header button, or right-click → Execute SPARQL Query
The endpoint URL is automatically resolved from a #+ endpoint: <url> comment in the file, or from an endpoint.txt file in the same directory or any parent up to the workspace root. It can also be changed in a text input in the UI.
You can add RDF files (e.g. .ttl, .trig, .jsonld, etc) to a local embedded oxigraph SPARQL endpoint by right clicking RDF files in the explorer. Then execute the queries against this embedded endpoint using the local://sparql-endpoint URL.
Results are displayed in the SPARQL Results panel using the YASGUI YASR component, with plugins for:
- Graph visualization of
CONSTRUCTquery results - Map visualization of GeoSPARQL results
-
General Language server behavior for formatting, completion and prefixes are configured in VSCode settings (
sparql-qlue.) -
Endpoints backends are initialized with defaults and metadata retrieved from endpoint, they can be further configured in the settings panel.
Click the SPARQL Qlue item in the bottom status bar, or use the dropdown button in the file header, or right-click → Configure SPARQL Language Server to open the settings editor.
See CONTRIBUTING.md


