query-1a370903db4241c5dcd6575f3b7bb80f
SPARQL on CommonsI test SPARQL on Commons. I want all images with a coordinate on SDC around the center of the city Dresden. I know there are images, but my query get now rows.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Table;ImageGrid;Map
SELECT ?file ?image ?center ?coordinate WHERE {
#?file wdt:P180 wd:Q1731 . # Motiv is Dresden
#?file wdt:P625 ?coords . # Coordinate of image
#?file wdt:P1259 ?pov_coords . # POV_coordinate
?file schema:contentUrl ?url .
bind(iri(concat("http://commons.wikimedia.org/wiki/Special:FilePath/", replace(substr(str(?url),53),"_","%20"))) AS ?image)
wd:Q1731 wdt:P625 ?center. #Around the city Dresden
SERVICE wikibase:around {
?file wdt:P625 ?coordinate.
bd:serviceParam wikibase:center ?center.
bd:serviceParam wikibase:radius "10". # 10 Kilometer around
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?center"):::projected
v5("?coordinate"):::projected
v1("?file"):::projected
v3("?image"):::projected
v2("?url")
c5(["bd:serviceParam"]):::iri
c2(["wd:Q1731"]):::iri
c8(["10"]):::literal
v1 --"schema:contentUrl"--> v2
bind0[/"concat('http://commons.wikimedia.org/wiki/Special:FilePath/',replace(substring(str(?url),'53^^xsd:integer'),'_','%20'))"/]
v2 --o bind0
bind0 --as--o v3
c2 --"wdt:P625"--> v4
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v1 --"wdt:P625"--> v5
c5 --"wikibase:center"--> v4
c5 --"wikibase:radius"--> c8
end