query-2d060421599c3a1a36fd71141d75323f
TODO
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 bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?éclipse ?date
?decade_min
(if(?decade_min = ?decade_max_ , ?decade_max_ + 10 , ?decade_max_) as ?decade_max)
WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?éclipse (wdt:P31/(wdt:P279*)) wd:Q3887; wdt:P585 ?date.
bind (year(?date) as ?éclipse_year) .
bind ( (floor( ?éclipse_year / 10)) * 10 AS ?decade_min)
bind ( (ceil( ?éclipse_year / 10)) * 10 AS ?decade_max_)
} order by abs(?decade_min) ?date
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?date"):::projected
v6("?decade_max")
v5("?decade_max_"):::projected
v5("?decade_min"):::projected
v3("?éclipse"):::projected
v4("?éclipse_year")
a1((" "))
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c7(["wd:Q3887"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c7
v3 --"wdt:P585"--> v2
bind0[/"year-from-dateTime(?date)"/]
v2 --o bind0
bind0 --as--o v4
bind1[/"numeric-floor(?éclipse_year / '10^^xsd:integer') * '10^^xsd:integer'"/]
v4 --o bind1
bind1 --as--o v5
bind2[/"numeric-ceil(?éclipse_year / '10^^xsd:integer') * '10^^xsd:integer'"/]
v4 --o bind2
bind2 --as--o v5
bind3[/"if(?decade_min = ?decade_max_,?decade_max_ + '10^^xsd:integer',?decade_max_)"/]
v5 --o bind3
v5 --o bind3
bind3 --as--o v6