\pset null '(null)' CREATE SERVER graphdb FOREIGN DATA WRAPPER rdf_fdw OPTIONS ( endpoint 'http://graphdb:7200/repositories/test', update_url 'http://graphdb:7200/repositories/test/statements'); CREATE FOREIGN TABLE ft ( subject rdfnode OPTIONS (variable '?s'), predicate rdfnode OPTIONS (variable '?p'), object rdfnode OPTIONS (variable '?o') ) SERVER graphdb OPTIONS ( sparql 'SELECT * WHERE {?s ?p ?o}', sparql_update_pattern '?s ?p ?o .' ); CREATE USER MAPPING FOR postgres SERVER graphdb OPTIONS (user 'admin', password 'secret'); INSERT INTO ft (subject, predicate, object) VALUES ('', '', '"Westfälische Wilhelms-Universität Münster"@de'), ('', '', '"University of Münster"@en'), ('', '', '"Univerrrsity of Münsterrr"@en-US'), ('', '', '"Univêrsity of Münsta"@en-GB'), ('', '', '"18:18:42"^^'), ('', '', '"1780-04-16"^^'), ('', '', '"2025-12-24T18:30:42"^^'), ('', '', '"2025-12-24T13:00:42Z"^^'), ('', '', '"51.9636"^^'), ('', '', '"7.6136"^^'), ('', '', '"Johannes Wessels"'), ('', '', ''), ('', '', ''), ('', '', '"Hello 👋 PostgreSQL 🐘"@en'), ('', '', '"unknown literal type"^^'), ('', '', '"explicit string literal"^^'), ('', '', '""'), ('', '', '". <= pontos => ."@pt'), ('', '', '"\n <= salto de línea => \n"@es'), ('', '', '"\" <= double-quotes => \""@en'), ('', '', '"\t <= Tabulatorzeichen => \t"@de'), ('', '', '"1924"^^'), ('', '', '"49098"^^'), ('', '', '"4956"^^'), ('', '', '"803600000"^^'), ('', '', '"1500.00"^^'), ('', '', '"9999999999999999999"^^'), ('', '', '"0.000000000000001"^^'), ('', '', '"2024-02-29"^^'), ('', '', '"true"^^'); CALL rdf_fdw_clone_table( foreign_table => 'public.ft', target_table => 'public.t1', fetch_size => 4, verbose => true, create_table => true, commit_page => false ); SELECT * FROM public.t1 WHERE subject = '' ORDER BY object::text COLLATE "C"; /* text data type */ CREATE FOREIGN TABLE ft2 ( subject text OPTIONS (variable '?s'), predicate text OPTIONS (variable '?p'), object text OPTIONS (variable '?o') ) SERVER graphdb OPTIONS ( sparql 'SELECT * WHERE {?s ?p ?o}' ); CALL rdf_fdw_clone_table( foreign_table => 'public.ft2', target_table => 'public.t2', fetch_size => 4, verbose => true, create_table => true, commit_page => false ); SELECT * FROM public.t2 WHERE subject = 'https://www.uni-muenster.de' ORDER BY object::text COLLATE "C"; /* timestamp data type */ CREATE FOREIGN TABLE ft3 ( subject text OPTIONS (variable '?s'), predicate text OPTIONS (variable '?p'), object timestamp OPTIONS (variable '?o') ) SERVER graphdb OPTIONS ( sparql 'SELECT * WHERE {?s ?p ?o FILTER (?p = || ?p = )}' ); CALL rdf_fdw_clone_table( foreign_table => 'public.ft3', target_table => 'public.t3', fetch_size => 4, verbose => true, create_table => true, commit_page => false ); SELECT * FROM public.t3 WHERE subject = 'https://www.uni-muenster.de' ORDER BY object::text COLLATE "C"; /* date data type */ CREATE FOREIGN TABLE ft4 ( subject text OPTIONS (variable '?s'), predicate text OPTIONS (variable '?p'), object date OPTIONS (variable '?o') ) SERVER graphdb OPTIONS ( sparql 'SELECT * WHERE {?s ?p ?o FILTER (?p = || ?p = )}' ); CALL rdf_fdw_clone_table( foreign_table => 'public.ft4', target_table => 'public.t4', fetch_size => 4, verbose => true, create_table => true, commit_page => false ); SELECT * FROM public.t4 WHERE subject = 'https://www.uni-muenster.de' ORDER BY object::text COLLATE "C"; /* numeric data type */ CREATE FOREIGN TABLE ft5 ( subject text OPTIONS (variable '?s'), predicate text OPTIONS (variable '?p'), object numeric OPTIONS (variable '?o') ) SERVER graphdb OPTIONS ( sparql 'SELECT * WHERE {?s ?p ?o FILTER (?p = || ?p = )}' ); CALL rdf_fdw_clone_table( foreign_table => 'public.ft5', target_table => 'public.t5', fetch_size => 4, verbose => true, create_table => true, commit_page => false ); SELECT * FROM public.t5 WHERE subject = 'https://www.uni-muenster.de' ORDER BY object::text COLLATE "C"; /* int data type */ CREATE FOREIGN TABLE ft6 ( subject text OPTIONS (variable '?s'), predicate text OPTIONS (variable '?p'), object int OPTIONS (variable '?o') ) SERVER graphdb OPTIONS ( sparql 'SELECT * WHERE {?s ?p ?o FILTER (?p = || ?p = )}' ); CALL rdf_fdw_clone_table( foreign_table => 'public.ft6', target_table => 'public.t6', fetch_size => 4, verbose => true, create_table => true, commit_page => false ); SELECT * FROM public.t6 WHERE subject = 'https://www.uni-muenster.de' ORDER BY object::text COLLATE "C"; DELETE FROM ft; DROP TABLE public.t1; DROP TABLE public.t2; DROP TABLE public.t3; DROP TABLE public.t4; DROP TABLE public.t5; DROP TABLE public.t6; DROP SERVER graphdb CASCADE;