query-03dbf25d6e2a6a98725a9210e23f3d80
Propertiesinstance of (P31)Human Development Index (P1081)point in time (P585)
Use at
- https://query.wikidata.org/sparql
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#>
#defaultView:LineChart
# The following implementation was inspired by the code here: https://stackoverflow.com/questions/49066390/how-to-get-only-the-most-recent-value-from-a-wikidata-property
# Read https://en.wikipedia.org/wiki/Human_Development_Index for more on the Human Development Index.
SELECT ?year ?hdiValue ?country ?countryLabel WHERE {
?country wdt:P31 wd:Q6256.
OPTIONAL {
?country p:P1081 ?hdi.
?hdi pq:P585 ?hdiDate.
?hdi ps:P1081 ?hdiValue.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
BIND(STR(YEAR(?hdiDate)) AS ?year).
FILTER (?country IN (wd:Q33, wd:Q30, wd:Q148, wd:Q668, wd:Q851, wd:Q159, wd:Q20, wd:Q929))
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?country"):::projected
v2("?hdi")
v3("?hdiDate")
v4("?hdiValue"):::projected
v5("?year"):::projected
c15(["bd:serviceParam"]):::iri
c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c10(["wd:Q6256"]):::iri
list0c3(["wd:Q148"]):::iri
list0c6(["wd:Q159"]):::iri
list0c5(["wd:Q851"]):::iri
list0c4(["wd:Q668"]):::iri
list0c7(["wd:Q20"]):::iri
list0c2(["wd:Q30"]):::iri
list0c1(["wd:Q33"]):::iri
list0c8(["wd:Q929"]):::iri
list0c1 --o f0
list0c2 --o f0
list0c3 --o f0
list0c4 --o f0
list0c5 --o f0
list0c6 --o f0
list0c7 --o f0
list0c8 --o f0
f0[[" in "]]
f0 --> v1
v1 --"p:direct/P31"--> c10
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P1081".-> v2
v2 --"p:qualifier/P585"--> v3
v2 --"p:statement/P1081"--> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end
bind1[/"str(year-from-dateTime(?hdiDate))"/]
v3 --o bind1
bind1 --as--o v5