User:TweetsFactsAndQueries/Queries/Tolkien plurals

From Wikidata
Revision as of 16:41, 6 April 2024 by TweetsFactsAndQueries (talk | contribs) (initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Originally posted on Twitter and on Mastodon.

SELECT ?lexeme ?singular ?plural ?tolkienPlural WHERE {
  ?lexeme dct:language wd:Q1860;
          wikibase:lexicalCategory wd:Q1084;
          ontolex:lexicalForm ?singularForm, ?pluralForm.
  ?singularForm wikibase:grammaticalFeature wd:Q110786;
                ontolex:representation ?singular.
  ?pluralForm wikibase:grammaticalFeature wd:Q146786;
              ontolex:representation ?plural.
  FILTER(STRENDS(?singular, "f"))
  FILTER(STRENDS(?plural, "fs"))
  BIND(STRLANG(CONCAT(IF(STRENDS(?plural, "ffs"), SUBSTR(?plural, 1, STRLEN(?plural) - 3), SUBSTR(?plural, 1, STRLEN(?plural) - 2)), "ves"), LANG(?plural)) AS ?tolkienPlural)
  MINUS {
    ?lexeme ontolex:lexicalForm ?tolkienPluralForm.
    ?tolkienPluralForm wikibase:grammaticalFeature wd:Q146786;
                       ontolex:representation ?tolkienPlural.
  }
}
ORDER BY MD5(?singular)
Try it!