SPARQL Examples – Federation
Posted on Aug 31, 2017 (last modified May 7, 2021)
Federate data from 2 endpoints
Find the birth dates of all of the actors in Star Trek: The Motion Picture.
Try this on ARQ.
PREFIX movie: <http://data.linkedmdb.org/resource/movie/>
PREFIX dbpedia: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?actor_name ?birth_date
FROM <http://www.w3.org/People/Berners-Lee/card> # placeholder graph
WHERE {
SERVICE <http://data.linkedmdb.org/sparql> {
<http://data.linkedmdb.org/resource/film/675> movie:actor ?actor .
?actor movie:actor_name ?actor_name
}
SERVICE <http://dbpedia.org/sparql> {
?actor2 a dbpedia:Actor ; foaf:name ?actor_name_en ; dbpedia:birthDate ?birth_date .
FILTER(STR(?actor_name_en) = ?actor_name)
}
}
The SERVICE
keyword is used to send part of a query against a remote SPARQL endpoint.