646
edits
Line 1,502: | Line 1,502: | ||
group by ?person ?personLabel ?residenceLabel ?residence ?geo | group by ?person ?personLabel ?residenceLabel ?residence ?geo | ||
ORDER BY ?geo | ORDER BY ?geo | ||
</sparql> | |||
=== BN people and other things located near Devizes === | |||
<sparql tryit="1"> | |||
## testing use of geof:distance | |||
#title:BN items located within 30 km of Devizes, Wiltshire | |||
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/> | |||
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/> | |||
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/> | |||
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/> | |||
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/> | |||
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/> | |||
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/> | |||
#defaultView:Map | |||
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo ?wd_long ?wd_lat | |||
WHERE { | |||
{?item bnwdt:P29 ?location . } # resided at location | |||
#union | |||
#{?location bnwdt:P12 bnwd:Q2147 .} # OR location has instance of locality. is there a way to get this in the same structure? | |||
union | |||
{?item bnwdt:P2 ?location . } # item has property P2 location | |||
# any other possibles ? | |||
## limit to places in admin territory p33 england q617. (keep numbers down to avoid wikidata timing out) | |||
?location bnwdt:P33+ bnwd:Q617. | |||
?location bnwdt:P117 ?ws . # wikidata id | |||
bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) . | |||
SERVICE <https://query.wikidata.org/sparql> { | |||
wd:Q1026699 wdt:P625 ?start. # devizes coordinates | |||
?wikidata wdt:P625 ?wd_geo . | |||
#BIND(geof:longitude(?wd_geo) AS ?wd_long) . | |||
#BIND(geof:latitude(?wd_geo) AS ?wd_lat) . | |||
FILTER(geof:distance(?wd_geo, ?start) < 30). # < 30 km from ?start. | |||
} # /wikidata service | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } | |||
} | |||
ORDER BY ?locationLabel | |||
</sparql> | </sparql> | ||
edits