Ontology-aware RAG framework — RDF/OWL as the source of truth for LLM agents via MCP
README
Ontology-aware RAG framework — RDF/OWL as the source of truth.
Most RAG systems treat knowledge as flat text chunks searched by embedding similarity. ontorag treats the ontology as the source of truth: an LLM agent navigates your RDF/OWL graph using structured MCP tools rather than approximate vector search.
User query → LLM agent → ontology tools (get_schema / find_entities / traverse_graph …)
↓
Apache Jena Fuseki (SPARQL 1.1)
↓
Structured JSON answers
Measured on identical TBox + ABox + goldsets — see BENCHMARK_RESULTS.md for the full run (LangChain + Chroma + OpenAI, 70 questions across 2 domains).
| Capability | Vector RAG (LangChain) | ontorag |
|---|---|---|
| Single-entity lookup | ✓ Commerce easy 5/5 | ✓ |
| Multi-hop / OWL transitive inference (pl:locatedIn+) | ✗ Q008/Q039/Q040 stopped at first hop | ✓ |
| Triple-level citation (auditable provenance) | ✗ 0 / 70 (structural — chunks only) | ✓ 30 / 70 cited |
| Hallucination measurability against ground truth | N/A (no triple-level grounding) | ✓ 0.000 hallucination rate |
| Refusal on KG-absent facts (trap questions) | ✓ Commerce 3/3 traps refused | ✓ |
Vector RAG handles flat lookups well — the structural advantage of ontorag appears on transitive inference, provenance, and measurable grounding.
Speed: the graph layer adds only ~1.5% of wall time — query latency is LLM-bound. See Performance — agent latency profile.
Backend parity (v1.0): the same protocol tools return identical results across all three backends (Fuseki / Neo