Documentation
¶
Overview ¶
Unified support brain — a complex, multi-source CortexDB application.
It unifies TWO live databases into one privacy-safe knowledge graph and keeps them continuously in sync, then reasons over the result:
Postgres (customers, orders) ─┐ connector desensitize ┐
MySQL (tickets, free-text) ┘ (signed plan) ├─▶ one CortexDB brain
│
continuous CDC: PG logical replication + MySQL binlog ─┘ (both stream concurrently)
│
reasoning: RDFS inference · SPARQL aggregates · SHACL validation
What it demonstrates beyond a basic RAG demo:
- DUAL SOURCE: customers/orders from Postgres + support tickets from MySQL, merged into a single knowledge graph (Customer ──placed──▶ Order, Customer ──raised──▶ Ticket).
- FREE-TEXT PII: ticket bodies contain phones/emails in prose; the connector redacts them in place before indexing.
- STREAMING CDC from BOTH at once: a Postgres logical-replication watcher and a MySQL binlog watcher run concurrently; live INSERT/UPDATE/DELETE in either database flow into the brain within milliseconds.
- REASONING: RDFS-lite inference materializes derived types; a SPARQL aggregate finds "priority" customers (>=2 paid orders); SHACL validates a data-quality constraint and catches a real gap.
No LLM or embedder required — deterministic lexical retrieval + SPARQL.
Prerequisites: a Postgres with wal_level=logical and a MySQL with ROW binlog (both are the defaults for `postgres:16 -c wal_level=logical` and `mysql:8`).
Usage:
go run ./examples/11_unified_brain \ -pg 'postgres://postgres:p@localhost:5432/postgres?sslmode=disable' \ -my 'root:p@tcp(localhost:3306)/test'
Click to show internal directories.
Click to hide internal directories.