Project:SPARQL/admin: Difference between revisions

From Beyond Notability
Line 362: Line 362:
<sparql tryit="1">
<sparql tryit="1">
#title:UK localities in multiple P33 admin territories
#title:UK localities in multiple P33 admin territories
# may be problematic for aggregation
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 386: Line 388:
having (?count>1)
having (?count>1)
order by ?itemLabel
order by ?itemLabel
</sparql>
=== UK localities that have a UK region as P33 admin territory ===
<sparql tryit="1">
#title:UK localities with P33 that is a UK region
# check for anything that shouldn't be directly in a region.
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 ?item ?itemLabel ?regionLabel ?region
where {
  values ?region { bnwd:Q1231 bnwd:Q67 bnwd:Q75 bnwd:Q200 bnwd:Q1202 bnwd:Q85 bnwd:Q204 bnwd:Q1215 bnwd:Q72 bnwd:Q425 bnwd:Q1224 bnwd:Q1740 }
  ?item bnwdt:P12 bnwd:Q2147 .
  ?item bnwdt:P33 ?region.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
order by ?regionLabel
</sparql>
</sparql>


3,427

edits