Railway Stations

From BITPlan E-Bike Wiki
Revision as of 17:55, 9 March 2025 by Wf (talk | contribs) (Created page with "https://w.wiki/DMjm <source lang='sparql'> # Railway stations in a country # 2025-03-09 SELECT ?station ?code ?label ?url ?loc WHERE { ?station wdt:P296 ?code; wd...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

https://w.wiki/DMjm

# Railway stations in a country
# 2025-03-09
SELECT ?station ?code ?label ?url ?loc WHERE {
  ?station wdt:P296 ?code;
           wdt:P31 wd:Q55488; # Railway station
           wdt:P17 wd:Q142.  # Portugal (Q45) / Spain (Q29)
  ?station rdfs:label ?label.
  FILTER(LANG(?label) = "en")  # Ensures we only get Spanish labels
  OPTIONAL { ?station wdt:P973 ?url. }  # Optional "described at URL"
  OPTIONAL { ?station wdt:P625 ?loc. }  # Optional "location"
}
ORDER BY DESC(?loc)