query-67b3a53aa466e5fc5565994a503f7cce

rq turtle/ttl

vots en capitals de comarca o > 25.000 habitants SELECT DISTINCT ?municipiLabel ?capital_deLabel ?poblacio ?emesos ?vots_PP ?vots_JUNTS ?vots_PSC ?vots_Cs ?vots_ERC ?vots_Comuns ?vots_VOX ?vots_CUP WHERE { ?item wdt:P361 wd:Q48838589; wdt:P1001 ?municipi. { ?municipi wdt:P1376 ?capital_de . ?capital_de wdt:P31 wd:Q937876 } UNION { ?item wdt:P361 wd:Q48838589; wdt:P1001 ?municipi. ?municipi wdt:P1082 ?poblacio. FILTER(?poblacio >= 25000) . } OPTIONAL { ?item wdt:P1868 ?emesos. } OPTIONAL { ?item p:P726?statement. ?statement ps:P726 wd:Q185088; pq:P1111 ?vots_PP.} OPTIONAL { ?item p:P726 ?statement1. ?statement1 ps:P726 wd:Q97155800; pq:P1111 ?vots_JUNTS.} OPTIONAL { ?item p:P726 ?statement2. ?statement2 ps:P726 wd:Q2055003; pq:P1111 ?vots_PSC. } OPTIONAL { ?item p:P726?statement3. ?statement3 ps:P726 wd:Q1393123; pq:P1111 ?vots_Cs.} OPTIONAL { ?item p:P726?statement4. ?statement4 ps:P726 wd:Q150068; pq:P1111 ?vots_ERC.} OPTIONAL { ?item p:P726?statement5. ?statement5 ps:P726 wd:Q104760756; pq:P1111 ?vots_Comuns.} OPTIONAL { ?item p:P726?statement6. ?statement6 ps:P726 wd:Q15630787; pq:P1111 ?vots_VOX.} OPTIONAL { ?item p:P726?statement7. ?statement7 ps:P726 wd:Q104760691; pq:P1111 ?vots_CUP.}

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
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#>
#vots en capitals de comarca o > 25.000 habitants
SELECT DISTINCT ?municipiLabel ?capital_deLabel ?poblacio ?emesos ?vots_PP
 ?vots_JUNTS  ?vots_PSC ?vots_Cs ?vots_ERC
 ?vots_Comuns  ?vots_VOX ?vots_CUP  WHERE {
      ?item wdt:P361 wd:Q48838589;
            wdt:P1001 ?municipi.
      {
      ?municipi wdt:P1376 ?capital_de .
      ?capital_de wdt:P31 wd:Q937876
      }
   UNION
   {
      ?item wdt:P361 wd:Q48838589;
            wdt:P1001 ?municipi.
      ?municipi wdt:P1082  ?poblacio.
   FILTER(?poblacio >= 25000) .
    }
    OPTIONAL { ?item wdt:P1868 ?emesos. }
  OPTIONAL { ?item p:P726?statement.
   ?statement ps:P726 wd:Q185088;
           pq:P1111 ?vots_PP.}
   OPTIONAL { ?item p:P726 ?statement1.
             ?statement1 ps:P726 wd:Q97155800;
           pq:P1111 ?vots_JUNTS.}
  OPTIONAL { ?item p:P726 ?statement2.
             ?statement2 ps:P726 wd:Q2055003;
           pq:P1111 ?vots_PSC. }
    OPTIONAL { ?item p:P726?statement3.
              ?statement3 ps:P726 wd:Q1393123;
           pq:P1111 ?vots_Cs.}
    OPTIONAL { ?item p:P726?statement4.
              ?statement4 ps:P726 wd:Q150068;
           pq:P1111 ?vots_ERC.}
    OPTIONAL { ?item p:P726?statement5.
              ?statement5 ps:P726 wd:Q104760756;
           pq:P1111 ?vots_Comuns.}
    OPTIONAL { ?item p:P726?statement6.
              ?statement6 ps:P726 wd:Q15630787;
           pq:P1111 ?vots_VOX.}
    OPTIONAL { ?item p:P726?statement7.
              ?statement7 ps:P726 wd:Q104760691;
           pq:P1111 ?vots_CUP.}

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?capital_de") v5("?emesos"):::projected v1("?item") v2("?municipi") v4("?poblacio"):::projected v6("?statement") v8("?statement1") v10("?statement2") v12("?statement3") v14("?statement4") v16("?statement5") v18("?statement6") v20("?statement7") v21("?vots_CUP"):::projected v17("?vots_Comuns"):::projected v13("?vots_Cs"):::projected v15("?vots_ERC"):::projected v9("?vots_JUNTS"):::projected v7("?vots_PP"):::projected v11("?vots_PSC"):::projected v19("?vots_VOX"):::projected c17(["wd:Q150068"]):::iri c16(["wd:Q1393123"]):::iri c20(["wd:Q104760691"]):::iri c14(["wd:Q97155800"]):::iri c12(["wd:Q185088"]):::iri c18(["wd:Q104760756"]):::iri c15(["wd:Q2055003"]):::iri c22(["bd:serviceParam"]):::iri c2(["wd:Q48838589"]):::iri c24(["#91;AUTO_LANGUAGE#93;,en"]):::literal c6(["wd:Q937876"]):::iri c19(["wd:Q15630787"]):::iri v1 --"p:direct/P361"--> c2 v1 --"p:direct/P1001"--> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["?poblacio >= '25000^^xsd:integer'"]] f0 --> v4 v1 --"p:direct/P361"--> c2 v1 --"p:direct/P1001"--> v2 v2 --"p:direct/P1082"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P1376"--> v3 v3 --"p:direct/P31"--> c6 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P1868".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v6 v6 --"p:statement/P726"--> c12 v6 --"p:qualifier/P1111"--> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v8 v8 --"p:statement/P726"--> c14 v8 --"p:qualifier/P1111"--> v9 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v10 v10 --"p:statement/P726"--> c15 v10 --"p:qualifier/P1111"--> v11 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v12 v12 --"p:statement/P726"--> c16 v12 --"p:qualifier/P1111"--> v13 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v14 v14 --"p:statement/P726"--> c17 v14 --"p:qualifier/P1111"--> v15 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v16 v16 --"p:statement/P726"--> c18 v16 --"p:qualifier/P1111"--> v17 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v18 v18 --"p:statement/P726"--> c19 v18 --"p:qualifier/P1111"--> v19 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P726".-> v20 v20 --"p:statement/P726"--> c20 v20 --"p:qualifier/P1111"--> v21 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c22 --"wikibase:language"--> c24 end