query-397bf53c1b4eb703b49b3e67a6801d45

rq turtle/ttl

TODO

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 ?pres ?presLabel ?start ?end (MAX(?death) AS ?deathL) WHERE {
  ?pres wdt:P31 wd:Q5;
    p:P39 ?position_held_statement.
  ?position_held_statement ps:P39 wd:Q3662240.
  OPTIONAL { ?position_held_statement pq:P580 ?start. }
  OPTIONAL { ?position_held_statement pq:P582 ?end. }
#  OPTIONAL { ?pres wdt:P570 ?death. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?pres ?presLabel ?start ?end
ORDER BY (?start)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?death"):::projected v6("?deathL") v4("?end"):::projected v3("?position_held_statement") v2("?pres"):::projected v1("?start"):::projected c9(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c11(["en"]):::literal c5(["wd:Q3662240"]):::iri v2 --"p:direct/P31"--> c2 v2 --"p:P39"--> v3 v3 --"p:statement/P39"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P580".-> v1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P582".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind1[/"max(?death)"/] v5 --o bind1 bind1 --as--o v6