query-889ce10b39af196b217acdebcc5fc718

rq turtle/ttl

Original railways in ScotlandWorking on basic view of history, but lacks many of the company-station links which would allow geographical and timelayer mapping

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT DISTINCT (?railcoyLabel AS ?layer) ?railcoy ?railstatLabel ?statloc ?railstat  WHERE { 
  {{?railcoy wdt:P31/wdt:P279* wd:Q249556.} UNION {?railcoy wdt:P31/wdt:P279* wd:Q728937.}}. #Q22667 for underdefined
  {{?railcoy wdt:P131 wd:Q22.} UNION {?railcoy wdt:P2541 wd:Q22.}}.
  OPTIONAL  {?railcoy wdt:P1619 ?rcoystart.}
  OPTIONAL  {?railcoy wdt:P3999 ?rcoyfinish.}
  ?railstat wdt:P137 ?railcoy.
  ?railstat wdt:P625 ?statloc.
  optional { ?railcoy rdfs:label ?railcoyLabel. FILTER(LANG(?railcoyLabel) = "en").}
  optional { ?railstat rdfs:label ?railstatLabel. FILTER(LANG(?railstatLabel) = "en").}
  #SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

}
ORDER BY ?railcoyLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?layer") v3("?railcoy"):::projected v1("?railcoyLabel"):::projected v6("?railstat"):::projected v2("?railstatLabel"):::projected v5("?rcoyfinish") v4("?rcoystart") v7("?statloc"):::projected a1((" ")) a2((" ")) c7(["wd:Q22"]):::iri c5(["wd:Q728937"]):::iri c4(["wd:Q249556"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c4 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P2541"--> c7 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P131"--> c7 end union1r <== or ==> union1l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P1619".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P3999".-> v5 end v6 --"wdt:P137"--> v3 v6 --"wdt:P625"--> v7 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."rdfs:label".-> v1 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v6 -."rdfs:label".-> v2 end bind0[/"?railcoyLabel"/] v1 --o bind0 bind0 --as--o v8