query-52329ed4739db2778e9a2b5b0b83df06

rq turtle/ttl

TODO

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?w (COUNT(*) AS ?c) WHERE {
  {
    SELECT ?item ?title WHERE {
      ?item wdt:P31 wd:Q13442814;
            wdt:P1476 ?title.
      FILTER(STRLEN(?title) >= 10)
    }
    LIMIT 10000
  }
  BIND(REPLACE(?title, "^.*?(\\b\\w{10,}\\b).*$", "$1") AS ?w1)
  BIND(REPLACE(STRAFTER(?title, ?w1), "^.*?(\\b\\w{10,}\\b).*$", "$1") AS ?w2)
  BIND(REPLACE(STRAFTER(?title, ?w2), "^.*?(\\b\\w{10,}\\b).*$", "$1") AS ?w3)
  VALUES ?w_ { 1 2 3 }
  BIND(IF(?w_ = 1, ?w1, IF(?w_ = 2, ?w2, ?w3)) AS ?w)
  FILTER(REGEX(?w, "^\\w+$")) # no idea why this is necessary
}
GROUP BY ?w
ORDER BY DESC(?c)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?c") v4("?item") v3("?title") v9("?w"):::projected v5("?w1") v6("?w2") v7("?w3") v8("?w_") c4(["wd:Q13442814"]):::iri f0[["regex(?w,'^\w+$')"]] f0 --> v9 f1[["string-length(?title) >= '10^^xsd:integer'"]] f1 --> v3 v4 --"wdt:P31"--> c4 v4 --"wdt:P1476"--> v3 bind2[/"replace(?title,'^.*?(\b\w{10,}\b).*$','$1')"/] v3 --o bind2 bind2 --as--o v5 bind3[/"replace(substring-after(?title,?w1),'^.*?(\b\w{10,}\b).*$','$1')"/] v3 --o bind3 v5 --o bind3 bind3 --as--o v6 bind4[/"replace(substring-after(?title,?w2),'^.*?(\b\w{10,}\b).*$','$1')"/] v3 --o bind4 v6 --o bind4 bind4 --as--o v7 bind5[/VALUES ?w_/] bind5-->v8 bind50(["1^^xsd:integer"]) bind50 --> bind5 bind51(["2^^xsd:integer"]) bind51 --> bind5 bind52(["3^^xsd:integer"]) bind52 --> bind5 bind6[/"if(?w_ = '1^^xsd:integer',?w1,if(?w_ = '2^^xsd:integer',?w2,?w3))"/] v8 --o bind6 v5 --o bind6 v6 --o bind6 v7 --o bind6 bind6 --as--o v9 bind8[/"count(*)"/] bind8 --as--o v9