OntoCode
Ontology-as-code for Git and VS Code — v0.2.2 ships today.
Browse OWL/RDF in VS Code, query and validate in CI, and index workspaces locally with a Rust engine. Editing, diagnostics, reasoning, and semantic diffs are on the roadmap.
Naming: OntoCode is the VS Code extension (product UI). OntoIndex is the Rust engine (
ontoindexCLI,ontoindex-*crates,ontoindex-lsp). This repo contains both.
Choose your path
Use the CLI (OntoIndex)
From a clone, cargo run -- runs the ontoindex binary (workspace default-member is ontoindex-cli).
Use VS Code (OntoCode Explorer)
- Install OntoCode from the Marketplace, or download a VSIX from GitHub Releases.
- Open a folder with
.ttl,.owl,.rdf, or other supported ontology files. - Use the OntoCode activity bar to browse entities and open the inspector.
Full install and troubleshooting: docs/vscode-install.md.
Two-layer architecture
OntoCode is designed as two products that ship together:
| Layer | What it is | Status in v0.2.2 |
|---|---|---|
| OntoCode | VS Code extension (explorer, entity inspector, jump-to-source) | Explorer shipping — install VSIX or run from extension/ |
| OntoIndex | Rust library + CLI + LSP (scan, parse, catalog, query, validate) | Shipping now |
┌─────────────────────────────────────┐
│ OntoCode (v0.2) │
│ VS Code extension + explorer UI │
└─────────────────┬───────────────────┘
│ ontoindex-lsp (stdio)
┌─────────────────▼───────────────────┐
│ OntoIndex (v0.2.2) │
│ Rust index, catalog, query, CLI, LSP │
└─────────────────┬───────────────────┘
│ Oxigraph / RDF parsers
┌─────────────────▼───────────────────┐
│ Your ontology repo │
│ .ttl .owl .rdf .jsonld … │
└─────────────────────────────────────┘
OntoIndex is useful on its own today (CLI, CI, local analysis). The extension will call into the same engine via a language server rather than reimplementing ontology logic in TypeScript.
Why OntoCode?
Protégé is strong for traditional ontology editing, but most engineering teams live in Git, pull requests, and VS Code. OntoCode targets that workflow:
| Shipped in v0.2 | Planned (v1.0 target) |
|---|---|
| Browse ontologies in VS Code | Hybrid authoring: forms + Manchester editor |
| Entity inspector and jump-to-source | OWL axiom editing and patch write-back |
ontoindex validate for CI |
Query workbench, Rust-native reasoners + explanations |
| SQL-like and SPARQL queries via CLI | OBO format + ROBOT interop |
| Local-first indexing | Semantic Git diff, LSP completion/rename |
Long-term goal: Protégé-competitive OWL 2 DL + OBO maintenance in VS Code — see PROTEGE_PARITY.md.
What's in v0.2.2 (OntoCode Explorer)
v0.2 adds the VS Code extension described in the v0.2 roadmap:
- VS Code extension — OntoCode activity bar with ontology tree views
- Entity inspector — IRI, labels, comments, parents, children, axioms
- Jump to source — open Turtle/RDF files at entity declarations
ontoindex-lsp— language server with custom catalog methods- LSP browsing — hover, document/workspace symbols, go-to-definition
v0.2.2 fixes (see CHANGELOG.md): reliable LSP startup after Marketplace/VSIX install (LanguageClient.start(), bundled binary permissions, macOS quarantine).
Exit criterion (works today):
- Open a repo with
.ttlfiles in VS Code with the extension loaded - Browse ontologies, classes, properties, and individuals in the sidebar
- Click an entity to inspect it and jump to its source
Install the extension
See docs/vscode-install.md (release VSIX, dev build, LSP troubleshooting) and extension/README.md.
What's in v0.1.0 (OntoIndex foundation)
This release delivers the Rust backend described in the v0.1 roadmap:
- Workspace scanner — recursive discovery,
.gitignoresupport, content hashing - RDF/OWL parsing — Turtle, RDF/XML, OWL, JSON-LD, N-Triples, N-Quads, TriG via Oxigraph
- Semantic catalog — ontologies, classes, properties, individuals, annotations, axioms, namespaces, imports
- SQL-like queries —
SELECT,FROM,WHERE, projections, CSV/JSON export - SPARQL — query indexed triples directly
- CLI —
ontoindex index,query,sparql,validate,inspect
Exit criterion (works today):
Quick start
# Build
# Index and inspect a workspace
# Query classes
# Filter results
# SPARQL
# Validate (non-zero exit on parse errors — CI-friendly)
# JSON output
Install the CLI from crates.io (binary name: ontoindex):
Or build from source after cloning this repository.
Planned VS Code experience (v0.3+)
Specs and wireframes live in docs/design/. Upcoming OntoCode UI includes:
- Inline diagnostics and validation (v0.3)
- Class/property/individual authoring (v0.4)
- SPARQL and SQL query panels (v0.5+)
- Reasoner integration and graph visualization
- Semantic Git diff viewer
The extension is a thin TypeScript shell over ontoindex-lsp and the OntoIndex crates — not a second ontology stack.
Roadmap
| Version | Deliverable |
|---|---|
| v0.1 | OntoIndex: scanner, parser, catalog, CLI |
| v0.2.2 (current) | VS Code extension, explorer, entity inspector, LSP |
| v0.3 | Diagnostics and Problems panel integration |
| v0.4a–b | Simple write-back + Horned-OWL (ontoindex-owl) |
| v0.5 | Query workbench + Manchester MVP |
| v0.6 | Reasoners + real unsatisfiability explanations |
| v0.7–v0.7b | Graphs + OBO/ROBOT interop |
| v0.8–v0.9 | Full Manchester, refactoring, semantic diff |
| v1.0 | Protégé-competitive OWL + OBO in VS Code (parity checklist) |
See ROADMAP.md, PLAN.md, and PROTEGE_PARITY.md for the full product plan.
Repository layout
crates/
├── ontoindex-core # types, workspace scanner
├── ontoindex-parser # RDF parsing and entity extraction
├── ontoindex-catalog # index builder and semantic catalog
├── ontoindex-query # SQL-like and SPARQL engines
├── ontoindex-cli # `ontoindex` binary
└── ontoindex-lsp # language server for OntoCode
extension/ # VS Code extension (OntoCode Explorer)
fixtures/ # sample ontology for tests
scripts/ # extension packaging helpers
docs/ # user guides (install, SQL, LSP API)
docs/design/ # product specs, ADRs, wireframes, backlog
examples/ # Rust examples and query cookbook
tests/ # integration and golden snapshot tests
Virtual tables
| Table | Description |
|---|---|
ontologies |
Indexed ontology documents |
classes |
OWL/RDFS classes |
object_properties |
OWL object properties |
data_properties |
OWL datatype properties |
annotation_properties |
OWL annotation properties |
individuals |
OWL named individuals |
entities |
All extracted entities |
annotations |
Label/comment and other annotation triples |
axioms |
Extracted axioms (e.g. SubClassOf) |
namespaces |
Namespace prefixes |
imports |
Ontology imports |
properties |
Union of all property kinds |
Column schemas, SQL limits, and examples: docs/sql-reference.md. LSP methods: docs/lsp-api.md.
Development
See CONTRIBUTING.md. Quick checks:
&& &&
Update golden snapshots:
ONTOINDEX_UPDATE_GOLDEN=1
Releasing
Published crates (v0.2.2):
| Crate | crates.io |
|---|---|
ontoindex-core |
https://crates.io/crates/ontoindex-core |
ontoindex-parser |
https://crates.io/crates/ontoindex-parser |
ontoindex-catalog |
https://crates.io/crates/ontoindex-catalog |
ontoindex-query |
https://crates.io/crates/ontoindex-query |
ontoindex-lsp |
https://crates.io/crates/ontoindex-lsp |
ontoindex-cli |
https://crates.io/crates/ontoindex-cli |
Push a tag matching [workspace.package].version in Cargo.toml (e.g. v0.2.2):
The release workflow verifies packages, runs tests, publishes workspace crates to crates.io in dependency order, and creates a GitHub Release with the ontoindex Linux binary, per-platform ontoindex-lsp archives, and a multi-platform VSIX (Linux, macOS, Windows). Requires the CARGO_REGISTRY_TOKEN repository secret.
See CHANGELOG.md for release notes. Verify downloads: docs/release-integrity.md. Security: SECURITY.md.
License
MIT OR Apache-2.0