query-12c1b3593846a74e2c4ae591f7ecf29a

rq turtle/ttl

UK station codes 16:05, 18 January 2018 (UTC) Andy's edits; Talk to Andy); Pigsonthewing (Andy Mabbett? (P4755)UK railway station code to the newly-created (P296)station code Please can someone migrate codes for railway stations in the United Kingdom from 18:07, 21 January 2018 (UTC)) talk (Andrew Gray: - if you can give me a query showing all the codes that need migrated, I'll get it done - don't want to try it off my own bat in case I move the wrong entries. Pigsonthewing@: Late reply sorry - I've been travelling. This seems to do the trick: Andrew Gray@

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 ?train_station ?train_stationLabel ?station_code WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?train_station wdt:P31 wd:Q55488.
  ?train_station wdt:P17 wd:Q145.
  ?train_station wdt:P296 ?station_code.
}
LIMIT 2500

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?station_code"):::projected v1("?train_station"):::projected c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal c6(["wd:Q55488"]):::iri c8(["wd:Q145"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v1 --"wdt:P31"--> c6 v1 --"wdt:P17"--> c8 v1 --"wdt:P296"--> v2