CREATE SERVER bbc
FOREIGN DATA WRAPPER rdf_fdw
OPTIONS (
endpoint 'https://lod.openlinksw.com/sparql',
format 'application/sparql-results+xml'
);
/*
* Authors and their work registered in the BBC Programmes and Music database
*/
CREATE FOREIGN TABLE artists (
id text OPTIONS (variable '?person', nodetype 'iri'),
name text OPTIONS (variable '?name', nodetype 'literal'),
itemid text OPTIONS (variable '?created', nodetype 'iri'),
title text OPTIONS (variable '?title', nodetype 'literal'),
description text OPTIONS (variable '?descr', nodetype 'literal')
)
SERVER bbc OPTIONS (
log_sparql 'true',
sparql '
PREFIX foaf:
PREFIX blterms:
PREFIX dcterms:
PREFIX bibo:
PREFIX xsd:
SELECT *
{
?person a foaf:Person ;
foaf:name ?name ;
blterms:hasCreated ?created .
?created a bibo:Book ;
dcterms:title ?title ;
dcterms:description ?descr
}
');
SELECT DISTINCT title, description
FROM artists
WHERE name = 'John Lennon';