Project:SPARQL/examples: Difference between revisions

Line 2,725: Line 2,725:
order by ?personLabel
order by ?personLabel


</sparql>
=== Places of residence that lack instance of locality===
<sparql tryit="1">
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 ?residence ?residenceLabel ?inst ?instLabel
WHERE { 
  ?resident bnwdt:P29 ?residence . # resided at
  filter not exists { ?residence bnwdt:P12 bnwd:Q2147 . } # that doesn't have instance of locality
  optional {?residence bnwdt:P12 ?inst .} # does it have instance of anything? 
      ## Note: some have Q618 territory of the British Empire, which also lacks any instance of at present
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?residenceLabel
</sparql>
</sparql>


579

edits