query-8a057c0e88279db1df492f4715506b10
How many words are in these titles: SELECT ?wordcount (COUNT(?title) as ?titles_count) { [] wdt:P921 wd:Q202864 ; wdt:P1476 ?title . FILTER(lang(?title) = "en" ) BIND(REPLACE(str(?title), " ", "") as ?test) BIND(strlen(str(?title)) - strlen(?test)+1 as ?wordcount) } GROUP BY ?wordcount ORDER BY DESC(?wordcount)
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#How many words are in these titles:
SELECT ?wordcount (COUNT(?title) as ?titles_count)
{
[] wdt:P921 wd:Q202864 ; wdt:P1476 ?title .
FILTER(lang(?title) = "en" )
BIND(REPLACE(str(?title), " ", "") as ?test)
BIND(strlen(str(?title)) - strlen(?test)+1 as ?wordcount)
}
GROUP BY ?wordcount
ORDER BY DESC(?wordcount)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?test")
v2("?title"):::projected
v4("?titles_count")
v4("?wordcount"):::projected
a1((" "))
c3(["wd:Q202864"]):::iri
f0[["?title = 'en'"]]
f0 --> v2
a1 --"wdt:P921"--> c3
a1 --"wdt:P1476"--> v2
bind1[/"replace(str(?title),' ','')"/]
v2 --o bind1
bind1 --as--o v3
bind2[/"string-length(str(?title)) - string-length(?test) + '+1^^xsd:integer'"/]
v2 --o bind2
v3 --o bind2
bind2 --as--o v4
bind4[/"count(?title)"/]
v2 --o bind4
bind4 --as--o v4