# 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.

**Published:** 2026-10-23T00:00:00+00:00 
**Source:** Planet PostgreSQL 
**Category:** databases-storage 
**Canonical URL:** https://fosswire.org/news/pgknowledgebase-extension-brings-oxigraph-sparql-to-postgres.html 

## 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.