query-846cb3268917144329701b514491250f
TODO
Use at
- https://query.wikidata.org/sparql
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 pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?alcaldessa ?alcaldessaLabel ?carrec ?carrecLabel ?municipiLabel ?comarcaLabel ?inici ?fi ?inici_precision ?fi_precision
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 pqv:P580 ?inici_value.
?inici_value wikibase:timeValue ?inici.
?inici_value wikibase:timePrecision ?inici_precision.
}
OPTIONAL {
?st pqv:P582 ?fi_value.
?fi_value wikibase:timeValue ?fi.
?fi_value wikibase:timePrecision ?fi_precision.
}
FILTER ( !BOUND(?inici) ||
?inici_precision = 11 && ?inici < "2019-06-15"^^xsd:date ||
?inici_precision = 9 && ?inici < "2020-00-00"^^xsd:dat)
FILTER ( !BOUND(?fi) ||
?fi_precision = 11 && ?fi > "2015-06-13"^^xsd:date ||
?fi_precision = 9 && ?fi >= "2015-00-00"^^xsd:dat)
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;
v7("?alcaldessa"):::projected
v9("?carrec"):::projected
v11("?comarca")
v1("?comarcaLabel"):::projected
v12("?comarquesiaran")
v3("?fi"):::projected
v4("?fi_precision"):::projected
v14("?fi_value")
v5("?inici"):::projected
v6("?inici_precision"):::projected
v13("?inici_value")
v10("?municipi")
v2("?municipiLabel"):::projected
v8("?st")
c16(["wd:Q33146843"]):::iri
c10(["wd:Q6581072"]):::iri
c23(["bd:serviceParam"]):::iri
c8(["wd:Q5"]):::iri
c14(["wd:Q5663900"]):::iri
c25(["#91;AUTO_LANGUAGE#93;,ca,en"]):::literal
f0[["(not bound(?fi) || (?fi_precision = '11^^xsd:integer'?fi > '2015-06-13^^xsd:date' || ?fi_precision = '9^^xsd:integer'?fi >= s2015-00-00^^<http://www.w3.org/2001/XMLSchema#dat>'))"]]
f0 --> v3
f0 --> v4
f1[["(not bound(?inici) || (?inici_precision = '11^^xsd:integer'?inici < '2019-06-15^^xsd:date' || ?inici_precision = '9^^xsd:integer'?inici < s2020-00-00^^<http://www.w3.org/2001/XMLSchema#dat>'))"]]
f1 --> v5
f1 --> v6
v7 --"p:direct/P31"--> c8
v7 --"p:direct/P21"--> c10
v7 --"p:P39"--> v8
v8 --"p:statement/P39"--> v9
v9 --"p:direct/P279"--> c14
v9 --"p:direct/P1001"--> v10
v10 --"p:direct/P31"--> c16
v10 --"p:direct/P131"--> v11
bind2[/VALUES ?comarquesiaran/]
bind2-->v12
bind20(["wd:Q937876"])
bind20 --> bind2
bind21(["wd:Q19920968"])
bind21 --> bind2
v11 --"p:direct/P31"--> v12
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/value/P580".-> v13
v13 --"wikibase:timeValue"--> v5
v13 --"wikibase:timePrecision"--> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/value/P582".-> v14
v14 --"wikibase:timeValue"--> v3
v14 --"wikibase:timePrecision"--> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c23 --"wikibase:language"--> c25
end