OntoCore workspace engine¶
OntoCore discovers ontology files under a workspace root, parses them, and builds a queryable catalog.
Workspace API (experimental)¶
use ontocore::workspace::Workspace;
let ws = Workspace::open("/path/to/ontologies")?;
// Catalog stats
let stats = ws.catalog().data().stats();
println!("{} classes", stats.class_count);
// SQL query
let rows = ws.query("SELECT short_name, labels FROM classes")?;
// Entity search (IRI, short name, label)
let hits = ws.search("Person")?;
// Diagnostics from indexing
for d in ws.diagnostics() {
println!("{:?}: {}", d.code, d.message);
}
Stable since v0.10: Workspace is the recommended high-level API. Lower-level IndexBuilder remains available for custom pipelines.
Lower-level indexing¶
use ontocore::catalog::IndexBuilder;
use ontocore::query::query_catalog;
let catalog = IndexBuilder::new()
.workspace("fixtures")
.build()?;
let result = query_catalog(&catalog, "SELECT * FROM classes")?;
LSP uses document_overrides on IndexBuilder for unsaved editor buffers.
Indexing pipeline¶
- Scan —
WorkspaceScanner(ontocore-core) walks the workspace with ignore rules. - Parse — RDF via Oxigraph; Turtle also bridged to Horned-OWL for axioms.
- Catalog — entities, axioms, annotations, imports, namespaces assembled in memory.
- Diagnostics — parse errors + lint rules collected during build.
- Store — Oxigraph in-memory store for SPARQL (not exposed directly; use
sparql_catalog).
Resource limits¶
Indexing enforces caps on file size, entity count, triple count, and query result rows. See workspace limits.
CLI and LSP entry points¶
| Entry | Command / method |
|---|---|
| CLI | ontocore query . "SELECT …" |
| CLI | ontocore validate . |
| LSP | ontocore/indexWorkspace |
The CLI binary is ontocore (ontocore-cli crate). Install with cargo install ontocore-cli --locked.