SHACL (Shapes Constraint Language) lets you define constraints on RDF graphs — required properties, value types, cardinality rules, and more. SWLS integrates SHACL validation directly into the editor: shapes are loaded when the language server starts, and any violations in your open documents appear immediately as diagnostics (squiggly underlines) in the editor and in the Problems panel, without a separate validation step.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SemanticWebLanguageServer/swls-vscode/llms.txt
Use this file to discover all available pages before exploring further.
How SHACL validation works in SWLS
SWLS loads shape files at startup using the URLs listed inswls.shapes. Once loaded, the server continuously validates every open Turtle or TriG document against those shapes. Violations surface as warnings or errors inline — the same mechanism used for syntax errors and undefined prefixes.
Shape loading uses the same URL resolution that applies to ontologies: you can point to local workspace files with file:// URLs, or to remote HTTP/HTTPS resources. The server re-reads the shapes setting when you reload the window.
Setting up SHACL validation
Create or obtain a SHACL shapes file
Write your constraints in a Turtle file (
.ttl). Here is a minimal example that requires every foaf:Person to have at least one foaf:name of type xsd:string:Register the shapes file in your workspace settings
Add the shapes file URL to You can list multiple URLs; SWLS loads all of them and unions the shape graphs together.
swls.shapes in your workspace .vscode/settings.json:Open a data file and inspect the Problems panel
Open any Turtle or TriG file in your workspace. SWLS validates it against the loaded shapes automatically. Any violations appear as diagnostics in the editor gutter and in the Problems panel (SWLS will raise a diagnostic on
Ctrl+Shift+M / Cmd+Shift+M).For example, this data file violates the ex:PersonShape defined above — ex:alice is typed as foaf:Person but has no foaf:name:ex:alice indicating the sh:minCount constraint is not satisfied.Disabling SHACL validation
If you want to keep your shapes loaded (so they still inform completions) but suppress violation diagnostics, add"shapes" to the swls.disabled array:
"shapes" from the array and reload the window.
For remote shape URLs and details on loading ontologies alongside shapes, see the Ontologies & Shapes configuration reference.