query-007a15b0da1569d22b8af08185dba954
Whose birthday is it today with a round number. e.g: 10, 20, 30 or 130 years SELECT ?birthdayboy ?birthdayboyLabel (YEAR(?date) AS ?year) ?date ?decade ?decaderounded WHERE { BIND(MONTH(NOW()) AS ?nowMonth) BIND(DAY(NOW()) AS ?nowDay) ?birthdayboy wdt:P569 ?date. BIND(((YEAR(NOW())-?year)/10) AS ?decade) BIND(ROUND((YEAR(NOW())-?year)/10) AS ?decaderounded) #Filter(?decade = ?decaderounded) #When I enable the filter it shows no matches at all. FILTER(((MONTH(?date)) = ?nowMonth) && ((DAY(?date)) = ?nowDay)) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT 10
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Whose birthday is it today with a round number. e.g: 10, 20, 30 or 130 years
SELECT ?birthdayboy ?birthdayboyLabel (YEAR(?date) AS ?year) ?date ?decade ?decaderounded
WHERE {
BIND(MONTH(NOW()) AS ?nowMonth)
BIND(DAY(NOW()) AS ?nowDay)
?birthdayboy wdt:P569 ?date.
BIND(((YEAR(NOW())-?year)/10) AS ?decade)
BIND(ROUND((YEAR(NOW())-?year)/10) AS ?decaderounded)
#Filter(?decade = ?decaderounded) #When I enable the filter it shows no matches at all.
FILTER(((MONTH(?date)) = ?nowMonth) && ((DAY(?date)) = ?nowDay))
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 10
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?birthdayboy"):::projected
v1("?date"):::projected
v5("?decade"):::projected
v6("?decaderounded"):::projected
v4("?nowDay")
v4("?nowMonth")
v7("?year")
c3(["bd:serviceParam"]):::iri
c5(["en"]):::literal
f0[["month-from-dateTime(?date) = ?nowMonthday-from-dateTime(?date) = ?nowDay"]]
f0 --> v1
f0 --> v4
f0 --> v4
bind1[/"month-from-dateTime(NOW())"/]
bind1 --as--o v4
bind2[/"day-from-dateTime(NOW())"/]
bind2 --as--o v4
v4 --"wdt:P569"--> v1
bind3[/"year-from-dateTime(NOW()) - ?year / '10^^xsd:integer'"/]
v7 --o bind3
bind3 --as--o v5
bind4[/"numeric-round(year-from-dateTime(NOW()) - ?year / '10^^xsd:integer')"/]
v7 --o bind4
bind4 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end
bind5[/"year-from-dateTime(?date)"/]
v1 --o bind5
bind5 --as--o v7