query-38be8d7ad48f77f020078423604c25ec

rq turtle/ttl

Hello! Subways again ;)How are you? May I ask you to amend that query so that I can spot the bad items that haven't got correct qualifyers (that is no ?subwayLine_predLabel or no ?towardsLabel). Thanks !

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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?station ?stationLabel ?subwayLine_predLabel ?predLabel ?towardsLabel WHERE {
  VALUES ?search {
    wd:Q462201  
#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.  
  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 wd:Q110713763    }
  }#on ne veut pas les cas particuliers, en construction etc
 ?pred  p:P625 ?node_pred .
  ?node_pred a wikibase:BestRank.
  ?station p:P625 ?node_station.
 ?node_station a wikibase:BestRank.
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr" .
    ?subwayLine rdfs:label ?layer .
    ?pred rdfs:label ?predLabel .
    ?subwayLine_pred rdfs:label ?subwayLine_predLabel .
    ?towards rdfs:label ?towardsLabel.
    ?station rdfs:label ?stationLabel .
  } } GROUP BY ?station ?stationLabel  ?subwayLine_predLabel ?predLabel  ?towardsLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?coords_pred") v11("?dispar") v13("?interdit") v15("?layer") v4("?lignes") v10("?line_pq") v13("?node_pred") v14("?node_station") v8("?pred") v16("?predLabel"):::projected v6("?search") v7("?station"):::projected v19("?stationLabel"):::projected v3("?subwayLine") v5("?subwayLine_pred") v17("?subwayLine_predLabel"):::projected v2("?termini") v1("?towards") v18("?towardsLabel"):::projected a2((" ")) a1((" ")) c28(["#91;AUTO_LANGUAGE#93;,en,fr"]):::literal c5(["wd:Q928830"]):::iri c26(["bd:serviceParam"]):::iri c24(["wikibase:BestRank"]):::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 ?search/] bind3-->v6 bind30(["wd:Q462201"]) bind30 --> bind3 v6 --"p:direct/P527"--> v4 v4 --"p:direct/P559"--> v2 v7 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P16"--> v6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P361"--> v6 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P1192"--> v3 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P81"--> v3 end union1r <== or ==> union1l end v7 --"p:direct/P197"--> v8 v8 --"p:direct/P625"--> v9 subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P1192"--> v5 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P81"--> v5 end union2r <== or ==> union2l end v7 --"p:P197"--> a2 a2 --"p:statement/P197"--> v8 a2 --"p:qualifier/P5051"--> v1 subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; a2 --"p:qualifier/P1192"--> v10 end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; a2 --"p:qualifier/P81"--> v10 end union3r <== or ==> union3l end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; subgraph union5[" Union "] subgraph union5l[" "] style union5l fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P3999"--> v11 end subgraph union5r[" "] style union5r fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P582"--> v11 end union5r <== or ==> union5l end end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P576"--> v11 end union4r <== or ==> union4l end end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; subgraph union6[" Union "] subgraph union6l[" "] style union6l fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P5816"--> v13 end subgraph union6r[" "] style union6r fill:#abf,stroke-dasharray: 3 3; v7 --"p:direct/P5817"--> v13 end union6r <== or ==> union6l end bind6[/VALUES ?interdit/] bind6-->v13 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 bind68(["wd:Q104664889"]) bind68 --> bind6 bind69(["wd:Q110713763"]) bind69 --> bind6 end v8 --"p:P625"--> v13 v13 --"a"--> c24 v7 --"p:P625"--> v14 v14 --"a"--> c24 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c26 --"wikibase:language"--> c28 v3 --"rdfs:label"--> v15 v8 --"rdfs:label"--> v16 v5 --"rdfs:label"--> v17 v1 --"rdfs:label"--> v18 v7 --"rdfs:label"--> v19 end