In the following SPARQL query, solutions of both the variables, ?citizenship_uri and ?place_of_birth are passed to the VALUES clause of the federated query.
PREFIX person: <http://www.w3.org/ns/person#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?place_of_birth ?citizenship
WHERE {
[] person:citizenship ?citizenship_uri ;
person:placeOfBirth ?place_of_birth .
SERVICE <https://publications.europa.eu/webapi/rdf/sparql> {
?citizenship_uri skos:prefLabel ?citizenship .
FILTER(LANG(?citizenship) = "en")
}
}
The below is the federated query performed by the RDFLib where both the solution bindings are present in the VALUES. However, the place_of_birth is not required here, since it is not used in the federated query.
# Federated query
PREFIX person: <http://www.w3.org/ns/person#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT REDUCED * WHERE {
?citizenship_uri skos:prefLabel ?citizenship .
FILTER(LANG(?citizenship) = "en")
}VALUES (?citizenship_uri ?place_of_birth) {(<http://publications.europa.eu/resource/authority/country/GBR> "London")}
How can I capture the ?place_of_birth without it being included in the VALUES clause of the federated query?
I get the following error from the SPARQL endpoint if the unused solution bindings are included in the federated query's VALUES clause.
Virtuoso 37000 Error SP031: SPARQL compiler: Variable name 'place_of_birth' is used in the BINDINGS clause but not in the query result set