query-c82dafafc11adf047102cb4fb9bd8b01
TODO
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?id1 ?image ?metres ?item2 ?item2Label ?id2 WHERE {
{
SELECT ?formatter {
wd:P1260 wdt:P1630 ?formatter .
} LIMIT 1
}.
?item wdt:P1260 ?_id1; wdt:P625 ?coord1; wdt:P18 ?image .
SERVICE wikibase:around {
?item2 wdt:P625 ?location .
bd:serviceParam wikibase:center ?coord1 .
bd:serviceParam wikibase:radius "0.05" .
bd:serviceParam wikibase:distance ?distance .
} .
?item2 wdt:P1260 ?_id2 .
MINUS { ?item2 wdt:P18 [] } .
BIND( ?distance * 1000 AS ?metres ) .
BIND( URI( REPLACE( ?formatter, '\\$1', ?_id1 ) ) AS ?id1 ) .
BIND( URI( REPLACE( ?formatter, '\\$1', ?_id2 ) ) AS ?id2 ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en" } .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?_id1")
v9("?_id2")
v4("?coord1")
v8("?distance")
v1("?formatter")
v11("?id1"):::projected
v12("?id2"):::projected
v5("?image"):::projected
v2("?item"):::projected
v6("?item2"):::projected
v7("?location")
v10("?metres"):::projected
a1((" "))
c1(["wd:P1260"]):::iri
c7(["bd:serviceParam"]):::iri
c10(["0.05"]):::literal
c14(["sv,en"]):::literal
c1 --"wdt:P1630"--> v1
v2 --"wdt:P1260"--> v3
v2 --"wdt:P625"--> v4
v2 --"wdt:P18"--> v5
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v6 --"wdt:P625"--> v7
c7 --"wikibase:center"--> v4
c7 --"wikibase:radius"--> c10
c7 --"wikibase:distance"--> v8
end
v6 --"wdt:P1260"--> v9
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v6 --"wdt:P18"--> a1
end
bind1[/"?distance * '1000^^xsd:integer'"/]
v8 --o bind1
bind1 --as--o v10
bind2[/"replace(?formatter,'\$1',?_id1)"/]
v1 --o bind2
v3 --o bind2
bind2 --as--o v11
bind3[/"replace(?formatter,'\$1',?_id2)"/]
v1 --o bind3
v9 --o bind3
bind3 --as--o v12
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c7 --"wikibase:language"--> c14
end