query-297d94753737982d2a30af33974bc8a7
ambassadors to Argentina
select ?person ?personLabel ?startyear ?endyear where { ?person p:P39 ?positionStatement . ?positionStatement ps:P39 wd:Q29898729 . # held position of Ambassador to Argentina
optional { ?positionStatement pq:P580 ?start . bind(year(?start) as ?startyear) } # id start year optional { ?positionStatement pq:P582 ?end . bind(year(?end) as ?endyear) } # id end year SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } order by ?startyear
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
# ambassadors to Argentina
select ?person ?personLabel ?startyear ?endyear where
{
?person p:P39 ?positionStatement . ?positionStatement ps:P39 wd:Q29898729 . # held position of Ambassador to Argentina
optional { ?positionStatement pq:P580 ?start . bind(year(?start) as ?startyear) } # id start year
optional { ?positionStatement pq:P582 ?end . bind(year(?end) as ?endyear) } # id end year
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by ?startyear
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?end")
v6("?endyear"):::projected
v2("?person"):::projected
v3("?positionStatement")
v4("?start")
v5("?startyear"):::projected
c3(["wd:Q29898729"]):::iri
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v4
bind0[/"year-from-dateTime(?start)"/]
v4 --o bind0
bind0 --as--o v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v5
bind1[/"year-from-dateTime(?end)"/]
v5 --o bind1
bind1 --as--o v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end