query-ad16e52f08ce80c1386f83572c04d1a4

rq turtle/ttl

TODO

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: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)
  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 (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,zh,en".
    ?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("?dispar") v14("?interdit") v14("?lat1") v16("?lat2") v20("?layer") v19("?line_draw"):::projected v11("?line_pq") v21("?linesLabel"):::projected v15("?lon1") v17("?lon2") v9("?pred"):::projected v6("?rgb"):::projected v5("?searchlines"):::projected v1("?station"):::projected v22("?stationLabel"):::projected v7("?stations_type") v18("?str") v4("?subwayLine_pred") v2("?termini"):::projected v3("?towards") a3((" ")) a1((" ")) a2((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) a9((" ")) a10((" ")) a11((" ")) c5(["wd:Q728937"]):::iri c24(["bd:serviceParam"]):::iri c2(["wd:Q148"]):::iri c26(["fr,zh,en"]):::literal 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/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 subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P3999"--> v12 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P582"--> v12 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P576"--> v12 end union0r <== or ==> union0l end end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v1 --"p:direct/P5817"--> v14 bind6[/VALUES ?interdit/] bind6-->v14 bind60(["wd:Q811683"]) bind60 --> bind6 bind61(["wd:Q63065035"]) bind61 --> bind6 bind62(["wd:Q12377751"]) bind62 --> bind6 bind63(["wd:Q55653430"]) bind63 --> bind6 bind64(["wd:Q30108381"]) bind64 --> bind6 bind65(["wd:Q55570340"]) bind65 --> bind6 bind66(["wd:Q11639308"]) bind66 --> bind6 end v9 --"p:P625"--> a4 a4 --"p:statement/value/P625"--> a5 a5 --"wikibase:geoLatitude"--> v14 v9 --"p:P625"--> a6 a6 --"p:statement/value/P625"--> a7 a7 --"wikibase:geoLongitude"--> v15 v1 --"p:P625"--> a8 a8 --"p:statement/value/P625"--> a9 a9 --"wikibase:geoLatitude"--> v16 v1 --"p:P625"--> a10 a10 --"p:statement/value/P625"--> a11 a11 --"wikibase:geoLongitude"--> v17 bind7[/"concat('LINESTRING(',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v15 --o bind7 v14 --o bind7 v17 --o bind7 v16 --o bind7 bind7 --as--o v18 bind8[/"STRDT(?str,'geo:wktLiteral')"/] v18 --o bind8 bind8 --as--o v19 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c24 --"wikibase:language"--> c26 v5 --"rdfs:label"--> v20 v5 --"rdfs:label"--> v21 v1 --"rdfs:label"--> v22 end