586
edits
Line 613: | Line 613: | ||
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/> | PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/> | ||
SELECT distinct ?serviceLabel ?of ?ofLabel ?of_location ?of_locationLabel ?of_geo ?of_long ?of_lat ?person ?s | SELECT distinct ?personLabel ?serviceLabel ?of ?ofLabel ?of_location ?of_locationLabel ?of_geo ?of_long ?of_lat ?person #?s | ||
WHERE { | WHERE { | ||
Line 627: | Line 627: | ||
optional { ?of bnwdt:P2 ?of_location. | optional { ?of bnwdt:P2 ?of_location. | ||
optional { ?of_location bnwdt:P153 ?bn_of_geo . } | |||
optional { ?of_location bnwdt:P117 ?wd_of_loc . | |||
bind(iri(concat("http://www.wikidata.org/entity/", str(?wd_of_loc))) as ?wd_of_loc_url) . | bind(iri(concat("http://www.wikidata.org/entity/", str(?wd_of_loc))) as ?wd_of_loc_url) . | ||
SERVICE <https://query.wikidata.org/sparql> { | |||
optional {?wd_of_loc_url wdt:P625 ?wd_of_geo .} # wikidata geocoords | |||
} # /wikidata service | |||
} #/optional location wikidata | |||
} #/optional P2 location. | } #/optional P2 location. | ||
BIND(COALESCE(?bn_of_geo, ?wd_of_geo) AS ?of_geo). # if we have bn_geo use that, then try wd_geo | BIND(COALESCE(?bn_of_geo, ?wd_of_geo) AS ?of_geo). # if we have bn_geo use that, then try wd_geo | ||
BIND(geof:longitude(?of_geo) AS ?of_long) | |||
BIND(geof:latitude(?of_geo) AS ?of_lat) | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". } | |||
} | } | ||
ORDER BY ?personLabel ?s | ORDER BY ?personLabel ?s |
edits