query-bced7688b27379ab40b600ee7b264789

rq turtle/ttl

title: Position holder list with dates & party represented SELECT distinct ?itemLabel ?inicio ?fin ?partidoLabel ?inicio_partido ?fin_partido WHERE { values ?item {wd:Q484816 # values used to limit test items
wd:Q15397819
wd:Q96338578 wd:Q4060344}

?item wdt:P39 wd:Q2333371. # future filter

optional{ ?item wdt:P102 ?partido.} ?item p:P39 ?posicio. ?posicio ps:P39 wd:Q2333371. optional{?posicio pq:P580 ?inicio.} optional{?posicio pq:P582 ?fin.} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } order by asc(?item)

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#>
#title: Position holder list with dates & party represented
SELECT distinct ?itemLabel ?inicio ?fin ?partidoLabel ?inicio_partido ?fin_partido
WHERE {
values  ?item {wd:Q484816           # values used to limit test items       
               wd:Q15397819  
               wd:Q96338578 
               wd:Q4060344}
#  ?item wdt:P39 wd:Q2333371.       # future filter 
   optional{ ?item wdt:P102 ?partido.}
  ?item p:P39 ?posicio.
  ?posicio ps:P39 wd:Q2333371.
    optional{?posicio pq:P580 ?inicio.}
    optional{?posicio pq:P582 ?fin.}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
order by asc(?item)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?fin"):::projected v4("?inicio"):::projected v2("?item") v2("?partido") v3("?posicio") c8(["bd:serviceParam"]):::iri c10(["en"]):::literal c4(["wd:Q2333371"]):::iri bind0[/VALUES ?item/] bind0-->v2 bind00(["wd:Q484816"]) bind00 --> bind0 bind01(["wd:Q15397819"]) bind01 --> bind0 bind02(["wd:Q96338578"]) bind02 --> bind0 bind03(["wd:Q4060344"]) bind03 --> bind0 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P102".-> v2 end v2 --"p:P39"--> v3 v3 --"p:statement/P39"--> c4 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P580".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P582".-> v5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end