Skip to content

Examples index

Runnable examples for OntoCore CLI, Rust embedding, and OntoCode workflows.

CLI cookbooks (copy-paste)

Guide Description
Query cookbook SQL and SPARQL over virtual tables
Sample patches ontocore patch JSON for Turtle and OBO write-back
Refactoring Rename, migrate namespace, move, extract
Classify Reasoner profiles and CI exit semantics
Semantic diff Git refs, PR summary, directory compare
Docs export Markdown/HTML documentation export
Index vs inspect Stats-only vs diagnostic summary

From a git clone, prefix commands with cargo run -- (e.g. cargo run -- query fixtures "SELECT * FROM classes"). With cargo install ontocore-cli, use ontocore directly.

Rust examples (examples/)

Example Run Description
index_and_query cargo run -p ontocode --example index_and_query Workspace + SQL query on fixtures/
ontocore_workspace cargo run -p ontocode --example ontocore_workspace High-level Workspace API
workspace_operations cargo run -p ontocode --example workspace_operations Classify, import graph, docs export
error_handling cargo run -p ontocode --example error_handling ontocore::Error handling
semantic_diff cargo run -p ontocode --example semantic_diff Git/workspace semantic diff (optional git repo)

Fixture workspaces

Location Description
fixtures/ on GitHub Primary tutorial corpus (example.ttl, complex-classes.ttl, …)
Fixtures README Per-file purpose and smoke commands
examples/obo-workflow/ Minimal OBO workspace — see OBO workflow guide
examples/protege-roundtrip/ Turtle + OWL/XML import scenario

Download tutorial files without cloning:

mkdir ontocode-tutorial && cd ontocode-tutorial
curl -fsSLO https://raw.githubusercontent.com/eddiethedean/ontocode/main/fixtures/example.ttl
curl -fsSLO https://raw.githubusercontent.com/eddiethedean/ontocode/main/fixtures/complex-classes.ttl

VS Code tutorial

First success (~10 min) — install extension, open tutorial pack, browse and edit.