Project:SPARQL/examples: Difference between revisions

Line 941: Line 941:


==Place==
==Place==
=== All the wikibase places that can be mapped ===
<sparql tryit="1">
#title:map of BN places using wikidata P625
#defaultView:Map
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/>
SELECT distinct ?locationLabel ?location ?wikidata ?wd_geo
WHERE { 
 
  {?item bnwdt:P29  ?location . } # resided at
  union
  {?location bnwdt:P12 bnwd:Q2147 .} # OR has instance of locality
  union
  {?item bnwdt:P2  ?location . } # OR location P2
  # any other possibles ?  "P33 but only if i/o arch site or historic house" historic house Q2961  arch site Q86
  union
  {?item bnwdt:P33 ?location .} # admin territory ADDS ONE ROW. lol.
   
      ?location bnwdt:P117 ?ws .  # wikidata id       
       
        bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
        SERVICE <https://query.wikidata.org/sparql> {
            ?wikidata wdt:P625 ?wd_geo .  # does the wikidata page have geocoords?
        } # /wikidata service 
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?wikidata ?locationLabel
</sparql>


===People not in London linked as a graph by a NUTS region or country (excluding England) at which they were once resident in the UK===
===People not in London linked as a graph by a NUTS region or country (excluding England) at which they were once resident in the UK===
579

edits