Skip to content

pgrdf

RDF, SPARQL, SHACL, and OWL reasoning for PostgreSQL

pgrdf : RDF, SPARQL, SHACL, and OWL reasoning for PostgreSQL

Overview

ID Extension Package Version Category License Language
2640 pgrdf pgrdf 0.6.40 FEAT MIT Rust
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd-- No Yes Yes Yes no no
Relationships
Schemas pgrdf
See Also sparql rdf_fdw age pg_liquid onesparse graph ltree xml2 plxslt omni_xml
Production hook/cache deployments should preload pgrdf.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 0.6.40 18 17 16 15 14 pgrdf -
RPM PIGSTY 0.6.40 18 17 16 15 14 pgrdf_$v -
DEB PIGSTY 0.6.40 18 17 16 15 14 postgresql-$v-pgrdf -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
el8.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
el9.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
el9.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
el10.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
el10.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
d12.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
d12.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
d13.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
d13.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
u22.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
u22.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
u24.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
u24.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
u26.x86_64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
u26.aarch64 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39 PIGSTY 0.6.39
Package Version OS ORG SIZE File URL
pgrdf_18 0.6.39 el8.x86_64 pigsty 6.8 MiB pgrdf_18-0.6.39-1PGSTY.el8.x86_64.rpm
pgrdf_18 0.6.39 el8.aarch64 pigsty 6.0 MiB pgrdf_18-0.6.39-1PGSTY.el8.aarch64.rpm
pgrdf_18 0.6.39 el9.x86_64 pigsty 6.6 MiB pgrdf_18-0.6.39-1PGSTY.el9.x86_64.rpm
pgrdf_18 0.6.39 el9.aarch64 pigsty 6.2 MiB pgrdf_18-0.6.39-1PGSTY.el9.aarch64.rpm
pgrdf_18 0.6.39 el10.x86_64 pigsty 6.6 MiB pgrdf_18-0.6.39-1PGSTY.el10.x86_64.rpm
pgrdf_18 0.6.39 el10.aarch64 pigsty 6.2 MiB pgrdf_18-0.6.39-1PGSTY.el10.aarch64.rpm
postgresql-18-pgrdf 0.6.39 d12.x86_64 pigsty 5.8 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~bookworm_amd64.deb
postgresql-18-pgrdf 0.6.39 d12.aarch64 pigsty 5.1 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~bookworm_arm64.deb
postgresql-18-pgrdf 0.6.39 d13.x86_64 pigsty 5.8 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~trixie_amd64.deb
postgresql-18-pgrdf 0.6.39 d13.aarch64 pigsty 5.1 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~trixie_arm64.deb
postgresql-18-pgrdf 0.6.39 u22.x86_64 pigsty 6.2 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~jammy_amd64.deb
postgresql-18-pgrdf 0.6.39 u22.aarch64 pigsty 5.8 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~jammy_arm64.deb
postgresql-18-pgrdf 0.6.39 u24.x86_64 pigsty 6.1 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~noble_amd64.deb
postgresql-18-pgrdf 0.6.39 u24.aarch64 pigsty 5.8 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~noble_arm64.deb
postgresql-18-pgrdf 0.6.39 u26.x86_64 pigsty 6.1 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~resolute_amd64.deb
postgresql-18-pgrdf 0.6.39 u26.aarch64 pigsty 5.7 MiB postgresql-18-pgrdf_0.6.39-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pgrdf_17 0.6.39 el8.x86_64 pigsty 6.8 MiB pgrdf_17-0.6.39-1PGSTY.el8.x86_64.rpm
pgrdf_17 0.6.39 el8.aarch64 pigsty 6.0 MiB pgrdf_17-0.6.39-1PGSTY.el8.aarch64.rpm
pgrdf_17 0.6.39 el9.x86_64 pigsty 6.6 MiB pgrdf_17-0.6.39-1PGSTY.el9.x86_64.rpm
pgrdf_17 0.6.39 el9.aarch64 pigsty 6.2 MiB pgrdf_17-0.6.39-1PGSTY.el9.aarch64.rpm
pgrdf_17 0.6.39 el10.x86_64 pigsty 6.6 MiB pgrdf_17-0.6.39-1PGSTY.el10.x86_64.rpm
pgrdf_17 0.6.39 el10.aarch64 pigsty 6.2 MiB pgrdf_17-0.6.39-1PGSTY.el10.aarch64.rpm
postgresql-17-pgrdf 0.6.39 d12.x86_64 pigsty 5.8 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~bookworm_amd64.deb
postgresql-17-pgrdf 0.6.39 d12.aarch64 pigsty 5.1 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~bookworm_arm64.deb
postgresql-17-pgrdf 0.6.39 d13.x86_64 pigsty 5.8 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~trixie_amd64.deb
postgresql-17-pgrdf 0.6.39 d13.aarch64 pigsty 5.1 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~trixie_arm64.deb
postgresql-17-pgrdf 0.6.39 u22.x86_64 pigsty 6.2 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~jammy_amd64.deb
postgresql-17-pgrdf 0.6.39 u22.aarch64 pigsty 5.8 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~jammy_arm64.deb
postgresql-17-pgrdf 0.6.39 u24.x86_64 pigsty 6.1 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~noble_amd64.deb
postgresql-17-pgrdf 0.6.39 u24.aarch64 pigsty 5.8 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~noble_arm64.deb
postgresql-17-pgrdf 0.6.39 u26.x86_64 pigsty 6.1 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~resolute_amd64.deb
postgresql-17-pgrdf 0.6.39 u26.aarch64 pigsty 5.7 MiB postgresql-17-pgrdf_0.6.39-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pgrdf_16 0.6.39 el8.x86_64 pigsty 6.8 MiB pgrdf_16-0.6.39-1PGSTY.el8.x86_64.rpm
pgrdf_16 0.6.39 el8.aarch64 pigsty 6.0 MiB pgrdf_16-0.6.39-1PGSTY.el8.aarch64.rpm
pgrdf_16 0.6.39 el9.x86_64 pigsty 6.6 MiB pgrdf_16-0.6.39-1PGSTY.el9.x86_64.rpm
pgrdf_16 0.6.39 el9.aarch64 pigsty 6.2 MiB pgrdf_16-0.6.39-1PGSTY.el9.aarch64.rpm
pgrdf_16 0.6.39 el10.x86_64 pigsty 6.6 MiB pgrdf_16-0.6.39-1PGSTY.el10.x86_64.rpm
pgrdf_16 0.6.39 el10.aarch64 pigsty 6.2 MiB pgrdf_16-0.6.39-1PGSTY.el10.aarch64.rpm
postgresql-16-pgrdf 0.6.39 d12.x86_64 pigsty 5.8 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~bookworm_amd64.deb
postgresql-16-pgrdf 0.6.39 d12.aarch64 pigsty 5.1 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~bookworm_arm64.deb
postgresql-16-pgrdf 0.6.39 d13.x86_64 pigsty 5.8 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~trixie_amd64.deb
postgresql-16-pgrdf 0.6.39 d13.aarch64 pigsty 5.1 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~trixie_arm64.deb
postgresql-16-pgrdf 0.6.39 u22.x86_64 pigsty 6.2 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~jammy_amd64.deb
postgresql-16-pgrdf 0.6.39 u22.aarch64 pigsty 5.8 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~jammy_arm64.deb
postgresql-16-pgrdf 0.6.39 u24.x86_64 pigsty 6.1 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~noble_amd64.deb
postgresql-16-pgrdf 0.6.39 u24.aarch64 pigsty 5.8 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~noble_arm64.deb
postgresql-16-pgrdf 0.6.39 u26.x86_64 pigsty 6.1 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~resolute_amd64.deb
postgresql-16-pgrdf 0.6.39 u26.aarch64 pigsty 5.7 MiB postgresql-16-pgrdf_0.6.39-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pgrdf_15 0.6.39 el8.x86_64 pigsty 6.8 MiB pgrdf_15-0.6.39-1PGSTY.el8.x86_64.rpm
pgrdf_15 0.6.39 el8.aarch64 pigsty 6.0 MiB pgrdf_15-0.6.39-1PGSTY.el8.aarch64.rpm
pgrdf_15 0.6.39 el9.x86_64 pigsty 6.6 MiB pgrdf_15-0.6.39-1PGSTY.el9.x86_64.rpm
pgrdf_15 0.6.39 el9.aarch64 pigsty 6.2 MiB pgrdf_15-0.6.39-1PGSTY.el9.aarch64.rpm
pgrdf_15 0.6.39 el10.x86_64 pigsty 6.5 MiB pgrdf_15-0.6.39-1PGSTY.el10.x86_64.rpm
pgrdf_15 0.6.39 el10.aarch64 pigsty 6.2 MiB pgrdf_15-0.6.39-1PGSTY.el10.aarch64.rpm
postgresql-15-pgrdf 0.6.39 d12.x86_64 pigsty 5.8 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~bookworm_amd64.deb
postgresql-15-pgrdf 0.6.39 d12.aarch64 pigsty 5.1 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~bookworm_arm64.deb
postgresql-15-pgrdf 0.6.39 d13.x86_64 pigsty 5.8 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~trixie_amd64.deb
postgresql-15-pgrdf 0.6.39 d13.aarch64 pigsty 5.1 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~trixie_arm64.deb
postgresql-15-pgrdf 0.6.39 u22.x86_64 pigsty 6.2 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~jammy_amd64.deb
postgresql-15-pgrdf 0.6.39 u22.aarch64 pigsty 5.8 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~jammy_arm64.deb
postgresql-15-pgrdf 0.6.39 u24.x86_64 pigsty 6.1 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~noble_amd64.deb
postgresql-15-pgrdf 0.6.39 u24.aarch64 pigsty 5.7 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~noble_arm64.deb
postgresql-15-pgrdf 0.6.39 u26.x86_64 pigsty 6.1 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~resolute_amd64.deb
postgresql-15-pgrdf 0.6.39 u26.aarch64 pigsty 5.7 MiB postgresql-15-pgrdf_0.6.39-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pgrdf_14 0.6.39 el8.x86_64 pigsty 6.8 MiB pgrdf_14-0.6.39-1PGSTY.el8.x86_64.rpm
pgrdf_14 0.6.39 el8.aarch64 pigsty 6.0 MiB pgrdf_14-0.6.39-1PGSTY.el8.aarch64.rpm
pgrdf_14 0.6.39 el9.x86_64 pigsty 6.6 MiB pgrdf_14-0.6.39-1PGSTY.el9.x86_64.rpm
pgrdf_14 0.6.39 el9.aarch64 pigsty 6.2 MiB pgrdf_14-0.6.39-1PGSTY.el9.aarch64.rpm
pgrdf_14 0.6.39 el10.x86_64 pigsty 6.5 MiB pgrdf_14-0.6.39-1PGSTY.el10.x86_64.rpm
pgrdf_14 0.6.39 el10.aarch64 pigsty 6.2 MiB pgrdf_14-0.6.39-1PGSTY.el10.aarch64.rpm
postgresql-14-pgrdf 0.6.39 d12.x86_64 pigsty 5.8 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~bookworm_amd64.deb
postgresql-14-pgrdf 0.6.39 d12.aarch64 pigsty 5.1 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~bookworm_arm64.deb
postgresql-14-pgrdf 0.6.39 d13.x86_64 pigsty 5.8 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~trixie_amd64.deb
postgresql-14-pgrdf 0.6.39 d13.aarch64 pigsty 5.1 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~trixie_arm64.deb
postgresql-14-pgrdf 0.6.39 u22.x86_64 pigsty 6.2 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~jammy_amd64.deb
postgresql-14-pgrdf 0.6.39 u22.aarch64 pigsty 5.8 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~jammy_arm64.deb
postgresql-14-pgrdf 0.6.39 u24.x86_64 pigsty 6.1 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~noble_amd64.deb
postgresql-14-pgrdf 0.6.39 u24.aarch64 pigsty 5.7 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~noble_arm64.deb
postgresql-14-pgrdf 0.6.39 u26.x86_64 pigsty 6.1 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~resolute_amd64.deb
postgresql-14-pgrdf 0.6.39 u26.aarch64 pigsty 5.7 MiB postgresql-14-pgrdf_0.6.39-1PGSTY~resolute_arm64.deb

Source

pig build pkg pgrdf;		# 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 pgrdf;		# install via package name, for the active PG version

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

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pgrdf';

Create this extension with:

CREATE EXTENSION pgrdf;

Usage

Sources:

pgrdf 0.6.40 stores RDF graphs in PostgreSQL with Turtle/TriG/N-Quads ingestion, SPARQL queries and updates, SHACL validation, and RDFS/OWL reasoning. Preload pgrdf and restart before creating the extension as a superuser.

Core Workflow

shared_preload_libraries = 'pgrdf'
CREATE EXTENSION pgrdf;
SELECT pgrdf.add_graph('http://example.org/people');
SELECT pgrdf.parse_turtle(
  '@prefix ex: <http://example.org/> . ex:alice ex:name "Alice" .',
  pgrdf.graph_id('http://example.org/people'));
SELECT * FROM pgrdf.sparql('SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10');
SELECT * FROM pgrdf.surface();

Operational Boundaries

The fixed pgrdf schema provides add_graph, graph_id, parse_turtle, load_turtle, sparql, materialize, validate, stats and surface. File loaders read server-side paths; grant access deliberately. can_clear_graphs() reports graph-clear privileges. Non-owner graph writes require the documented underlying table grants; graph locks still apply. shacl_capability() reports the supported validation surface, and path-depth/truncation settings bound traversal. Source features cover PostgreSQL 14–18; published Linux binaries target PG18. Version 0.6.39 allocates graph IDs from a non-reusing sequence; the IRI is the graph identity, and gaps are normal. After installing the matching library, run ALTER EXTENSION pgrdf UPDATE in each database. A newer library rejects old SQL with SQLSTATE 55000. Do not use the broken 0.6.35–0.6.38 PGXN source archives. Preserve graph/dictionary data together in verified backups.

Ownership Repair in 0.6.40

The 0.6.39 upgrade could leave _pgrdf_graph_id_seq owned by the upgrade executor after storage tables had been transferred to another role, preventing new graph creation. Version 0.6.40 aligns that sequence with the owner of _pgrdf_quads; granting sequence usage alone is insufficient. pgrdf.ownership_drift() reports mismatched storage owners and proposed repair commands. Review them before applying role changes. Upgrade SQL in each database after installing matching binaries; versions 0.6.34–0.6.38 can upgrade directly to 0.6.40.