query-87afd818cdd06d9d5a738787a2ee154f

rq turtle/ttl

Mayors 15:01, 28 March 2020 (UTC)) talk (Davidpar for women mayors in Catalonia. I would like to have only the ones who served between 13.06.2015 and 15.06.2019. They could start from 2007 or 2018, or they could finish in 2017, but they should have served in some moment between these two dates. I don't know if it's possible... Thanks! --this queryHi! I have

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
SELECT ?alcaldessa ?alcaldessaLabel ?carrec ?carrecLabel ?municipiLabel ?comarcaLabel ?inici ?fi
    WHERE {
      ?alcaldessa wdt:P31 wd:Q5.
      ?alcaldessa wdt:P21 wd:Q6581072.
      ?alcaldessa p:P39 ?st . ?st ps:P39 ?carrec.
      ?carrec wdt:P279 wd:Q5663900.
      ?carrec wdt:P1001 ?municipi.
      ?municipi wdt:P31 wd:Q33146843.
      ?municipi wdt:P131 ?comarca.
      VALUES ?comarquesiaran {wd:Q937876 wd:Q19920968}
      ?comarca wdt:P31 ?comarquesiaran.
      OPTIONAL {?st pq:P580 ?inici.}
      OPTIONAL {?st pq:P582 ?fi.}
      FILTER ( !BOUND(?inici)   \u007C\u007C   ?inici < "2019-06-15"^^xsd:date  )  
      FILTER ( !BOUND(?fi)      \u007C\u007C   ?fi > "2015-06-13"^^xsd:date ) 
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en" .
    }
    }
ORDER BY ?comarcaLabel ?municipiLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?alcaldessa"):::projected v7("?carrec"):::projected v9("?comarca") v1("?comarcaLabel"):::projected v10("?comarquesiaran") v3("?fi"):::projected v4("?inici"):::projected v8("?municipi") v2("?municipiLabel"):::projected v6("?st") c12(["wd:Q33146843"]):::iri c10(["wd:Q5663900"]):::iri c19(["#91;AUTO_LANGUAGE#93;,ca,en"]):::literal c6(["wd:Q6581072"]):::iri c17(["bd:serviceParam"]):::iri c4(["wd:Q5"]):::iri f0[["(not bound(?fi) || ?fi > '2015-06-13^^xsd:date')"]] f0 --> v3 f1[["(not bound(?inici) || ?inici < '2019-06-15^^xsd:date')"]] f1 --> v4 v5 --"p:direct/P31"--> c4 v5 --"p:direct/P21"--> c6 v5 --"p:P39"--> v6 v6 --"p:statement/P39"--> v7 v7 --"p:direct/P279"--> c10 v7 --"p:direct/P1001"--> v8 v8 --"p:direct/P31"--> c12 v8 --"p:direct/P131"--> v9 bind2[/VALUES ?comarquesiaran/] bind2-->v10 bind20(["wd:Q937876"]) bind20 --> bind2 bind21(["wd:Q19920968"]) bind21 --> bind2 v9 --"p:direct/P31"--> v10 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P580".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P582".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c17 --"wikibase:language"--> c19 end