query-842426513f35a223d044715feb57074d

rq turtle/ttl

Presidents of the Republic of Lithuania

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#>
#title:Presidents of the Republic of Lithuania
#defaultView:Table
SELECT DISTINCT ?item ?itemLabel ?positionLabel ?start ?end WHERE
{
  ?item wdt:P31 wd:Q5 ;
        p:P39 ?position_statement .
  ?position_statement ps:P39 ?position ;
                      pq:P580 ?start FILTER (?start >= "1919-01-01T00:00:00Z"^^xsd:dateTime) .
  ?position wdt:P279* wd:Q878222 .
  OPTIONAL { ?position_statement pq:P582 ?x }
  OPTIONAL { ?item wdt:P18 ?picture }
  bind(if(bound(?x), ?x, NOW()) as ?end )
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
ORDER BY ASC(?start) ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?end"):::projected v3("?item"):::projected v2("?itemLabel"):::projected v7("?picture") v5("?position") v4("?position_statement") v1("?start"):::projected v6("?x") c8(["wd:Q878222"]):::iri c12(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?start >= '1919-01-01T00:00:00Z^^xsd:dateTime'"]] f0 --> v1 v3 --"p:direct/P31"--> c3 v3 --"p:P39"--> v4 v4 --"p:statement/P39"--> v5 v4 --"p:qualifier/P580"--> v1 v5 --"p:direct/P279"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P582".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P18".-> v7 end bind1[/"if(bound(?x),?x,NOW())"/] v6 --o bind1 bind1 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end