pg_knowledge_base extension brings Oxigraph SPARQL to PostgreSQL 19
Key Takeaway
A new PostgreSQL 19 extension allows running SPARQL queries directly on relational data using the Oxigraph engine.
Summary
The pg_knowledge_base extension integrates the Rust-based Oxigraph SPARQL engine into PostgreSQL 19. It allows users to query RDF triples stored in standard PostgreSQL tables and map existing relational tables to RDF using R2RML. This eliminates the need for a separate triple store and the associated ETL processes.
Technical implementation of pg_knowledge_base
- Uses Oxigraph's Rust crates (spargebra, sparopt, spareval) via a C ABI.
- Implements storage using ordinary PostgreSQL tables instead of RocksDB.
- Employs SipHash (120-bit) for IRIs and long values, while inlining numbers, dates, and short strings.
- Provides R2RML mappings to read existing relational tables as RDF without data duplication.
- Ensures safety by wrapping Rust calls in PG_TRY and catching panics to prevent unwinding through C.
Why it matters
This extension reduces architectural complexity by merging graph database capabilities into a relational database, simplifying backups, security, and transactions.
Original reference: postgr.es →