query-24a6d13aa235280bb60d4ca6b8c225c5
How many words to check )?wordcount(DESC ORDER BY ?wordcount GROUP BY } )?wordcount as +1)?test(strlen - ))?title(str(strlen(BIND )?test as )"" ," " ),?title(str(REPLACE(BIND ) "en" = )?title(lang(FILTER . ?title P1476:wdt ; Q202864:wd P921:wdt [] { )?titles_count as )?title(COUNT( ?wordcount SELECT #How many words are in these titles:
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?wordcount (COUNT(?title) as ?titles_count)
{
{ ?a wdt:P921 wd:Q84263196 } UNION { ?a wdt:P921 wd:Q81068910 } UNION { ?a wdt:P921 wd:Q1134583 }
?a wdt:P1476 ?title .
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;
v2("?a")
v4("?test")
v3("?title"):::projected
v5("?titles_count")
v5("?wordcount"):::projected
c2(["wd:Q84263196"]):::iri
c3(["wd:Q81068910"]):::iri
c4(["wd:Q1134583"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P921"--> c4
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P921"--> c3
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P921"--> c2
end
union0r <== or ==> union0l
end
v2 --"wdt:P1476"--> v3
bind0[/"replace(str(?title),' ','')"/]
v3 --o bind0
bind0 --as--o v4
bind1[/"string-length(str(?title)) - string-length(?test) + '+1^^xsd:integer'"/]
v3 --o bind1
v4 --o bind1
bind1 --as--o v5
bind3[/"count(?title)"/]
v3 --o bind3
bind3 --as--o v5