In Wikidata (https://query.wikidata.org/), I tried the following simple SPARQL federated query with SERVICE
.
I got the results back, but they do not seem to be what I expected. It seems that ?geonamesid
(i.e. reference to the entity "London") is not passed to SERVICE
part, so that inside the SERVICE
it is considered as a random variable and the results (?Proxy
, ?Aggregation
, ?CHO
etc) are not related to London.
Do you have any idea what might be wrong?
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
SELECT *
WHERE {
wd:Q21 wdt:P36 ?capital .
?capital wdtn:P1566 ?geonamesid .
SERVICE <http://sparql.europeana.eu/>{
SELECT *
WHERE{
?Place owl:sameAs ?geonamesid .
?Proxy dc:subject ?Place .
?Proxy ore:proxyIn ?Aggregation .
?Aggregation edm:aggregatedCHO ?CHO .
}
LIMIT 1000
}
}
I tried the query separately at two SPARQL endpoints. This seems to be working. The following query was successful at https://query.wikidata.org and http://sparql.europeana.eu/ respectively (PREFIX
omitted for readability).
SELECT *
WHERE {
wd:Q21 wdt:P36 ?capital .
?capital wdtn:P1566 ?geonamesid .
}
Select *
Where{
?Place owl:sameAs <http://sws.geonames.org/2643743> .
?Proxy dc:subject ?Place .
?Proxy ore:proxyIn ?Aggregation .
?Aggregation edm:aggregatedCHO ?CHO .
}
LIMIT 1000