MCPcopy Index your code
hub / github.com/fabio-rovai/open-ontologies

github.com/fabio-rovai/open-ontologies @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
1,881 symbols 6,066 edges 181 files 498 documented · 26%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Open Ontologies

Open Ontologies

A Terraforming MCP for Knowledge Graphs

Validate, classify, and govern AI-generated ontologies. Written in Rust. Ships as a single binary.

CI MIT Open MCP PitchHut ClawHub

Quick Start · Studio · Benchmarks · IES · Tools · Architecture · Docs


Open Ontologies is a Rust MCP server and desktop Studio for AI-native ontology engineering. It exposes 70+ tools that let Claude build, validate, query, diff, lint, version, reason over, align, plan, certify, and govern RDF/OWL ontologies using an in-memory Oxigraph triple store — with a full three-layer Dynamics → Causal → Planner architecture, a marketplace of 32 standard ontologies, clinical crosswalks, semantic embeddings, and a full lineage audit trail.

The Studio wraps the engine in a visual desktop environment: virtualized ontology tree with hierarchy lines, breadcrumb navigation, and connection explorer; AI chat panel with /build (IES-level deep) and /sketch (quick prototype) commands; Protégé-style property inspector; and lineage viewer.

No JVM. No Protégé.


What's New (three-layer architecture + 13 new primitives)

The full Dynamics → Causal → Planner stack plus 13 new primitives. Every piece holds the MCP-native convention: the server provides validation and scaffolding, the connected LLM (Claude over MCP) does the intelligence. No internal LLM clients, no API keys, no provider abstractions.

Three-layer architecture

Layer What it ships
Dynamics ActionSchema + 4 MCP tools: onto_action_register / _applicable / _apply / _list. Concurrent atomic ticks, static causal laws (invariants), default-value laws, ramification via OWL-RL closure, non-deterministic outcomes with reproducible seed.
Causal onto_certify_action with optional PyWhy backdoor identification (opt-in via causal-pywhy feature). Structural-proxy default + do-calculus opt-in + graceful fallback.
Planner onto_plan_compile_pddl + onto_plan_classical (Fast Downward subprocess) + onto_plan_validate (sandbox-simulate). Solver stays client-side; server compiles + validates.

13 new primitives

  • onto_owl_shacl_coevolve_check + onto_owl_shacl_coevolve_incremental — SHACL validation against the OWL-RL closure, with dependency-graph routing so only shapes touching changed IRIs revalidate.
  • onto_segment_retrieve — TBox-slice retrieval for ontology-grounded RAG.
  • onto_extract_scaffold + onto_extract_validate — schema-guided structured extraction with typed datatype validation + conformance scoring.
  • onto_cq_run + onto_verify_cq + onto_cq_verdicts_list — competency-question runner with pitfall hints + LLM-judgement loop.
  • onto_classify_el — OWL-EL classification (transitive subsumption table, trivial pairs excluded).
  • onto_eval_alignment — P/R/F1 over reference + computed alignment sets.
  • onto_shape_combinatorics + onto_shape_induce — property-combination lattice + data-driven SHACL shape induction with support × confidence ranking.
  • borderline_partition + borderline_record_verdict — generalised two-threshold review loop for any candidate set.
  • onto_align_fuzzy — embedding-free fuzzy-logic adjudication with 10-rule Mamdani inference; HNSW is demoted to a candidate generator.
  • onto_align_flora — end-to-end alignment pipeline pairing the signal extractor to the fuzzy adjudicator.
  • onto_policy_register + onto_policy_list + onto_policy_check — authorisation gate that composes with onto_certify_action (Causal = risk; policy = authorisation).
  • eval_rag + eval_rag_mmrag — Hit@k / MRR / faithfulness / token-Jaccard / ROUGE-1 scoring for retriever pipelines, with a dataset adapter.
  • graph_projection_lossy_check — the auditor that pairs with onto_segment_retrieve.

Validating end-to-end

cargo run --example three_layer_pipeline

Walks Dynamics register → PDDL compile → Fast-Downward-shaped sas_plan parse → orchestrator-side IRI bind → sandbox validate → CIVeX certify → apply with OWL-RL ramification → final state inspection. Every layer through its public API, no external dependencies (Python, DoWhy, Fast Downward) required.

Zero new external Rust dependencies; everything optional gates behind Cargo features. Full test suite (160+ tests) green on default build; cargo clippy --lib --tests --examples -- -D warnings clean across both default and causal-pywhy configurations.


Quick Start (MCP / CLI)

Install

Pre-built binaries:

# macOS (Apple Silicon)
curl -LO https://github.com/fabio-rovai/open-ontologies/releases/latest/download/open-ontologies-aarch64-apple-darwin
chmod +x open-ontologies-aarch64-apple-darwin && mv open-ontologies-aarch64-apple-darwin /usr/local/bin/open-ontologies

# macOS (Intel)
curl -LO https://github.com/fabio-rovai/open-ontologies/releases/latest/download/open-ontologies-x86_64-apple-darwin
chmod +x open-ontologies-x86_64-apple-darwin && mv open-ontologies-x86_64-apple-darwin /usr/local/bin/open-ontologies

# Linux (x86_64)
curl -LO https://github.com/fabio-rovai/open-ontologies/releases/latest/download/open-ontologies-x86_64-unknown-linux-gnu
chmod +x open-ontologies-x86_64-unknown-linux-gnu && mv open-ontologies-x86_64-unknown-linux-gnu /usr/local/bin/open-ontologies

Docker:

docker pull ghcr.io/fabio-rovai/open-ontologies:latest
docker run -i ghcr.io/fabio-rovai/open-ontologies serve

From source (Rust 1.85+):

git clone https://github.com/fabio-rovai/open-ontologies.git
cd open-ontologies && cargo build --release
./target/release/open-ontologies init

For native Windows builds, see docs/windows.md.

Connect to your MCP client

Claude Code

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "open-ontologies": {
      "command": "/path/to/open-ontologies/target/release/open-ontologies",
      "args": ["serve"]
    }
  }
}

Restart Claude Code. The onto_* tools are now available.

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "open-ontologies": {
      "command": "/path/to/open-ontologies/target/release/open-ontologies",
      "args": ["serve"]
    }
  }
}

Cursor / Windsurf / any MCP-compatible IDE

Add to .cursor/mcp.json or equivalent:

{
  "mcpServers": {
    "open-ontologies": {
      "command": "/path/to/open-ontologies/target/release/open-ontologies",
      "args": ["serve"]
    }
  }
}

Docker

{
  "mcpServers": {
    "open-ontologies": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "ghcr.io/fabio-rovai/open-ontologies", "serve"]
    }
  }
}

Build your first ontology

Build me a Pizza ontology following the Manchester University tutorial.
Include all 49 toppings, 24 named pizzas, spiciness value partition,
and defined classes (VegetarianPizza, MeatyPizza, SpicyPizza).
Validate it, load it, and show me the stats.

Claude generates Turtle, then runs the full pipeline automatically:

onto_validateonto_loadonto_statsonto_reasononto_statsonto_lintonto_enforceonto_queryonto_saveonto_version

Every build includes OWL reasoning (materializes inferred triples), design pattern enforcement, and automatic versioning.


Studio (Desktop App)

The Studio is a native desktop application that wraps the same engine in a visual environment — no browser, no server to manage. It runs entirely on your machine: the engine sidecar handles RDF/OWL operations while the UI renders the graph in real time.

Think of it as Protege meets an AI copilot. Type "build ontology about cats" and watch a 1,400-class ontology appear in the tree — classes, properties, individuals, and axioms built automatically across 13 pipeline steps. Click any node to inspect its triples, trace connections via clickable pills, and follow every change through the lineage panel.

Why virtualized tree (not 3D graph)

Prior to v0.1.12, the Studio used a D3.js horizontal tree and a 3D force-directed graph (Three.js / WebGL). Both worked for small ontologies (~100 classes) but became unusable at IES-level depth: the D3 tree couldn't handle 500+ nodes without layout thrashing, and the 3D graph froze the WebKit webview above 1,000 nodes.

The v2 deep builder changed the equation — a single /build command now produces 1,400+ classes. We replaced both views with a virtualized DOM tree: only visible rows exist in the DOM (constant memory regardless of ontology size), with hierarchy connector lines, type-filtered legend, search, breadcrumb navigation, and a connections panel. This handles the full IES Common (511 classes) and deep-built ontologies (1,400+ classes) without lag.

How it works

The Studio launches three processes that communicate locally:

  1. Tauri 2 shell — native window (macOS/Linux/Windows) with a WebKit webview
  2. Engine sidecar — the same Rust binary, running as an HTTP MCP server on localhost:8080
  3. Agent sidecar — Node.js process running Claude via the Agent SDK, connected to the engine over MCP

When you type in the chat panel, your message goes to the Agent sidecar, which sends it to Claude. Claude decides which onto_* tools to call, the engine executes them, and the UI refreshes the graph. The entire loop — prompt to visual update — takes seconds.

Install and run

Prerequisites: Rust + Cargo · Node.js 18+

# 1. Build the engine binary (from repo root)
cargo build --release

# 2. Install JS dependencies
cd studio && npm install

# 3. Run
PATH=/opt/homebrew/bin:~/.cargo/bin:$PATH npm run tauri dev

The first launch compiles the Tauri shell (~2 min). Subsequent launches start in seconds.

Features

Feature Description
Virtualized Tree Ontology explorer that handles 1,500+ classes without lag. Hierarchy connector lines, collapsible branches, type-filtered legend (Class/Property/Individual), search with auto-expand, breadcrumb path navigation, and a connections panel showing domain/range relationships as clickable pills. Only visible rows are in the DOM — constant memory regardless of ontology size.
AI Agent Chat Natural language ontology engineering via Claude Opus 4.6 + Agent SDK. Two build modes: /build runs a 13-step pipeline producing IES-level ontologies (500-1,500+ classes, 100-200+ properties), /sketch runs 3 steps for quick prototyping (~80 classes). Each tool call is shown in real time.
Property Inspector Protege-style inline triple editor. Click any node to see its rdfs:subClassOf, rdfs:label, rdfs:domain, rdfs:range and all other triples. Edit in place, hover to delete, + Add for new triples. Changes are immediately reflected in the graph.
Lineage Panel Full audit trail from SQLite: every plan, apply, enforce, drift, monitor, and align event, grouped by session with timestamps. See exactly what Claude did and in what order.
Named Save ⌘S to save as ~/.open-ontologies/<name>.ttl. Auto-saves to studio-live.ttl after every mutation so you never lose work.

Keyboard shortcuts

Shortcut Action
⌘J Toggle AI chat panel
⌘I Toggle property inspector
⌘S Save ontology
F Fit graph to viewport (tree view)
R Reset zoom (tree view)
Esc Deselect node
Shift+click Collapse/expand branch (tree view)
Scroll Zoom in/out
Click + drag Pan

Benchmarks

OntoAxiom — LLM Axiom Identification

OntoAxiom tests axiom identification across 9 ontologies and 3,042 ground truth axioms.

Approach F1 vs o1 (paper best)
o1 (paper's best) 0.197
Bare Claude Opus 0.431 +119%
MCP extraction 0.717 +264%

Pizza Ontology — Manchester Tutorial

One sentence input: "Build a Pizza ontology following the Manchester tutorial specification."

Metric Reference (Protégé, ~4 hours) AI-Generated (~5 min) Coverage
Classes 99 95 96%
Properties 8 8 100%
Toppings 49 49 100%
Named Pizzas 24 24 100%

/sketch vs /build — Two Build Modes

Extension points exported contracts — how you extend this code

AddClassDialogProps (Interface)
(no doc)
studio/src/components/AddClassDialog.tsx
Props (Interface)
(no doc)
studio/src/components/PropertyInspector.tsx
NodeProperty (Interface)
(no doc)
studio/src/components/PropertyInspector.tsx
TreeViewProps (Interface)
(no doc)
studio/src/components/TreeView.tsx
SparqlBinding (Interface)
(no doc)
studio/src/components/TreeView.tsx

Core symbols most depended-on inside this repo

get
called by 430
src/cache.rs
as_str
called by 194
src/sqlsource.rs
load_turtle
called by 183
src/graph.rs
is_empty
called by 160
src/vecstore.rs
len
called by 146
src/vecstore.rs
sparql_select
called by 84
src/graph.rs
run
called by 71
studio/src-tauri/src/lib.rs
conn
called by 63
src/state.rs

Shape

Function 1,189
Method 417
Class 242
Interface 17
Enum 16

Languages

Rust81%
Python14%
TypeScript5%
Java1%

Modules by API surface

src/server.rs112 symbols
src/inputs.rs93 symbols
src/tableaux.rs52 symbols
src/align.rs40 symbols
src/config.rs38 symbols
src/batch.rs38 symbols
src/eval_rag.rs33 symbols
src/dynamics.rs33 symbols
src/vecstore.rs27 symbols
src/dynamics_bcplus.rs27 symbols
src/align_fuzzy.rs26 symbols
tests/tableaux_test.rs25 symbols

Datastores touched

shopDatabase · 1 repos
(mysql)Database · 1 repos
dbDatabase · 1 repos

For agents

$ claude mcp add open-ontologies \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page