query-db33675b3ca0b59c7d35ca7b2719d14b

rq turtle/ttl

End date with precision limited to year (and not day+month)Hello I've come across this query and for a specific case use [BIND(wd:Q4337360 AS ?siège)], the result are disappointing because of this : , it's confusing. Is there a way for P582 to behave as if it was December 31th ?(P582)end time However, when it comes to an For a start date, OK, makes sense. if a date has only year level precision, the calculations will assume it will be at January 1st.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?siège ?siègeLabel (sample(?whereLabel) as ?whereLabel2) ?start ?end ?days {
SELECT ?siège ?siègeLabel ?whereLabel ?start ?end ?days WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?siège wdt:P31 wd:Q188055.
 BIND(wd:Q4337360 AS ?siège)
OPTIONAL { ?siège wdt:P580 ?start. }
OPTIONAL { ?siège wdt:P582 ?end. }
OPTIONAL { ?siège wdt:P276 ?where. } 
OPTIONAL { ?siège p:P2047/psn:P2047/wikibase:quantityAmount ?lengthNorm.}
BIND(COALESCE(?lengthNorm/86400,(?end - ?start+1)) as ?days)

}
}
group by ?siège ?siègeLabel ?start ?end ?days
order by desc(year(?end)) ?whereLabel2

Query found at