query-190334d3249fe4c483935db3f33210e4

rq turtle/ttl

Subway maps did great work on subway map modelling recently. May I ask here some improvement to the code ? Tagishsimon and Infovarius, PutnikHello, Starting from this code,

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":["?coords", "?line","?rgb"]}
SELECT ?station ?stationLabel ?coords ?line ?layer ?rgb WHERE {
  ?station wdt:P31 wd:Q928830;
    wdt:P17 wd:Q142;
    wdt:P625 ?coords;
    wdt:P81 ?subwayLine;
    wdt:P197 ?pred.
  MINUS { ?station (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }
  MINUS {
    ?station wdt:P5817 ?interdit.
    VALUES ?interdit {
      wd:Q811683
      wd:Q63065035
      wd:Q12377751
      wd:Q55653430
      wd:Q30108381
      wd:Q55570340
      wd:Q11639308
    }
  }
  ?pred wdt:P625 ?cds.
  BIND(IF((xsd:double(?depth / 10 )) = (xsd:integer(?depth / 10 )), ?cds, "") AS ?coords)
  ?pred (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)
  ?subwayLine  wdt:P465 ?rgb. 
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
    ?subwayLine rdfs:label ?layer  .
    ?station rdfs:label ?stationLabel .
  } 
}
GROUP BY ?station ?stationLabel ?coords  ?line ?layer ?rgb

Query found at