query-4ff050db49e9c87501094c8bfd9176e2
Biographies by centuryHello, I have made a query to search by century, but it uses math instead of a command (like year). Is it possible to have a search by century without doing math?
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 ?century (COUNT(?gizaki) as ?count) WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?gizaki wdt:P31 wd:Q5.
?gizaki wdt:P10242 ?Lur_Encyclopedic_Dictionary_ID.
?gizaki wdt:P569 ?jaiotza.
?gizaki wdt:P21 wd:Q6581097.
BIND(year(?jaiotza) as ?year).
FILTER(?year > 2)
BIND(FLOOR((?year - 1)/100) as ?c)
BIND((?m + 1) as ?century)
}
group by ?century
order by asc(?century)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?Lur_Encyclopedic_Dictionary_ID")
v6("?c")
v7("?century"):::projected
v7("?count")
v3("?gizaki"):::projected
v5("?jaiotza")
v6("?year")
c3(["bd:serviceParam"]):::iri
c7(["wd:Q5"]):::iri
c11(["wd:Q6581097"]):::iri
c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?year > '2^^xsd:integer'"]]
f0 --> v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end
v3 --"wdt:P31"--> c7
v3 --"wdt:P10242"--> v4
v3 --"wdt:P569"--> v5
v3 --"wdt:P21"--> c11
bind1[/"year-from-dateTime(?jaiotza)"/]
v5 --o bind1
bind1 --as--o v6
bind2[/"numeric-floor(?year - '1^^xsd:integer' / '100^^xsd:integer')"/]
v6 --o bind2
bind2 --as--o v6
bind3[/"?m + '1^^xsd:integer'"/]
null --o bind3
bind3 --as--o v7
bind5[/"count(?gizaki)"/]
v3 --o bind5
bind5 --as--o v7