query-1497f841eeeec5cb51afe688e34bffff
How to get the timePrecision associated with a Point in Time for a population statement?. I'm stuck on how to get the precision associated with each population statement. How to fix my attempt? (Q671480)Albany I'm trying to query all the populations for
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#>
SELECT ?geoEntity ?geoEntityLabel ?population ?date ?datePrecision WHERE {
BIND(wd:Q671480 AS ?geoEntity)
?geoEntity p:P1082 ?populationStatement.
?populationStatement ps:P1082 ?population.
?populationStatement pq:P585 ?date.
# how to get datePrecision
OPTIONAL {
?date wikibase:timePrecision ?datePrecision. # precision of at least year
?date wikibase:timeValue ?dateValue.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?date"):::projected
v5("?datePrecision"):::projected
v6("?dateValue")
v1("?geoEntity"):::projected
v3("?population"):::projected
v2("?populationStatement")
c7(["bd:serviceParam"]):::iri
c9(["en"]):::literal
bind0[/"'wd:Q671480'"/]
bind0 --as--o v1
v1 --"p:P1082"--> v2
v2 --"p:statement/P1082"--> v3
v2 --"p:qualifier/P585"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wikibase:timePrecision".-> v5
v4 --"wikibase:timeValue"--> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end