query-b4e676fc2797a61f76d8383942feeb89

rq turtle/ttl

TEMPLATE={ "template": { "en": "Longest lexemes in ?language where all letters are in alphabetical order (A-Z only, no repeated letters)." }, "variables": { "?language": { "query": "SELECT ?id WHERE { ?lexeme dct:language ?id. } GROUP BY ?id ORDER BY DESC(COUNT()) LIMIT 50" } } } PREFIX dct: http://purl.org/dc/terms/ # workaround for T233148 SELECT ?lexeme ?lemma (STRLEN(?lemma) AS ?length) WHERE { BIND(wd:Q1860 AS ?language) ?lexeme dct:language ?language; wikibase:lemma ?lemma. FILTER(STRLEN(?lemma) >= 5) # first version allows repeated letters, second one doesn’t # FILTER(REGEX(?lemma, "^ABCDEFGHIJKLMNOPQRSTUVQXYZ*$", "i")) FILTER(REGEX(?lemma, "^A?B?C?D?E?F?G?H?I?J?K?L?M?N?O?P?Q?R?S?T?U?V?Q?X?Y?Z?$", "i")) } ORDER BY DESC(?length)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
#TEMPLATE={ "template": { "en": "Longest lexemes in ?language where all letters are in alphabetical order (A-Z only, no repeated letters)." }, "variables": { "?language": { "query": "SELECT ?id WHERE { ?lexeme dct:language ?id. } GROUP BY ?id ORDER BY DESC(COUNT(*)) LIMIT 50" } } }
PREFIX dct: <http://purl.org/dc/terms/> # workaround for T233148
SELECT ?lexeme ?lemma (STRLEN(?lemma) AS ?length) WHERE {
  BIND(wd:Q1860 AS ?language)
  ?lexeme dct:language ?language;
          wikibase:lemma ?lemma.
  FILTER(STRLEN(?lemma) >= 5)
  # first version allows repeated letters, second one doesn’t
  # FILTER(REGEX(?lemma, "^A*B*C*D*E*F*G*H*I*J*K*L*M*N*O*P*Q*R*S*T*U*V*Q*X*Y*Z*$", "i"))
  FILTER(REGEX(?lemma, "^A?B?C?D?E?F?G?H?I?J?K?L?M?N?O?P?Q?R?S?T?U?V?Q?X?Y?Z?$", "i"))
}
ORDER BY DESC(?length)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?language") v2("?lemma"):::projected v5("?length") v4("?lexeme"):::projected f0[["regex(?lemma,'^A?B?C?D?E?F?G?H?I?J?K?L?M?N?O?P?Q?R?S?T?U?V?Q?X?Y?Z?$','i')"]] f0 --> v2 f1[["string-length(?lemma) >= '5^^xsd:integer'"]] f1 --> v2 bind2[/"'wd:Q1860'"/] bind2 --as--o v3 v4 --"dct:language"--> v3 v4 --"wikibase:lemma"--> v2 bind3[/"string-length(?lemma)"/] v2 --o bind3 bind3 --as--o v5