Skip to content
rdf_fdw

rdf_fdw

rdf_fdw : Foreign data wrapper for RDF triplestores over SPARQL endpoints

Overview

ID Extension Package Version Category License Language
8760
rdf_fdw
rdf_fdw
2.5.0
FDW
MIT
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
wrappers
multicorn
postgres_fdw
sparql

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
2.5.0
18
17
16
15
14
rdf_fdw -
RPM
PIGSTY
2.5.0
18
17
16
15
14
rdf_fdw_$v -
DEB
PIGSTY
2.5.0
18
17
16
15
14
postgresql-$v-rdf-fdw -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
el8.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
el9.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
el9.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
el10.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
el10.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
d12.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
d12.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
d13.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
d13.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
u22.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
u22.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
u24.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
u24.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
u26.x86_64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
u26.aarch64
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
PIGSTY 2.5.0
Package Version OS ORG SIZE File URL
rdf_fdw_18 2.5.0 el8.x86_64 pigsty 145.6 KiB rdf_fdw_18-2.5.0-2PIGSTY.el8.x86_64.rpm
rdf_fdw_18 2.5.0 el8.aarch64 pigsty 137.0 KiB rdf_fdw_18-2.5.0-2PIGSTY.el8.aarch64.rpm
rdf_fdw_18 2.5.0 el9.x86_64 pigsty 139.7 KiB rdf_fdw_18-2.5.0-2PIGSTY.el9.x86_64.rpm
rdf_fdw_18 2.5.0 el9.aarch64 pigsty 135.8 KiB rdf_fdw_18-2.5.0-2PIGSTY.el9.aarch64.rpm
rdf_fdw_18 2.5.0 el10.x86_64 pigsty 140.7 KiB rdf_fdw_18-2.5.0-2PIGSTY.el10.x86_64.rpm
rdf_fdw_18 2.5.0 el10.aarch64 pigsty 137.2 KiB rdf_fdw_18-2.5.0-2PIGSTY.el10.aarch64.rpm
postgresql-18-rdf-fdw 2.5.0 d12.x86_64 pigsty 332.2 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-rdf-fdw 2.5.0 d12.aarch64 pigsty 322.6 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-rdf-fdw 2.5.0 d13.x86_64 pigsty 332.2 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~trixie_amd64.deb
postgresql-18-rdf-fdw 2.5.0 d13.aarch64 pigsty 323.0 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~trixie_arm64.deb
postgresql-18-rdf-fdw 2.5.0 u22.x86_64 pigsty 355.2 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~jammy_amd64.deb
postgresql-18-rdf-fdw 2.5.0 u22.aarch64 pigsty 349.6 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~jammy_arm64.deb
postgresql-18-rdf-fdw 2.5.0 u24.x86_64 pigsty 341.5 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~noble_amd64.deb
postgresql-18-rdf-fdw 2.5.0 u24.aarch64 pigsty 337.5 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~noble_arm64.deb
postgresql-18-rdf-fdw 2.5.0 u26.x86_64 pigsty 339.9 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~resolute_amd64.deb
postgresql-18-rdf-fdw 2.5.0 u26.aarch64 pigsty 335.3 KiB postgresql-18-rdf-fdw_2.5.0-1PIGSTY~resolute_arm64.deb

Source

pig build pkg rdf_fdw;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install rdf_fdw;		# install via package name, for the active PG version

pig install rdf_fdw -v 18;   # install for PG 18
pig install rdf_fdw -v 17;   # install for PG 17
pig install rdf_fdw -v 16;   # install for PG 16
pig install rdf_fdw -v 15;   # install for PG 15
pig install rdf_fdw -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION rdf_fdw;

Usage

Sources: README, v2.4 release

rdf_fdw is a foreign data wrapper for RDF triplestores exposed through SPARQL endpoints. It lets PostgreSQL query RDF data with SQL, supports SQL clause pushdown, adds an rdfnode type for RDF terms, and includes SPARQL 1.1 function support.

Register a SPARQL Endpoint

Register a SPARQL endpoint with CREATE SERVER:

CREATE SERVER dbpedia
FOREIGN DATA WRAPPER rdf_fdw
OPTIONS (endpoint 'https://dbpedia.org/sparql');

The README documents server options such as:

  • endpoint (required)
  • batch_size
  • enable_pushdown
  • format
  • http_proxy
  • connect_timeout

In v2.4, proxy credentials were moved out of SERVER options and into USER MAPPING for security.

User Mapping and Foreign Tables

CREATE USER MAPPING FOR postgres
SERVER dbpedia
OPTIONS (user 'admin', password 'secret');

rdf_fdw works by declaring foreign tables that embed SPARQL queries and map result variables to PostgreSQL columns. The README also highlights native RDF node handling through the custom rdfnode type.

CREATE FOREIGN TABLE film (
  film_id text OPTIONS (variable '?film', nodetype 'iri'),
  name text OPTIONS (variable '?name', nodetype 'literal', literal_type 'xsd:string')
)
SERVER dbpedia
OPTIONS (sparql 'SELECT ?film ?name WHERE { ?film dbp:name ?name }');

Pushdown, DML, and Helpers

The upstream docs specifically call out pushdown for:

  • WHERE
  • LIMIT
  • ORDER BY
  • DISTINCT

They also document data modification support:

  • INSERT
  • UPDATE
  • DELETE

Batching for SPARQL UPDATE traffic is controlled with the batch_size option.

The README lists utility functions including:

  • rdf_fdw_version()
  • rdf_fdw_settings()
  • rdf_fdw_clone_table()

It also documents broader SPARQL function coverage, including aggregates, string functions, numeric functions, date/time functions, hash functions, and custom functions.

Caveats

The current README warns that retrieved RDF data is loaded into memory before conversion for PostgreSQL, so large result sets require adequate PostgreSQL memory. It also documents PostgreSQL 9.5+ as the supported baseline.

Last updated on