Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>SPARQL-GenerateNew to Visual Studio Code? Get it now.
SPARQL-Generate

SPARQL-Generate

Preview

Maxime Lefrançois

| (0) | Free
SPARQL-Generate (.rqg): highlighting, snippets, and running queries with the engine — RDF or text generated from RDF and from CSV, JSON, XML, HTML… documents.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SPARQL-Generate for VS Code

SPARQL-Generate extends SPARQL 1.1 to generate RDF or text from RDF datasets and from documents in heterogeneous formats: CSV, JSON, XML, HTML, GeoJSON, CBOR, SQL… This extension edits and runs SPARQL-Generate queries (.rqg), and replaces the former Sublime Text package.

Features

  • Highlighting of SPARQL-Generate v2: the SPARQL 1.1 base, the GENERATE, TEMPLATE, PERFORM and FUNCTION forms, ITERATOR, SOURCE … ACCEPT, BOX, FORMAT, GROUP, LIST, the expression nodes ?{ … }, and the expressions embedded in IRIs and strings (<http://example.org/{?id}>, "Hello {?name}"), highlighted as SPARQL inside. The grammar comes from highlight-sparql-generate.
  • Run Query (Ctrl+Alt+Enter, Cmd+Alt+Enter on macOS; the ▶ button of the editor title; the Run Query CodeLens above the query form; the context menus): runs the active query with the engine, in the directory of the query, exactly as the command-line interface does — so sparql-generate-conf.json, its documentset, namedqueries, namedgraphs, output and outputFormat, and the default graph dataset/default.ttl are honoured. The result streams into a new read-only editor (Turtle for GENERATE, text for TEMPLATE, a table for SELECT); the log goes to the SPARQL-Generate output channel.
  • Diagnostics: a syntax error is shown at the line and column the parser reports. Check Syntax (CodeLens, context menu, or on save with sparqlGenerate.checkSyntaxOnSave) parses without running.
  • The engine is downloaded on first use: the command-line JAR of the latest release, about 30 MB, kept in the extension's storage. Or point sparqlGenerate.java.jar to your own build.
  • Java is found for you: the extension reads from the engine JAR which Java it needs, and takes the first suitable one among JAVA_HOME, the PATH and the usual installation directories. SPARQL-Generate 2.2 and later need Java 17; if only an older Java is found, the extension says so, names what it found, and points to sparqlGenerate.java.path.
  • Snippets for the common forms: generate-json, generate-csv, template, template-before-after, iterator, source, function, select-named, box, format, group-template, prefixes…
  • Open the Project Configuration: opens (or creates) sparql-generate-conf.json next to the query.

Requirements

  • A Java runtime: 17 or later for SPARQL-Generate 2.2+ (Java 8 for the 2.1 releases). Adoptium provides free JDKs.
  • An internet connection on the first run, to download the engine — or a local JAR in sparqlGenerate.java.jar.

A project, as the command line sees it

my-project/
├── query.rqg                    the query you run
├── sparql-generate-conf.json    optional: documents, named queries, output…
├── documentset/                 documents mapped to IRIs by the configuration
└── dataset/default.ttl          optional: the default graph
{
  "documentset": [
    { "uri": "http://example.org/people.json", "path": "documentset/people.json",
      "mediatype": "application/json" }
  ]
}

The configuration keys are documented with the command-line interface. The extension always runs the active file (-q), whatever query the configuration names; it passes the log level of sparqlGenerate.logLevel unless the configuration sets its own (loglevel).

Settings

Setting Default
sparqlGenerate.backend java java, or python (experimental: pysparql-generate, the Python implementation, through its sparql-generate-py command)
sparqlGenerate.java.jar (empty) an engine JAR; empty = the one downloaded
sparqlGenerate.java.engineVersion latest the release to download: latest or X.Y.Z
sparqlGenerate.java.path (empty) a java executable or a JDK home; empty = found automatically
sparqlGenerate.python.command sparql-generate-py the pysparql-generate command
sparqlGenerate.logLevel WARN -l of the engine
sparqlGenerate.extraArguments [] more arguments, e.g. ["-Bname=\"Alice\""]
sparqlGenerate.saveBeforeRun true save the query before running it
sparqlGenerate.checkSyntaxOnSave false check the syntax on each save
sparqlGenerate.codeLens true Run Query / Check Syntax above the query

Coming from Sublime Text

Sublime Text package VS Code
Tools › Build, Ctrl+B Run Query, Ctrl+Alt+Enter, ▶
the .rqglog log, Ctrl+Shift+L the SPARQL-Generate output channel (Show Log)
Ctrl+Shift+O, the configuration Open the Project Configuration
the output in a .out file a new editor (or the output file of the configuration)
copy sparql-generate.jar into the package by hand downloaded on first use

Licence

Apache-2.0. The grammar includes the SPARQL and Turtle grammars of stardog-union.stardog-rdf-grammars (Apache-2.0).

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft