This extension provides a SPARQL Notebook mode for Visual Studio Code. This is a powerful way to document SPARQL queries and make them execute as notebook code cells.
Use a SPARQL notebook to:
This notebook can render SPARQL SELECT results and RDF graphs via SPARQL CONSTRUCT queries.
The extension automatically installs the Stardog RDF Grammars and SPARQL Language Server extensions for SPARQL syntax highlighting and auto-completion.
This extension is still pretty raw but it works for us [tm]. Bug reports & contributions are very welcome!
.sparqlbook
file as a Notebook..sparqlbook
file to Markdown..sparql
or .rq
files to cells.You can install it directly from the Visual Studio Code Extension tab. It is available on the Marketplace
Open any .sparqlbook
file with the Open With
menu option. Then, select the SPARQL Notebook
format. Connect to a SPARQL Endpoint and execute query blocks and view output interactively.
Endpoints are the destinations for sending SPARQL queries, and there are two types:
You can connect to a remote server by clicking the +
button in the SPARQL Connections
panel. Fill in the server URL and optional credentials. If you omit credentials, the extension will attempt a connection without them. This connection is used throughout the entire notebook, except when a cell defines its own endpoint.
Configure a local endpoint by right-clicking on a TTL, NT, or RDF file and selecting SPARQL Notebook: Use File as Store
. This creates a new local endpoint populated with the chosen file's content. The entire notebook uses this endpoint, except when a cell specifies its own.
You can assign an endpoint to a specific cell by adding a comment with the endpoint URL or file path in a code cell:
# [endpoint=https://lindas.admin.ch/query]
or
# [endpoint=./relative/path/file.ttl]
# [endpoint=/absolute/path/file.ttl]
Working with relative paths makes the notebook portable.
For file based endpoints you can have multiple files in the endpoint definitions in many ways:
Absolute or relative paths pattern are supported but i suggest to use relative paths for portability.
# [endpoint=./rdf/{a,b}.ttl]
or
# [endpoint=./rdf/*.ttl]
or
# [endpoint=./rdf/a.ttl]
# [endpoint=./rdf/b.ttl]
Note: You cannot mix HTTP endpoints and file endpoints in the same cell.
The cell status bar displays information about the endpoint in use and its source.
A code cell contains a SPARQL query, which can be a SELECT, ASK, CONSTRUCT, or DESCRIBE query. Execute a code cell by clicking the Run Cell button in the cell toolbar or pressing Ctrl+Enter (or Option+Enter on Mac).
You can attach a query file to a cell. The query file will load and execute when you run the cell. Supported file extensions include .sparql
and .rq
. Saving the notebook also saves the query file.
The cell status bar indicates whether the cell uses a query file.
Technically that means set the default renderer for MIME-Type application/sparql-results+json
.
application/sparql-results+json
Right click a .sparqlbook
file and select Export to Markdown
.
This extension uses the Notebook API . Contributions & bug fixes are always welcome! h
And all contributors ❤️