query-d483c9c6087664b0590724f01dd66104

rq turtle/ttl

Identifiers for constituencies

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select distinct ?item ?itemLabel ?start ?end ?gss_id ?toid ?parl_id ?thes_id ?osm
where
{
  ?item wdt:P31 wd:Q27971968 .
  # 2261 entries as of 3/6/23 
  optional { ?item wdt:P571 ?start } optional { ?item wdt:P576 ?end }
  optional { ?item wdt:P836 ?gss_id } 
  # 729x have a GSS ID, all current or ended 2010 - 1220x IDs - current are preferred
  optional { ?item wdt:P3120 ?toid } 
  # 632x have a TOID, 1x per GB seats
  optional { ?item wdt:P6213 ?parl_id }
  # 650x have a UK Parliament linked-data ID, all current
  optional { ?item wdt:P4527 ?thes_id }
  # 811x have a Parliament thesaurus ID, current + dissolved since 1997 + a couple of others that may need checking
  optional { ?item wdt:P402 ?osm }
  # 31x have an OSM relation ID
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?end"):::projected v4("?gss_id"):::projected v1("?item"):::projected v8("?osm"):::projected v6("?parl_id"):::projected v2("?start"):::projected v7("?thes_id"):::projected v5("?toid"):::projected c2(["wd:Q27971968"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"wdt:P31"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P571".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P576".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P836".-> v4 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P3120".-> v5 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P6213".-> v6 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P4527".-> v7 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P402".-> v8 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end