Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Turtle RDF, SPARQL & JSON-LD Language Server (TTL, OWL, SHACL)New to Visual Studio Code? Get it now.
Turtle RDF, SPARQL & JSON-LD Language Server (TTL, OWL, SHACL)

Turtle RDF, SPARQL & JSON-LD Language Server (TTL, OWL, SHACL)

Abhishek Kundu

|
95 installs
| (0) | Free
Fast Turtle (.ttl) and RDF 1.2 support written in Rust, also for TriG, N-Triples, N-Quads, JSON-LD and SPARQL: syntax highlighting, error checking, SHACL validation, OWL 2 RL reasoning (inferred types with their proofs, SPARQL over inferred triples), completion of 80+ vocabularies (rdf, rdfs, owl, s
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

turtle-lsp

Turtle RDF Language Server for VS Code

Language support for RDF Turtle (.ttl), TriG (.trig), N-Triples (.nt), N-Quads (.nq) and SPARQL (.rq, .sparql, .ru): ontologies (OWL, RDFS, SKOS), SHACL shapes, linked data, and the queries and updates you run on them. Powered by turtle-lsp, a language server written in Rust: a keystroke in a 30,000-line file gets fresh diagnostics in about 5 ms.

Try it first in your browser, with nothing to install: RDF Editor.

Editing RDF in the browser: SHACL errors as you type, completion from the shapes, rename across files, a quick fix, and a SPARQL query with its results

Passes the W3C test suites: Turtle, TriG, N-Triples and N-Quads 1137/1137, SPARQL 1.1 and 1.2 syntax 425/426, SHACL Core 98/98, SHACL-SPARQL 23/23.

Reasoning

TurbOWL, an OWL 2 RL reasoner, works out in the background what your workspace implies. It is on by default.

  • Inferred types on hover, each with its proof: one W3C rule per step, and each triple it rests on a link to its line.
  • Contradictions as diagnostics, such as a member of two disjoint classes, with turtle.reasoning.diagnostics on.
  • SPARQL over inferred triples: ▶ Run query also matches what TurbOWL infers, with turtle.query.reasoning set to default or complete, or with the Inferred choice in the results panel.

Hovering ex:rex in a Turtle file: its inferred types ex:Mammal and ex:Animal, each proved by the W3C rule cax-sco from triples linked to their lines; then ex:alice, an ex:Person by the domain of ex:owns, and a click on a proof's link that goes to its line

Recorded in the browser editor; watch as MP4.

Features

  • Syntax highlighting for Turtle, TriG, N-Triples, N-Quads, SPARQL and RDF 1.2 (triple terms <<( )>>, reifiers ~, annotations {| |}), plus semantic highlighting of classes, properties, individuals, datatypes and deprecated terms.

  • Error checking as you type: syntax errors with recovery (one mistake does not hide the rest of the file), undeclared, unused and duplicate prefixes, invalid IRIs and language tags.

  • Vocabulary checks: unknown or deprecated terms in 80+ well-known vocabularies (rdf, rdfs, owl, skos, sh, dcterms, foaf, schema.org, prov, sosa, qudt and more), with "did you mean" fixes. Matched by namespace IRI, so your own ex: or sd: prefixes are never checked against the wrong vocabulary. Terms in your own namespaces that nothing describes (often typos) are flagged too.

  • SHACL validation: data is checked against the shapes in your workspace about a second after you stop typing, and on save. SHACL Core and SHACL-SPARQL (sh:sparql constraints, SPARQL targets and components). SPARQL inside shapes is checked as you type, and mistakes in the shapes themselves are flagged.

  • Reasoning (on by default; turtle.reasoning.rules): TurbOWL, an OWL 2 RL reasoner, works out what the workspace implies in the background. Hover lists a resource's inferred types, each with its proof, one W3C rule per step and each triple it rests on a link to its line. With turtle.reasoning.diagnostics on, contradictions, such as a member of two disjoint classes, are diagnostics.

  • owl:imports: imported ontologies are resolved from the workspace, a catalog-v001.xml or the cache (Turtle, N-Triples, RDF/XML), so their terms complete, hover and validate. An unresolved web import has a quick fix that fetches that one import and caches it; go to definition opens the cached copy.

  • Completion of prefixes and terms; type Pers to get foaf:Person. Classes come first after a, properties in predicate position; properties your SHACL shapes require or whose rdfs:domain fits come first, and sh:in values are offered. Accepting a term adds its @prefix line for you.

  • Hover with label, comment, types and where a resource is described; label inlay hints for opaque IRIs.

  • Navigation: go to definition, type definition (a resource's class), implementations (a class's instances and subclasses), type hierarchy, find references, document highlight.

  • Rename across files, including a prefix shared through prefixes.ttl, which is renamed in every file that takes it from there.

  • Formatting that keeps comments and statement order and never changes the graph.

  • Outline, workspace symbol search and folding.

  • Workspace graph: "Turtle: Show Workspace Graph" (or the graph button in the title bar of an RDF file) draws the workspace as one graph, with filters, search, a focus view and a class tree; click a node to go to its definition.

    The workspace graph of a small class hierarchy: rdf:type edges turned on, zoom and pan, a search that selects ex:rex and lists its links, its focus view, and the class tree

    Recorded in the browser editor; watch as MP4.

  • Quick fixes and refactorings: add a missing prefix (or the owl:imports that defines it), add all missing prefixes, remove an unused prefix, fix a misspelled term, organise prefixes, shorten or expand an IRI, extract a prefix for a namespace.

SPARQL

SPARQL queries and updates (SPARQL 1.1 and 1.2) get the same knowledge of your workspace and the vocabularies:

  • Syntax errors as you type, at the token where the query stops making sense; undeclared, unused and duplicate prefixes; unknown or deprecated vocabulary terms and undescribed terms of your own, with "did you mean"; a projected variable that the WHERE clause never binds.
  • Completion of keywords, variables, prefixes, terms and built-in functions. Accepting a term adds its PREFIX line.
  • Hover and label inlay hints on terms, as in Turtle.
  • Go to definition, references and document highlight for terms, prefixes and variables.
  • Rename of variables, prefixes and terms. Renaming a term in a Turtle file also renames it in your queries, and the other way round.
  • Formatting that keeps comments and never changes what the query means.
  • Quick fixes: add a missing PREFIX (or all of them), remove an unused one, fix a misspelled term; organise prefixes, shorten or expand an IRI.
  • Semantic highlighting, folding and an outline of the query or update operations.

▶ Run query above a query runs it over your workspace's files as the editor has them, unsaved edits included, and shows the results in a Query Results panel beside it: a table you can sort, copy or export as CSV or JSON (or true/false for ASK, triples for CONSTRUCT). Its Inferred choice (Off, Default rules or Complete rules; it starts at turtle.query.reasoning) reruns the query with or without what TurbOWL infers, and the results say how many inferred triples they include. The query runs in the background with a time limit and a row limit. No endpoint is contacted, and updates are never run.

A SPARQL query for the resources of type ex:Animal: with Inferred off it returns no rows, as no file says so; with TurbOWL's default rules it returns ex:polly, ex:rex and ex:tom, and the results say they include 12 inferred triples

Recorded in the browser editor; watch as MP4.

N-Quads

.nq files get what N-Triples files get: syntax errors per line with recovery, hover, navigation, an outline grouped by graph, and formatting with one quad per line. Their quads join the workspace, so terms described in a dataset dump count as described in your Turtle files.

JSON-LD

.jsonld files keep VS Code's JSON highlighting and get the server's checks: JSON syntax errors, @context errors, keys the context does not define, invalid IRIs and language tags, and SHACL results from your shapes on the key or value that breaks them. A compact IRI such as rdfs:label whose prefix the @context lacks gets a warning and a quick fix that adds the prefix.

Editing works as in Turtle:

  • completion in keys and @type values from the context in force, including @vocab terms and prefix:local names; completing a known prefix the context lacks adds it to the @context;
  • hover, go to definition (into the @context entry or a context file), references and highlights on terms;
  • rename of terms, keyword aliases and IRIs, each use rewritten in its own form; unsafe renames are refused with the reason;
  • Format Document, keeping the same JSON value;
  • semantic highlighting of keywords, properties and classes, and an outline that nests named graphs.

Their terms count in your Turtle and SPARQL files. Common contexts (schema.org, ActivityStreams, Verifiable Credentials, DID) are bundled; other remote contexts are fetched only with turtle.imports.network on.

Project prefixes

If your Turtle files share a prefix header instead of declaring prefixes themselves, put the header in a prefixes.ttl. Every Turtle file and SPARQL query in that folder or below can then use those prefixes. Or set turtle.prefixes.

Settings

  • turtle.prefixes: prefixes available in every file, e.g. { "ex": "http://example.org/" }.
  • turtle.server.path: use a different turtle-lsp binary: an absolute path to a file that exists (user settings only; in an untrusted workspace a binary inside the workspace is never run).
  • turtle.trace.server: log the language server traffic to the Output panel.
  • turtle.inlayHints.labels: show labels as inlay hints for opaque IRIs (default), all terms, or off.
  • turtle.shacl.enabled, turtle.shacl.maxTriples: SHACL validation, and the most triples one run validates, the shared triples and every dataset together; above it validation is skipped (default 2,000,000 triples).
  • turtle.shacl.onType: also validate while typing, not only on save (default on).
  • turtle.reasoning.rules: reason with TurbOWL, an OWL 2 RL reasoner: off, default (TurbOWL's default rules; the default) or complete (every W3C OWL 2 RL rule; slower). Hover then lists a resource's inferred types with their proofs.
  • turtle.reasoning.diagnostics: show TurbOWL's findings, such as a member of two disjoint classes, as diagnostics with their proofs (default off: a project's SHACL shapes often check the same rules).
  • turtle.reasoning.maxTriples: the most triples one reasoning run reads, the workspace's and its imports'; above it reasoning is skipped, with a note (default 2,000,000 triples).
  • turtle.lint.undescribedTerms: warn about your own terms that are described nowhere in the workspace.
  • turtle.lint.ignore: diagnostic codes never to report, such as unused-prefix or duplicate-label. Adds to the project's lint.ignore in turtle-lsp.json.
  • turtle.lint.enable: off-by-default checks to switch on: missing-label, missing-definition, multiple-definitions, duplicate-definition, lowercase-definition, missing-ontology-title, missing-ontology-description, missing-ontology-license. Adds to the project's lint.enable; a code in either lint.ignore stays off.
  • turtle.imports.network: fetch owl:imports and JSON-LD contexts over the network (default off; off in untrusted workspaces). With it off, the quick fix on an unresolved import fetches that one import and caches it. Fetches go only to public addresses, follow at most 10 redirects (never from https to http), and one pass makes at most 100 requests; see Network access.
  • turtle.imports.unresolved: while an import can't be loaded, SHACL results it could change are warnings with a note (soften, the default); ignore keeps their full severity.
  • turtle.format.lineWidth: line width for formatting (default 100).
  • turtle.codeLens.references: show "N references" above each subject a file describes; click it to list them (default on).
  • turtle.diagnostics.workspace: also check the files that are not open, in the background, and show their problems (default off).
  • turtle.parse.incremental: after an edit, parse only the statements around it, not the whole file (default on). The results are the same either way; if a file you edit shows other problems than after reopening it, turn this off and please report the file.
  • turtle.query.timeoutSeconds, turtle.query.maxRows: stop a query run with ▶ Run query after this many seconds (default 30), and show at most this many rows of its results (default 1000); 0 for no limit.
  • turtle.query.reasoning: run ▶ Run query over what TurbOWL infers too: off (default), default or complete. The Inferred choice in the results panel starts at this value and reruns the query with another.
  • turtle.query.maxBufferedRows: stop a query that keeps more than this many rows in memory to sort, group, deduplicate or join them (default 10 000 000; 0 for no limit). It counts rows, not bytes: ordinary rows take about 100 bytes each, long text values take more.

The extension sends the server only the settings you set. A setting you leave unset comes from the project's turtle-lsp.json, or takes its default. That file cannot turn on turtle.imports.network or raise the query, SHACL and reasoning limits; only your own settings can. In an untrusted workspace, turtle.server.path, turtle.imports.network, turtle.query.*, turtle.shacl.maxTriples, turtle.reasoning.maxTriples and turtle.diagnostics.workspace take your user settings only.

VS Code completes and checks turtle-lsp.json against the extension's JSON schema: each key with its default, its choices and its description, and a warning on a misspelt key, a wrong value, or a limit the file cannot raise.

In the browser (vscode.dev, github.dev)

The extension also runs in VS Code for the Web. Press . on a GitHub repository, or open a folder in vscode.dev, and the server runs inside the browser tab, compiled to WebAssembly. Your files are not uploaded anywhere.

What works: the language features above for every file type; cross-file features over the repository's RDF and SPARQL files (definitions, references, rename, completion of terms declared in other files, and problems in files you have not opened); prefixes.ttl; a turtle-lsp.json at the root of the first folder; SHACL validation; the workspace graph.

What does not work:

  • ▶ Run query is not shown, as it writes its results to disk.
  • owl:imports are not fetched from the web, so the terms of a web import stay unknown, as when you are offline.
  • The extension reads at most 2,000 files and 50 MB of RDF. Past either limit it says how many files it read; the rest are not checked or found by references.
  • A folder you add to the workspace after the start is read only after Turtle: Restart Language Server.

Your turtle.* settings apply, except turtle.server.path.

Also for Neovim and other editors

The same server works in any editor that speaks the Language Server Protocol. See the project README for Neovim setup.

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