User:Bouzinac/Trains

Stations in India edit

https://w.wiki/5ySb

Shanghai metro map edit

Map of Shanghai Metro (query)

gares françaises à faire edit

https://w.wiki/8W3b

https://w.wiki/8j3W avec les états

Y shaped subways edit

SELECT ?metroline ?metrolineLabel ?endpoints ?carte_d_itin_raire WHERE {
  {
    SELECT ?metroline (COUNT(?endpoint_statement) AS ?endpoints) WHERE {
      ?metroline wdt:P31 wd:Q15079663;
        p:P559 ?endpoint_statement.
      ?endpoint_statement a wikibase:BestRank.
      FILTER NOT EXISTS { ?endpoint_statement pq:P582 []. }
    } 
    GROUP BY ?metroline 
    HAVING (?endpoints > 2 )
  } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?metroline wdt:P15 ?carte_d_itin_raire. }
}
Try it!


Y shaped subways, other query edit

#defaultView:ImageGrid
SELECT ?metroline ?metrolineLabel ?endpoints ?carte_d_itin_raire WHERE {
  {
    SELECT ?metroline (COUNT(?endpoint_statement) AS ?endpoints) WHERE {
      ?metroline wdt:P31 wd:Q105967897;
        p:P559 ?endpoint_statement.
      ?endpoint_statement rdf:type wikibase:BestRank.
      FILTER(NOT EXISTS { ?endpoint_statement pq:P582 _:b2. })
    }
    GROUP BY ?metroline
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
   ?metroline wdt:P15 ?carte_d_itin_raire.
}
Try it!

subway networks edit

subway lines edit

https://w.wiki/3KLw

Subways stations edit

https://w.wiki/3rKn

https://w.wiki/3Mic

https://w.wiki/3gUE (les sans partie de ; sans ligne de chemin de fer)

https://w.wiki/5GP$ (les tramways sans partie de)   Done https://w.wiki/54ef (sans coordonnées)

https://w.wiki/5ao6 (sans gares voisines)

https://w.wiki/5an$ (tramways sans gares voisines)

https://w.wiki/3NU$ les zhan en chinois (850 résultats)

https://w.wiki/4$8Y : incohérence entre gare voisine et nature pas de type gare

https://w.wiki/6A3T les descriptions en FR

https://w.wiki/57GS : les gares voisines sont elles correctement renseignées ?

Séoul à faire edit

SELECT ?station ?stationLabel ?subwayLine ?line_number ?layer ?towards ?towardsLabel WHERE {
  VALUES ?search {
    wd:Q16950  
#critère de recherche de système de métro
  } 
      ?search wdt:P527 ?lignes.#quelles sont les lignes de ce métro
      ?lignes wdt:P559 ?termini.#quels sont les terminus de ce métro
  ?station wdt:P31/wdt:P279* wd:Q928830;  #station de métro
           wdt:P361|wdt:P16 ?search;#qui font partie du réseau recherché
    wdt:P81|wdt:P1192 ?subwayLine;
    wdt:P197 ?pred.
  ?pred wdt:P625 ?coords_pred;
    wdt:P81|wdt:P1192 ?subwayLine_pred.
  ?station p:P197 _:b1.
  _:b1 ps:P197 ?pred ;
    pq:P5051 ?towards;
    pq:P81|pq:P1192 ?line_pq.  optional{?subwayLine wdt:P1671 ?line_number.}
  FILTER(?subwayLine_pred = ?lignes)#on ne prend les LIGNES que si la correspondance est sur la même ligne
  FILTER(?subwayLine = ?lignes)
  FILTER(?towards = ?termini ) 
  MINUS { ?station (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }#on ne veut pas les stations disparues
  MINUS {
    ?station wdt:P5817|wdt:P5816 ?interdit.
    VALUES ?interdit {    wd:Q811683    wd:Q63065035    wd:Q12377751   wd:Q97317113   wd:Q55653430   wd:Q30108381   wd:Q55570340   wd:Q11639308 wd:Q104664889
    }
  }#on ne veut pas les cas particuliers, en construction etc
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr" .
    ?subwayLine rdfs:label ?layer.
    ?pred rdfs:label ?predLabel . ?towards rdfs:label ?towardsLabel.
    ?station rdfs:label ?stationLabel .
  } } GROUP BY ?station ?stationLabel  ?subwayLine ?rgb ?predLabel ?layer  ?towards ?line_number ?towardsLabel order by asc( ?line_number ) ?subwayLine
Try it!

Map of some bus lines in Rennes edit

https://w.wiki/3GbR

Map of some tramway lines in Stuttgart edit

https://w.wiki/3LtP Map of Strasbourg tramway (query) Map of trams in Geneva (query)

Map of tramway lines in Paris suburbs edit

#defaultView:Map{"hide":["?coordinates", "?line", "?rgb"]}
SELECT DISTINCT ?coordinates ?line ?item ?itemLabel ?connectLabel ?image ?opening ?rgb 
WITH {
  SELECT ?item (SAMPLE(?coordinates) AS ?coordinates)  (sample(?lat1) as ?lat1) (sample(?lon1) as ?lon1)
         WHERE {
    ?item wdt:P31 wd:Q2175765 ;
          wdt:P361 wd:Q1142114 ;
          wdt:P625 ?coordinates ;
          p:P625 / psv:P625 / wikibase:geoLatitude ?lat1 ;
          p:P625 / psv:P625 / wikibase:geoLongitude ?lon1 . 
MINUS { ?item wdt:P5817 ?interdit VALUES ?interdit {wd:Q811683 wd:Q63065035 wd:Q12377751 wd:Q30108381 wd:Q11639308} } 
MINUS { ?item (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }

  } GROUP BY ?item
} AS %stations
WITH { 
  SELECT ?nextstation (sample(?lat2) as ?lat2) (sample(?lon2) as ?lon2) WHERE {
    ?nextstation wdt:P31  wd:Q2175765 ;
                 wdt:P361 wd:Q1142114 ;
                 p:P625 / psv:P625 / wikibase:geoLatitude ?lat2 ;
                 p:P625 / psv:P625 / wikibase:geoLongitude ?lon2 .
  } GROUP BY ?nextstation
} AS %nextstations 

WITH {
  SELECT ?line ?connect ?rgb WHERE { 
    INCLUDE %stations .
    INCLUDE %nextstations .
    ?item p:P197 ?nextstationstatement .
    ?nextstationstatement ps:P197 ?nextstation ;
                          pq:P81 ?connect .
    ?connect                         wdt:P465 ?rgb.
    FILTER(STR(?item) < STR(?nextstation)) .
    BIND(CONCAT('LINESTRING (', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ')') AS ?str) .
    BIND(STRDT(?str, geo:wktLiteral) AS ?line)  
  }
} AS %lines 

WHERE {
  { INCLUDE %stations }  UNION { INCLUDE %lines  } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,de". } 
}
Try it!

Map of Montpellier tramway edit

#defaultView:Map{"hide":["?coords", "?line","?rgb"]}
SELECT ?station ?stationLabel ?coords ?line ?layer ?rgb  WHERE {
  ?station wdt:P31 wd:Q2175765;
    wdt:P361 wd:Q1753254;
    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
Try it!

Map of Hefei subway edit

Map of Hefei Metro (query)

Carte des métros de la Chine v2 edit

#title: Carte des métros de Chine/China subways v2
#defaultView:Map{"hide":["?coords", "?searchlines", "?termini","?rgb", "?line_draw"]}
SELECT distinct ?stationLabel ?linesLabel ?searchlines ?lignes ?line_draw ?termini ?station ?coords ?pred ?rgb WHERE {
?searchlines wdt:P17 wd:Q148;wdt:P31/wdt:P279* wd:Q728937; wdt:P559 ?termini#quels sont les terminus de ce métro, what are the ends of these lines
  ; wdt:P465 ?rgb   .
 VALUES ?stations_type { 
               wd:Q928830 #station de métro
               wd:Q2175765 # tramway
             }
  ?station wdt:P31/wdt:P279* ?stations_type;  
    wdt:P81 ?searchlines;
    wdt:P625 ?coords  ;wdt:P5817 wd:Q55654238;
    wdt:P197 ?pred.
   ?pred wdt:P625 ?coords_pred;
    wdt:P81 ?subwayLine_pred.
  ?station p:P197 _:b1.
  _:b1 ps:P197 ?pred ;
    pq:P5051 ?towards;
    pq:P81 ?line_pq.
  FILTER(?subwayLine_pred = ?searchlines)#on ne prend les LINES que si la correspondance est sur la même ligne
  FILTER(?towards = ?termini) 
  FILTER(?station != ?termini)
  ?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_draw  )
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "fr,en,zh".
    ?searchlines rdfs:label ?layer .
    ?searchlines rdfs:label ?linesLabel.
    ?station rdfs:label ?stationLabel.
  }  }
Carte des métros de Chine/China subways v2

Carte des métros/tramways de France edit

#title: Cartes des métros et tramways de France
#defaultView:Map{"hide":["?coords", "?line","?rgb"]}
SELECT ?station ?stationLabel ?subwayLine ?systemLabel ?coords ?line  ?rgb WHERE {
  VALUES ?searchpays {
    wd:Q142  #critère de recherche de pays
  } 
  ?system wdt:P31/wdt:P279* wd:Q3491904;wdt:P17 ?searchpays.
      ?system wdt:P527 ?lignes.#quelles sont les lignes de ces métros
      ?lignes wdt:P559 ?termini.#quels sont les terminus de ces métros
  ?station wdt:P31/wdt:P279*  wd:Q548662;  #station de métro ou de tramway
           wdt:P361 ?system;#qui font partie du réseau recherché
    wdt:P625 ?coords;
    wdt:P81|wdt:P1192 ?subwayLine;
    wdt:P197 ?pred.
  ?pred wdt:P625 ?coords_pred;
    wdt:P81|wdt:P1192 ?subwayLine_pred.
  ?station p:P197 _:b1.
  _:b1 ps:P197 ?pred ;
    pq:P5051 ?towards;
    pq:P81|pq:P1192 ?line_pq.
  FILTER(?subwayLine_pred = ?lignes)#on ne prend les LIGNES que si la correspondance est sur la même ligne
  FILTER(?subwayLine = ?lignes)
  FILTER(?towards = ?termini) 
  MINUS { ?station (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }#on ne veut pas les stations disparues
  MINUS {
    ?station wdt:P5817 ?interdit.
    VALUES ?interdit {
      wd:Q811683
      wd:Q63065035 
      wd:Q12377751
      wd:Q97317113
      wd:Q55653430
      wd:Q30108381
      wd:Q55570340
      wd:Q11639308
    }
  }#on ne veut pas les cas particuliers, en construction etc
 ?pred  p:P625 ?node_pred .
  ?node_pred psv:P625/wikibase:geoLatitude ?lat1 ;
        psv:P625/wikibase:geoLongitude ?lon1 .
  ?node_pred a wikibase:BestRank.
  ?station p:P625 ?node_station.
 ?node_station psv:P625/wikibase:geoLatitude ?lat2 ;
   psv:P625/wikibase:geoLongitude ?lon2. 
 ?node_station a wikibase:BestRank.
  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],fr,en".
    ?subwayLine rdfs:label ?layer0 .
     ?system rdfs:label ?systemLabel.
    ?pred rdfs:label ?predLabel.
    ?station rdfs:label ?stationLabel. 
  }   
bind(   Concat(?layer0," ",?systemLabel) as ?layer)
}  
GROUP BY ?station ?stationLabel  ?subwayLine ?rgb ?predLabel ?systemLabel ?layer  ?coords ?line
Cartes des métros et tramways de France