geocode/templates/sparql/geosearch.sparql

41 lines
1.1 KiB
SPARQL
Raw Normal View History

2021-04-16 21:24:59 +01:00
SELECT DISTINCT ?item ?distance ?itemLabel ?isa ?isaLabel ?commonsCat ?commonsSiteLink WHERE {
{
SELECT DISTINCT ?item ?location ?distance ?isa WHERE {
2023-10-13 16:48:20 +01:00
VALUES ?want { wd:Q486972 wd:Q56061 }
?item wdt:P31/wdt:P279* ?want .
2021-04-16 21:24:59 +01:00
?item wdt:P31 ?isa .
SERVICE wikibase:around {
?item wdt:P625 ?location.
bd:serviceParam wikibase:center "Point({{ lon }} {{ lat }})"^^geo:wktLiteral;
wikibase:radius 5;
wikibase:distance ?distance.
}
}
}
MINUS { ?item wdt:P582 ?endTime . }
MINUS {
2024-01-10 08:53:13 +00:00
VALUES ?isNot {
wd:Q1497375
wd:Q1497364
wd:Q92086
wd:Q31028835
wd:Q160742
wd:Q17485079
wd:Q44613
wd:Q98116669
wd:Q3146899
wd:Q708676
wd:Q18917976
wd:Q2750108
wd:Q6021560
wd:Q39614
wd:Q513550
}
?item wdt:P31 ?isNot .
}
2021-04-16 21:24:59 +01:00
OPTIONAL { ?item wdt:P373 ?commonsCat. }
OPTIONAL { ?commonsSiteLink schema:about ?item;
schema:isPartOf <https://commons.wikimedia.org/>. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
2022-05-18 14:12:50 +01:00
} ORDER BY (?distance)