This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: buggy
RDFLib Ontology LSP
rdflib-ontology-lsp is a Python language server that adds autocomplete for rdflib.Namespace terms in Python files.
If your workspace contains:
from rdflib import Namespace
SKG = Namespace("https://sakuna.ph/")
and an ontology file contains:
@prefix skg: <https://sakuna.ph/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
skg:Person a owl:Class .
skg:hasName a owl:DatatypeProperty .
skg:worksFor a owl:ObjectProperty .
then typing SKG. in a Python file can suggest Person, hasName, and worksFor.
Features
- Scans Python files for
Namespace(...),rdflib.Namespace(...), aliased imports such asfrom rdflib import Namespace as NS, and simple string constants passed toNamespace(BASE_IRI). - Scans ontology files matching
**/*.ttl,**/*.owl,**/*.rdf,**/*.nt, and**/*.jsonld. - Suggests only ontology local names that are valid Python dot-access identifiers.
- Includes the ontology type, full IRI, and source file in completion metadata.
- Shows
rdfs:commentorskos:definitiontext in completion documentation when present. - Refreshes the in-memory index when Python or ontology files change.
- Includes built-in suggestions for RDF, RDFS, SKOS, OWL, PROV-O, and GeoSPARQL namespace imports from RDFLib.
Install
From this repository:
python -m pip install -e ".[dev]"
This installs the server and development test dependency. Runtime dependencies are pygls and rdflib.
Run the Language Server
python -m rdflib_ontology_lsp.server
The server communicates over stdio, which is what the VS Code client uses.
Run Tests
python -m pytest
Example Files
The examples/ directory contains:
examples/ontology.ttlexamples/example.py
They demonstrate the https://sakuna.ph/ namespace and ontology terms.
VS Code Extension Development
-
Install the Python server from the repository root:
python -m pip install -e ".[dev]"
-
Install and build the VS Code client:
cd vscode-client npm install npm run compile
-
Open this repository, or
vscode-client, in VS Code. -
Press
F5to launch an Extension Development Host. The launch config opens this repository in the development host. -
Type
SKG.inexamples/example.pyafter the detectedNamespace("https://sakuna.ph/")assignment.
The client also adds the parent repository src directory to PYTHONPATH for local development, so it can run the server from source.
If suggestions do not appear automatically, run Trigger Suggest in VS Code or press Ctrl+Space after SKG.. Check Output: RDFLib Ontology Autocomplete for the Python executable, server cwd, and workspace scan messages.
Configuration
Default settings:
{
"rdflibOntologyAutocomplete.ontologyFiles": [
"**/*.ttl",
"**/*.owl",
"**/*.rdf",
"**/*.nt",
"**/*.jsonld"
],
"rdflibOntologyAutocomplete.exclude": [
"**/.venv/**",
"**/venv/**",
"**/node_modules/**",
"**/.git/**"
],
"rdflibOntologyAutocomplete.enableDiagnostics": false,
"rdflibOntologyAutocomplete.enableStandardVocabularies": true,
"rdflibOntologyAutocomplete.pythonPath": "",
"rdflibOntologyAutocomplete.logLevel": "info"
}
Set rdflibOntologyAutocomplete.pythonPath to a Python executable or virtual environment directory if you want the extension to use a specific interpreter. The setting supports ${workspaceFolder}.
Set rdflibOntologyAutocomplete.enableStandardVocabularies to false if you only want suggestions from ontology files in the workspace.
Supported Ontology Types
The scanner indexes subjects with these RDF types:
owl:Classrdfs:Classrdf:Propertyowl:ObjectPropertyowl:DatatypePropertyowl:AnnotationProperty
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rdflib_ontology_lsp-0.1.0.tar.gz.
File metadata
- Download URL: rdflib_ontology_lsp-0.1.0.tar.gz
- Upload date:
- Size: 7.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8215ec258f161d8c00614c3a284cebacd6771115f8067c7ca6c5880f2a9ee03a
|
|
| MD5 |
0326e0a83d96df963d8d2522b8c4fde8
|
|
| BLAKE2b-256 |
8ec1b3c25b41990c1c63279483713898ab5e142461a432f81efea2f42f5219e9
|
File details
Details for the file rdflib_ontology_lsp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rdflib_ontology_lsp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeec3aa6b32330f81a85f66bcf84333715769078adcb33eb37c8e568f344244b
|
|
| MD5 |
d59069591114b7a49fbbf6c260408e80
|
|
| BLAKE2b-256 |
08658442fa6542c31e8764840a3419cbabea81416325d3e45108e4a35234917f
|