query-73dc449b230abf6c9f205cde71b24694

rq turtle/ttl

TODO TODO TODO TODO TODO TODO TODO TODO

Use at

PREFIX gas: <http://www.bigdata.com/rdf/gas#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# UK railway stations connected from Topsham railway station (Q1990205) 
#defaultView:Map{"hide":["?cds","?line","?layer"],"layer":"?trackLabel"}
SELECT ?station ?stationLabel ?cds ?line ?trackLabel ?track ?image {
{SELECT * {
  SERVICE gas:service {
       gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.BFS" ; gas:in wd:Q1990205 ; gas:linkType wdt:P197 ; gas:out ?station ; gas:out1 ?depth ; gas:out2 ?pred . }
  FILTER(?station != wd:Q1990205)
                      ?station wdt:P625 ?cds ;
                               wdt:P17 wd:Q145 .

  ?station p:P197 ?adjST .
  ?adjST ps:P197 ?adj ;
                pq:P81 ?track .

  ?adj p:P625/psv:P625/wikibase:geoLatitude ?lat1 ; p:P625/psv:P625/wikibase:geoLongitude ?lon1 .
  ?station p:P625/psv:P625/wikibase:geoLatitude ?lat2 ; p:P625/psv:P625/wikibase:geoLongitude ?lon2 .
  BIND(CONCAT('LINESTRING(', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ')') AS ?str) . BIND(STRDT(?str, geo:wktLiteral) AS ?line)}

}
  OPTIONAL { ?station wdt:P18 ?image .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?adj") v5("?adjST") v4("?cds"):::projected v2("?depth") v14("?image"):::projected v8("?lat1") v10("?lat2") v13("?line"):::projected v9("?lon1") v11("?lon2") v3("?pred") v1("?station"):::projected v12("?str") v7("?track"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) c24(["bd:serviceParam"]):::iri c3(["gas:program"]):::iri c1(["wd:Q1990205"]):::iri c26(["en"]):::literal c8(["p:direct/P197"]):::iri c5(["com.bigdata.rdf.graph.analytics.BFS"]):::literal c14(["wd:Q145"]):::iri f0[["?station != 'wd:Q1990205'"]] f0 --> v1 subgraph s1["http://www.bigdata.com/rdf/gas#service"] style s1 stroke-width:4px; c3 --"gas:gasClass"--> c5 c3 --"gas:in"--> c1 c3 --"gas:linkType"--> c8 c3 --"gas:out"--> v1 c3 --"gas:out1"--> v2 c3 --"gas:out2"--> v3 end v1 --"p:direct/P625"--> v4 v1 --"p:direct/P17"--> c14 v1 --"p:P197"--> v5 v5 --"p:statement/P197"--> v6 v5 --"p:qualifier/P81"--> v7 v6 --"p:P625"--> a1 a1 --"p:statement/value/P625"--> a2 a2 --"wikibase:geoLatitude"--> v8 v6 --"p:P625"--> a3 a3 --"p:statement/value/P625"--> a4 a4 --"wikibase:geoLongitude"--> v9 v1 --"p:P625"--> a5 a5 --"p:statement/value/P625"--> a6 a6 --"wikibase:geoLatitude"--> v10 v1 --"p:P625"--> a7 a7 --"p:statement/value/P625"--> a8 a8 --"wikibase:geoLongitude"--> v11 bind1[/"concat('LINESTRING(',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v9 --o bind1 v8 --o bind1 v11 --o bind1 v10 --o bind1 bind1 --as--o v12 bind2[/"STRDT(?str,'geo:wktLiteral')"/] v12 --o bind2 bind2 --as--o v13 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P18".-> v14 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c24 --"wikibase:language"--> c26 end