query-65f17df0eafc09f89b8464cc2c7a6ef6

rq turtle/ttl

Carte des métros/tramways de France

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 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#>
#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

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?coords"):::projected v11("?coords_pred") v13("?dispar") v15("?interdit") v16("?lat1") v19("?lat2") v28("?layer") v24("?layer0") v4("?lignes") v22("?line"):::projected v12("?line_pq") v17("?lon1") v20("?lon2") v15("?node_pred") v18("?node_station") v10("?pred") v26("?predLabel") v23("?rgb"):::projected v6("?searchpays") v8("?station"):::projected v27("?stationLabel"):::projected v21("?str") v3("?subwayLine"):::projected v5("?subwayLine_pred") v7("?system") v25("?systemLabel"):::projected v2("?termini") v1("?towards") a3((" ")) a1((" ")) a2((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) c32(["#91;AUTO_LANGUAGE#93;,fr,en"]):::literal c3(["wd:Q3491904"]):::iri c30(["bd:serviceParam"]):::iri c27(["wikibase:BestRank"]):::iri c7(["wd:Q548662"]):::iri f0[["?towards = ?termini"]] f0 --> v1 f0 --> v2 f1[["?subwayLine = ?lignes"]] f1 --> v3 f1 --> v4 f2[["?subwayLine_pred = ?lignes"]] f2 --> v5 f2 --> v4 bind3[/VALUES ?searchpays/] bind3-->v6 bind30(["wd:Q142"]) bind30 --> bind3 v7 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v7 --"p:direct/P17"--> v6 v7 --"p:direct/P527"--> v4 v4 --"p:direct/P559"--> v2 v8 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c7 v8 --"p:direct/P361"--> v7 v8 --"p:direct/P625"--> v9 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P1192"--> v3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P81"--> v3 end union0r <== or ==> union0l end v8 --"p:direct/P197"--> v10 v10 --"p:direct/P625"--> v11 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v10 --"p:direct/P1192"--> v5 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v10 --"p:direct/P81"--> v5 end union1r <== or ==> union1l end v8 --"p:P197"--> a3 a3 --"p:statement/P197"--> v10 a3 --"p:qualifier/P5051"--> v1 subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; a3 --"p:qualifier/P1192"--> v12 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; a3 --"p:qualifier/P81"--> v12 end union2r <== or ==> union2l end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P3999"--> v13 end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P582"--> v13 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P576"--> v13 end union3r <== or ==> union3l end end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v8 --"p:direct/P5817"--> v15 bind6[/VALUES ?interdit/] bind6-->v15 bind60(["wd:Q811683"]) bind60 --> bind6 bind61(["wd:Q63065035"]) bind61 --> bind6 bind62(["wd:Q12377751"]) bind62 --> bind6 bind63(["wd:Q97317113"]) bind63 --> bind6 bind64(["wd:Q55653430"]) bind64 --> bind6 bind65(["wd:Q30108381"]) bind65 --> bind6 bind66(["wd:Q55570340"]) bind66 --> bind6 bind67(["wd:Q11639308"]) bind67 --> bind6 end v10 --"p:P625"--> v15 v15 --"p:statement/value/P625"--> a4 a4 --"wikibase:geoLatitude"--> v16 v15 --"p:statement/value/P625"--> a5 a5 --"wikibase:geoLongitude"--> v17 v15 --"a"--> c27 v8 --"p:P625"--> v18 v18 --"p:statement/value/P625"--> a6 a6 --"wikibase:geoLatitude"--> v19 v18 --"p:statement/value/P625"--> a7 a7 --"wikibase:geoLongitude"--> v20 v18 --"a"--> c27 bind7[/"concat('LINESTRING(',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v17 --o bind7 v16 --o bind7 v20 --o bind7 v19 --o bind7 bind7 --as--o v21 bind8[/"STRDT(?str,'geo:wktLiteral')"/] v21 --o bind8 bind8 --as--o v22 v3 --"p:direct/P465"--> v23 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c30 --"wikibase:language"--> c32 v3 --"rdfs:label"--> v24 v7 --"rdfs:label"--> v25 v10 --"rdfs:label"--> v26 v8 --"rdfs:label"--> v27 end bind9[/"concat(?layer0,' ',?systemLabel)"/] v24 --o bind9 v25 --o bind9 bind9 --as--o v28