Ontology-based MCP server that analyzes database schemas (PostgreSQL, Snowflake, ClickHouse, Dremio) and…
OrionBelt® Analytics
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
The Ontology-based MCP server for your Text-2-SQL convenience.
OrionBelt Analytics is an MCP server that analyzes relational database schemas and generates RDF/OWL ontologies with embedded SQL mappings. It provides relationship-aware Text-to-SQL with automatic fan-trap prevention, GraphRAG for intelligent schema discovery, and interactive charting -- all accessible through any MCP-compatible AI client.
The OrionBelt Ecosystem
| Project | Purpose |
| ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| **OrionBelt Analytics** (this) | Schema analysis, ontology generation, GraphRAG, Text-to-SQL |
| **OrionBelt Semantic Layer** | Declarative YAML models compiled into dialect-specific, fan-trap-free SQL |
| **OrionBelt Ontology Builder** | Visual OWL ontology editor with reasoning and graph visualization (live demo) |
| **OrionBelt Chat** | AI chat UI for Analytics + Semantic Layer (Chainlit, multiple LLM providers) |
Run Analytics and Semantic Layer side-by-side in Claude Desktop for schema-aware ontology generation **and** guaranteed-correct SQL compilation.
Architecture
- **8 database connectors** -- PostgreSQL, MySQL, Snowflake, ClickHouse, Dremio, BigQuery, DuckDB/MotherDuck, Databricks SQL
- **RDF/OWL ontology generation** with oba: namespace SQL annotations and W3C R2RML mappings
- **GraphRAG** -- graph traversal (up to 12 hops) + ChromaDB vector embeddings for semantic schema discovery, run locally; a multilingual option lets questions in other languages find the schema (German *"Umsatz"* finds a column named *"Net revenue"*)
- **SPARQL 1.1** query interface via persistent Oxigraph RDF store
- **OBQC validation** -- deterministic SQL checks against the ontology (table/column existence, join validity, type mismatches, fan-traps)
- **Interactive charting** -- Plotly charts with MCP-UI rendering in Claude Desktop
- **Multi-schema support** -- analyze multiple schemas simultaneously; ontology and GraphRAG state are isolated per schema
- **Workspace persistence** -- reconnect to the same database and restore your previous session
- **MCP sampling** -- when the connected client supports sampling (e.g. OrionBelt Chat), suggest_semantic_names asks the host LLM to pre-fill rename suggestions for cryptic identifiers via sampling/createMessage, collapsing the previous review-then-apply flow into a single tool call. Clients without sampling support (e.g. Claude Desktop) silently fall back to the manual review path
OBQC -- Ontology-Based Query Check
A key differentiator of OrionBelt is **OBQC** (Ontology-Based Query Check), a deterministic, rule-based SQL validator that catches errors _before_ queries reach the database. Unlike LLM-only approaches that rely on the model "getting it right," OBQC cross-references every generated SQL statement against the loaded RDF/OWL ontology to enforce structural correctness.
**What OBQC validates:**
| Check | What it catches |
| --------------------------- | ------------------------------------------------------------------------------------------------- |
| **Table existence** | References to tables that don't exist in the schema |
| **Column existence** | References to columns not present in their table, ambiguous unqualified columns |
| **Join validity** | Missing join conditions (Cartesian products), join columns that don't match declared foreign keys |
| **Type compatibility** | WHERE/ON comparisons between incompatible types (e.g. string vs. integer) |
| **Aggregation correctness** | SELECT columns missing from GROUP BY when aggregates are used |
| **Fan-trap detection** | Aggregations across multiple one-to-many joins that silently multiply results |
**How it works:**
1. generate_ontology or load_my_ontology creates/loads an ontology with oba: namespace annotations that map OWL classes and properties to actual database tables, columns, types, and foreign keys.