query-471f6d24995abe712b6f789a09ebcdfd

rq turtle/ttl

:. I'm having difficulty with wdt:P31/wdt:P279. Presuming all positions are P279, then we /might/ be there.ValterVB@

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#>
SELECT distinct ?item ?itemLabel ?caricaLabel ?governoLabel ?inizio ?fine
WHERE 
{
  {
  ?item p:P39 ?statement .
  ?statement ps:P39 ?carica. 
  ?carica wdt:P279* wd:Q3858501.
  OPTIONAL{?statement pq:P5054 ?governo. }
  OPTIONAL{?statement pq:P580 ?inizio .}
  OPTIONAL{?statement pq:P582 ?fine .}
  }
UNION
 {
  ?item p:P39 ?statement .
  ?statement ps:P39 ?carica.
  ?statement ps:P39 wd:Q796897.
  OPTIONAL{?statement pq:P5054 ?governo. }
  OPTIONAL{?statement pq:P580 ?inizio .}
  OPTIONAL{?statement pq:P582 ?fine .}
 }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
}
ORDER BY ?caricaLabel ?inizio ?fine

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?carica") v1("?caricaLabel"):::projected v3("?fine"):::projected v7("?governo") v2("?inizio"):::projected v4("?item"):::projected v5("?statement") c10(["bd:serviceParam"]):::iri c4(["wd:Q3858501"]):::iri c8(["wd:Q796897"]):::iri c12(["it"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"p:P39"--> v5 v5 --"p:statement/P39"--> v6 v5 --"p:statement/P39"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P5054".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P580".-> v2 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P582".-> v3 end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"p:P39"--> v5 v5 --"p:statement/P39"--> v6 v6 --"p:direct/P279"--> c4 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P5054".-> v7 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P580".-> v2 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P582".-> v3 end end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end