query-30f8d07de3db8e375d46a6135df8c103

rq turtle/ttl

Carte des métros de la Chine v2

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: 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.
  }  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?coords"):::projected v10("?coords_pred") v12("?lat1") v14("?lat2") v18("?layer") v17("?line_draw"):::projected v11("?line_pq") v19("?linesLabel"):::projected v13("?lon1") v15("?lon2") v9("?pred"):::projected v6("?rgb"):::projected v5("?searchlines"):::projected v1("?station"):::projected v20("?stationLabel"):::projected v7("?stations_type") v16("?str") v4("?subwayLine_pred") v2("?termini"):::projected v3("?towards") a3((" ")) a1((" ")) a2((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) a9((" ")) a10((" ")) a11((" ")) c5(["wd:Q728937"]):::iri c22(["bd:serviceParam"]):::iri c11(["wd:Q55654238"]):::iri c24(["fr,en,zh"]):::literal c2(["wd:Q148"]):::iri f0[["?station != ?termini"]] f0 --> v1 f0 --> v2 f1[["?towards = ?termini"]] f1 --> v3 f1 --> v2 f2[["?subwayLine_pred = ?searchlines"]] f2 --> v4 f2 --> v5 v5 --"p:direct/P17"--> c2 v5 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 v5 --"p:direct/P559"--> v2 v5 --"p:direct/P465"--> v6 bind3[/VALUES ?stations_type/] bind3-->v7 bind30(["wd:Q928830"]) bind30 --> bind3 bind31(["wd:Q2175765"]) bind31 --> bind3 v1 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> v7 v1 --"p:direct/P81"--> v5 v1 --"p:direct/P625"--> v8 v1 --"p:direct/P5817"--> c11 v1 --"p:direct/P197"--> v9 v9 --"p:direct/P625"--> v10 v9 --"p:direct/P81"--> v4 v1 --"p:P197"--> a3 a3 --"p:statement/P197"--> v9 a3 --"p:qualifier/P5051"--> v3 a3 --"p:qualifier/P81"--> v11 v9 --"p:P625"--> a4 a4 --"p:statement/value/P625"--> a5 a5 --"wikibase:geoLatitude"--> v12 v9 --"p:P625"--> a6 a6 --"p:statement/value/P625"--> a7 a7 --"wikibase:geoLongitude"--> v13 v1 --"p:P625"--> a8 a8 --"p:statement/value/P625"--> a9 a9 --"wikibase:geoLatitude"--> v14 v1 --"p:P625"--> a10 a10 --"p:statement/value/P625"--> a11 a11 --"wikibase:geoLongitude"--> v15 bind4[/"concat('LINESTRING(',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v13 --o bind4 v12 --o bind4 v15 --o bind4 v14 --o bind4 bind4 --as--o v16 bind5[/"STRDT(?str,'geo:wktLiteral')"/] v16 --o bind5 bind5 --as--o v17 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c22 --"wikibase:language"--> c24 v5 --"rdfs:label"--> v18 v5 --"rdfs:label"--> v19 v1 --"rdfs:label"--> v20 end