Epistom Overview
Semantic intelligence engine for NLQ-to-SQL — the read plane
Epistom is the read plane of the Pramiti platform. It translates natural language questions into validated SQL queries using a verified knowledge model, ensuring AI agents understand business semantics rather than guessing from column names.
Architecture
Epistom consists of several interconnected components:
- Knowledge Model — OWL 2 QL ontology stored in Oxigraph, defining Object Types, Link Types, and Business Rules
- NLQ Engine — Routes questions through trust tiers: knowledge lookup, verified query matching, and constrained SQL generation
- MCP Server — 8 MCP tools exposing semantic intelligence to AI agents via the Model Context Protocol
- Verified Queries — Curated SQL patterns that get injected as few-shot examples for higher accuracy
- Drift Detection — Schema scanning and confidence degradation when the database changes
- Feedback Engine — Query feedback loop for self-improving accuracy
- Source Registry — Class-to-source-to-table mapping with industry starter kits
How It Works
When an AI agent asks a question:
- The Query Router classifies the intent (definition, vocabulary, analytical, discovery, impact, metric)
- For definition queries, the ontology is queried directly via SPARQL — no LLM needed
- For analytical queries, the Prompt Assembler builds a context window with relevant schema, definitions, verified query examples, and business rules
- The NLQ Engine sends this context to the LLM to generate SQL
- The SQL Validator checks the generated SQL against the schema (column existence, join paths, aggregation rules, PII annotations) before execution
- If validation fails, the Self-Correction module rewrites and retries
- Results are returned with a confidence score, semantic context, and query ID for feedback
Dependencies
| Dependency | Required | Purpose |
|---|---|---|
| PostgreSQL | Yes | Platform metadata, query logs, verified queries, feedback |
| Oxigraph | Yes | OWL/SPARQL triplestore for the knowledge model |
| LLM (Claude/OpenAI/Bedrock/Ollama) | Yes | SQL generation and vocabulary synthesis |
Configuration
Key environment variables: