### getLemmas example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Returns a list of tables, each with lemma text and language code. Example shows output on Wikidata. ```lua mw.wikibase.getEntity( 'L1' ):getLemmas() -- Returns { { 'ama', 'mis-x-Q36790' }, { '𒂼', 'mis-x-Q401' } } on Wikidata ``` -------------------------------- ### Install composer dependencies Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Install all composer dependencies for the MediaWiki instance using the mwcli tool. ```bash $ mw dev mediawiki composer install ``` -------------------------------- ### form:getRepresentations() example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the representation(s) of the Form as a list of tables, each with text and language. Example call returns { { 'Luftballon', 'de' } }. ```lua form:getRepresentations() -- example: { { 'Luftballon', 'de' } } ``` -------------------------------- ### Install npm dependencies Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Install npm dependencies using mwcli fresh to enable node development tools and scripts. ```bash $ mw dev mediawiki fresh npm install ``` -------------------------------- ### getLemma example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Returns lemma and language as two strings, or nil if not found. Language fallbacks are not applied. Example shows calls with and without language code. ```lua mw.wikibase.getEntity( 'L1' ):getLemma( 'mis-x-Q36790' ) -- Returns 'ama', 'mis-x-Q36790' on Wikidata mw.wikibase.getEntity( 'L99' ):getLemma() -- Returns 'Luftballon', 'de' on German Wiktionary ``` -------------------------------- ### getForms example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Returns a list of Form entities for the Lexeme. ```lua mw.wikibase.getEntity( 'L1' ):getForms() -- Returns a table of Form entities ``` -------------------------------- ### Run QUnit tests with grunt karma Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Run all QUnit JavaScript tests of the MediaWiki installation using the MediaWiki test runner. Execute this command from the main directory of the MediaWiki installation. ```bash mw dev mediawiki fresh npx grunt karma ``` -------------------------------- ### getSenses example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Returns a list of Sense entities for the Lexeme. ```lua mw.wikibase.getEntity( 'L1' ):getSenses() -- Returns a table of Sense entities ``` -------------------------------- ### form:getRepresentation( 'de' ) example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the representation in the given language, or content language if none given. Returns two strings or nil. Language fallbacks are not applied. ```lua form:getRepresentation( 'de' ) -- example: 'Luftballon', 'de' ``` -------------------------------- ### Get all glosses with sense:getGlosses Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the gloss(es) of this Sense as a list of tables, each with the gloss text as the first element and the gloss language as the second. ```lua sense:getGlosses() -- example: { { 'a rubber sack designed to be inflated with air', 'en' } } ``` -------------------------------- ### form:getGrammaticalFeatures() example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the grammatical features of the Form as a list of item IDs. Example call returns { 'Q110786', 'Q131105' }. ```lua form:getGrammaticalFeatures() -- example: { 'Q110786', 'Q131105' } ``` -------------------------------- ### mw.wikibase.lexeme.entity.sense:getGlosses Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets all glosses of a Sense entity. ```APIDOC ## getGlosses() ### Description Gets the gloss(es) of this Sense, as a list of tables where each table has the gloss text as the first element and the gloss language as the second. ### Method N/A (Lua function) ### Endpoint N/A (Lua function) ### Parameters None. ### Request Example ```lua sense:getGlosses() ``` ### Response #### Success Response - **list** - A list of tables, each containing the gloss text and language. #### Response Example ```lua { { 'a rubber sack designed to be inflated with air', 'en' } } ``` ``` -------------------------------- ### Clone WikibaseLexeme repository Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Clone the WikibaseLexeme repository into the extensions directory of your local MediaWiki installation. ```bash $ cd /extensions $ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseLexeme.git ``` -------------------------------- ### Get gloss in a language with sense:getGloss Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the gloss of this Sense in the given language, or in the content language if no language is given. Returns the gloss and its language as two strings if the Sense has a gloss in this language, or nil otherwise. Language fallbacks are not applied. ```lua sense:getGloss( 'en' ) -- example: 'a rubber sack designed to be inflated with air', 'en' ``` -------------------------------- ### getLanguage example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Returns the Item ID of the language of the Lexeme. ```lua mw.wikibase.getEntity( 'L1' ):getLanguage() -- Returns 'Q36790' on Wikidata ``` -------------------------------- ### getLexicalCategory example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Returns the Item ID of the lexical category of the Lexeme. ```lua mw.wikibase.getEntity( 'L1' ):getLexicalCategory() -- Returns 'Q1084' on Wikidata ``` -------------------------------- ### mw.wikibase.lexeme.entity.lexeme:getSenses Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the Senses of a Lexeme as a list of Sense entities. ```APIDOC ## mw.wikibase.lexeme.entity.lexeme:getSenses ### Description Gets the Senses of this Lexeme, as a list of Sense entities. ### Method Function call ### Endpoint `entity:getSenses()` ### Parameters None ### Request Example ```lua mw.wikibase.getEntity( 'L1' ):getSenses() ``` ### Response #### Success Response - Returns a table of Sense entities. #### Response Example ```lua -- Returns a table of Sense entities ``` ``` -------------------------------- ### mw.wikibase.lexeme.entity.form:getRepresentations Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the representation(s) of this Form as a list of tables, each containing the representation text and language. ```APIDOC ## mw.wikibase.lexeme.entity.form:getRepresentations ### Description Gets the representation(s) of this Form as a list of tables, each containing the representation text and language. ### Method Function call ### Endpoint `entity:getRepresentations()` ### Parameters None ### Request Example ```lua form:getRepresentations() ``` ### Response #### Success Response - Returns a list of tables, each with the representation text as the first element and the language as the second. #### Response Example ```lua { { 'Luftballon', 'de' } } ``` ``` -------------------------------- ### Set environment variables for Cypress tests Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/cypress/README.md Exports required environment variables for running Cypress tests against a local MediaWiki install. Optionally set WIKIBASE_PROPERTY_STRING to an existing property with datatype 'string' to avoid creating new properties on each test run. ```bash export MW_SERVER=http://default.mediawiki.mwdd.localhost:8080/ export MW_SCRIPT_PATH=w/ export MEDIAWIKI_USER=an_admin_username export MEDIAWIKI_PASSWORD=the_password_for_that_user # (Optional) Set the ID of an existing property with `string` as its datatype. # This avoids creating new properties on every test run. export WIKIBASE_PROPERTY_STRING=P444 ``` -------------------------------- ### mw.wikibase.lexeme.entity.lexeme:getForms Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the Forms of a Lexeme as a list of Form entities. ```APIDOC ## mw.wikibase.lexeme.entity.lexeme:getForms ### Description Gets the Forms of this Lexeme, as a list of Form entities. ### Method Function call ### Endpoint `entity:getForms()` ### Parameters None ### Request Example ```lua mw.wikibase.getEntity( 'L1' ):getForms() ``` ### Response #### Success Response - Returns a table of Form entities. #### Response Example ```lua -- Returns a table of Form entities ``` ``` -------------------------------- ### mw.wikibase.lexeme.entity.lexeme:getLemmas Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the lemma(s) of a Lexeme entity as a list of tables. ```APIDOC ## mw.wikibase.lexeme.entity.lexeme:getLemmas ### Description Gets the lemma(s) of this Lexeme, as a list of tables where each table has the lemma text as the first element and the lemma language as the second. ### Method Function call ### Endpoint `entity:getLemmas()` ### Parameters None ### Request Example ```lua mw.wikibase.getEntity( 'L1' ):getLemmas() ``` ### Response #### Success Response - Returns a list of tables, each containing the lemma text and language. #### Response Example ```lua { { 'ama', 'mis-x-Q36790' }, { '𒂼', 'mis-x-Q401' } } ``` ``` -------------------------------- ### mw.wikibase.lexeme.entity.lexeme:getLanguage Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the Item ID of the language of a Lexeme. ```APIDOC ## mw.wikibase.lexeme.entity.lexeme:getLanguage ### Description Gets the Item ID of the language of this Lexeme. ### Method Function call ### Endpoint `entity:getLanguage()` ### Parameters None ### Request Example ```lua mw.wikibase.getEntity( 'L1' ):getLanguage() ``` ### Response #### Success Response - Returns the Item ID of the language. #### Response Example ```lua 'Q36790' ``` ``` -------------------------------- ### mw.wikibase.lexeme.entity.sense:getGloss Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets a specific gloss of a Sense entity in a given language. ```APIDOC ## getGloss( languageCode ) ### Description Gets the gloss of this Sense in the given language, or in the content language if no language is given. Returns the gloss and its language as two strings if the Sense has a gloss in this language, or nil otherwise. Language fallbacks are not applied. ### Method N/A (Lua function) ### Endpoint N/A (Lua function) ### Parameters - **languageCode** (string) - Optional - The language code to get the gloss in. If omitted, the content language is used. ### Request Example ```lua sense:getGloss( 'en' ) ``` ### Response #### Success Response - **gloss** (string) - The gloss text. - **language** (string) - The language code of the gloss. #### Response Example ```lua 'a rubber sack designed to be inflated with air', 'en' ``` ``` -------------------------------- ### mw.wikibase.lexeme.splitLexemeId example Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Splits a Lexeme, Sense, or Form ID into its Lexeme ID part and optional Sense/Form ID part. Returns two strings for Sense/Form IDs, one string for Lexeme IDs, and nil otherwise. ```lua l, s = mw.wikibase.lexeme.splitLexemeId( 'L1-S1' ) -- returns 'L1' and 'S1' ``` -------------------------------- ### mw.wikibase.lexeme.entity.lexeme:getLexicalCategory Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the Item ID of the lexical category of a Lexeme. ```APIDOC ## mw.wikibase.lexeme.entity.lexeme:getLexicalCategory ### Description Gets the Item ID of the lexical category of this Lexeme. ### Method Function call ### Endpoint `entity:getLexicalCategory()` ### Parameters None ### Request Example ```lua mw.wikibase.getEntity( 'L1' ):getLexicalCategory() ``` ### Response #### Success Response - Returns the Item ID of the lexical category. #### Response Example ```lua 'Q1084' ``` ``` -------------------------------- ### mw.wikibase.lexeme.entity.form:getRepresentation Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the representation of this Form in a given language, or the content language if none is given. Returns the representation and language as two strings, or nil if not available. ```APIDOC ## mw.wikibase.lexeme.entity.form:getRepresentation ### Description Gets the representation of this Form in the given language, or in the content language if no language is given. Returns the representation and its language as two strings if the Form has a representation in this language, or nil otherwise. Language fallbacks are not applied. ### Method Function call ### Endpoint `entity:getRepresentation()` `entity:getRepresentation( languageCode )` ### Parameters #### Optional Parameters - **languageCode** (string) - Optional - The language code to get the representation in. ### Request Example ```lua form:getRepresentation( 'de' ) ``` ### Response #### Success Response - Returns two strings: the representation and its language. #### Response Example ```lua 'Luftballon', 'de' ``` #### Error Response - Returns nil if the Form has no representation in the given language. ``` -------------------------------- ### mw.wikibase.lexeme.entity.lexeme:getLemma Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the lemma of a Lexeme in a specified language or the content language. ```APIDOC ## mw.wikibase.lexeme.entity.lexeme:getLemma ### Description Gets the lemma of this Lexeme in the given language, or in the content language if no language is given. Returns the lemma and its language as two strings if the lexeme has a lemma in this language, or nil otherwise. Language fallbacks are not applied. ### Method Function call ### Endpoint `entity:getLemma()` `entity:getLemma( languageCode )` ### Parameters #### Optional Parameters - **languageCode** (string) - Optional - The language code to get the lemma in. ### Request Example ```lua mw.wikibase.getEntity( 'L1' ):getLemma( 'mis-x-Q36790' ) mw.wikibase.getEntity( 'L99' ):getLemma() ``` ### Response #### Success Response - Returns the lemma and its language as two strings, or nil if not found. #### Response Example ```lua 'ama', 'mis-x-Q36790' 'Luftballon', 'de' ``` ``` -------------------------------- ### mw.wikibase.lexeme.entity.form:getGrammaticalFeatures Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Gets the grammatical features of this Form as a list of item IDs. ```APIDOC ## mw.wikibase.lexeme.entity.form:getGrammaticalFeatures ### Description Gets the grammatical features of this Form as a list of item IDs. ### Method Function call ### Endpoint `entity:getGrammaticalFeatures()` ### Parameters None ### Request Example ```lua form:getGrammaticalFeatures() ``` ### Response #### Success Response - Returns a list of item IDs. #### Response Example ```lua { 'Q110786', 'Q131105' } ``` ``` -------------------------------- ### Check grammatical feature with form:hasGrammaticalFeature Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Tests whether this Form has the given grammatical feature. The example call returns true for the given item ID. ```lua form:hasGrammaticalFeature( 'Q110786' ) -- example: true ``` -------------------------------- ### Initialize git submodules Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Initialize and update all git submodules for the WikibaseLexeme extension. ```bash $ cd WikibaseLexeme $ git submodule update --init --recursive ``` -------------------------------- ### Run PHP tests with mwcli Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Run PHP unit tests for the WikibaseLexeme extension using the mwcli Docker development environment. The command executes composer phpunit in the MediaWiki container, targeting the extension's test directory. ```bash mw dev mediawiki exec -- composer phpunit /path/to/mw/extensions/WikibaseLexeme ``` -------------------------------- ### Enable WikibaseLexeme in LocalSettings.php Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Add this line to LocalSettings.php to enable the WikibaseLexeme extension in MediaWiki. ```php wfLoadExtension( 'WikibaseLexeme' ); ``` -------------------------------- ### Run Jasmine tests with grunt jasmine_nodejs Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Run Jasmine tests from the WikibaseLexeme main directory using the mwcli fresh environment. These tests do not require MediaWiki. ```bash mw dev mediawiki fresh npx grunt jasmine_nodejs ``` -------------------------------- ### Build and copy submodule for development Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Builds and copies the current state of the new-lexeme submodule for development. After running, visit Special:NewLexeme on your wiki to see the result. ```bash mw dev mediawiki fresh npm run snl:dev ``` -------------------------------- ### Open Cypress GUI Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/cypress/README.md Opens the Cypress interactive GUI using the npm script 'cypress:open'. ```bash npm run cypress:open ``` -------------------------------- ### Run linters and tests with composer test and grunt test Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Run all linters and tests: the first command runs PHP code checks, the second runs the JavaScript part. Both are provided as the easiest way to execute the provided configuration files. ```bash mw dev mediawiki composer test ``` ```bash mw dev mediawiki fresh grunt test ``` -------------------------------- ### Set language to Q666 in change request Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/change-op-serialization.md Adds a "language" key with an item ID string. The item should be about a language, but not enforced. Cannot be null or empty. ```json { ... "language": "Q666" ... } ``` -------------------------------- ### Enable REST API dev routes Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Enables REST API routes in development. Not recommended for production use. ```php $wgRestAPIAdditionalRouteFiles[] = 'extensions/WikibaseLexeme/src/MediaWiki/RestApi/routes.dev.json'; ``` -------------------------------- ### Set lemma for language 'en' to 'colour' Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/change-op-serialization.md Uses a "lemmas" map keyed by language code. Each entry requires "language" and "value" to set, or "language" and "remove" to remove. Empty string as value also removes. ```json { ... "lemmas": { "en": { "language": "en", "value": "colour" }, } ... } ``` -------------------------------- ### Run Cypress tests in terminal Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/cypress/README.md Executes the Cypress test suite in a terminal using the npm script 'cypress:run'. ```bash npm run cypress:run ``` -------------------------------- ### Update New Lexeme submodule and build Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Updates the new-lexeme submodule to the latest main branch and adds a new build to Git, ready to be committed. Run from time to time, but not necessarily for every new commit in the submodule. Must be run outside a container. ```bash npm run bump-special-new-lexeme ``` -------------------------------- ### Set lexical category to Q42 in change request Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/change-op-serialization.md Adds a "lexicalCategory" key with an item ID string. The item should be about a lexical category, but not enforced. Cannot be null or empty. ```json { ... "lexicalCategory": "Q42" ... } ``` -------------------------------- ### Rebuild OpenAPI fragment Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/README-dev.md Rebuilds the committed, self-contained OpenAPI fragment after editing spec modules. Prints the fragment to the gitignored openapi.fragment.generated.json and dereferences it into openapi.fragment.dereferenced.json, which is committed and must be kept in sync with its sources. Run in the container as `mw dev mw fresh -- npm run spec:fragment`. ```bash npm run spec:fragment ``` -------------------------------- ### Language Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/change-op-serialization.md Sets the language of a Lexeme by providing an item ID. ```APIDOC ## Language ### Description Sets the language of a Lexeme by providing an item ID. ### Method Not applicable (part of change request JSON) ### Endpoint Not applicable (part of change request JSON) ### Parameters #### Request Body - **language** (string) - Required - The ID of an existing item representing a language (e.g., "Q666"). Cannot be null or empty. ### Request Example { "language": "Q666" } ### Response Not applicable (change request data) ``` -------------------------------- ### Lemmas Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/change-op-serialization.md Defines lemma data for a Lexeme using a map of language codes to lemma changes. ```APIDOC ## Lemmas ### Description Defines lemma data for a Lexeme using a map of language codes to lemma changes. ### Method Not applicable (part of change request JSON) ### Endpoint Not applicable (part of change request JSON) ### Parameters #### Request Body - **lemmas** (object) - Required - An associative array indexed by language codes. Each element specifies a change: - To set a lemma: provide "language" and "value" elements. - To remove a lemma: provide "language" and "remove" elements (content of "remove" is irrelevant, typically empty string). - Alternatively, provide an empty string as "value" to remove. ### Request Example { "lemmas": { "en": { "language": "en", "value": "colour" } } } ### Response Not applicable (change request data) ``` -------------------------------- ### Forms JSON structure Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/json.md Shows the structure of the forms array in a Lexeme JSON object. Each form has an id, representations (structured like lemmas), grammaticalFeatures (Item IDs), and claims. ```json { "forms": [ { "id": "L1347-F1", "representations": { "en-gb": { "language": "en-gb", "value": "colour" }, "en-ca": { "language": "en-ca", "value": "colour" }, "en-us": { "language": "en-us", "value": "color" } }, "grammaticalFeatures": [ "Q110786" ], "claims": {} }, { "id": "L1347-F2", "representations": { "en-gb": { "language": "en-gb", "value": "colours" }, "en-ca": { "language": "en-ca", "value": "colours" }, "en-us": { "language": "en-us", "value": "colors" } }, "grammaticalFeatures": [ "Q146786" ], "claims": {} } ] } ``` -------------------------------- ### Language and lexical category JSON Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/json.md Represents the language and lexical category of a Lexeme using their respective Item IDs. ```json { "lexicalCategory": "Q1084", "language": "Q1860" } ``` -------------------------------- ### Senses JSON structure Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/json.md Shows the structure of the senses array in a Lexeme JSON object. Each sense has an id, glosses (structured like lemmas), and claims (statements in the usual Wikibase structure). ```json { "senses": [ { "id": "L1347-S1", "glosses": { "en": { "language": "en", "value": "visual perception of light wavelengths" }, "es": { "language": "es", "value": "percepción visual de las longitudes de onda de la luz visible" } }, "claims": { "P5137": [ { "mainsnak": { "snaktype": "value", "property": "P5137", "hash": "20be8699148157ed9ca7aae29324c34cc6ab4a08", "datavalue": { "value": { "entity-type": "item", "numeric-id": 1075, "id": "Q1075" }, "type": "wikibase-entityid" }, "datatype": "wikibase-item" }, "type": "statement", "id": "L1347-S1$F4D34950-4431-4AC0-8883-0C728C7860EA", "rank": "normal" } ] } } ] } ``` -------------------------------- ### Lemmas JSON structure Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/json.md Shows the structure of the lemmas field in a Lexeme JSON object. Each language variant is an object keyed by language code with fields 'language' and 'value'. ```json { "lemmas": { "en-gb": { "language": "en-gb", "value": "colour" }, "en-ca": { "language": "en-ca", "value": "colour" }, "en-us": { "language": "en-us", "value": "color" } } } ``` -------------------------------- ### Lexical category Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/change-op-serialization.md Sets the lexical category of a Lexeme by providing an item ID. ```APIDOC ## Lexical category ### Description Sets the lexical category of a Lexeme by providing an item ID. ### Method Not applicable (part of change request JSON) ### Endpoint Not applicable (part of change request JSON) ### Parameters #### Request Body - **lexicalCategory** (string) - Required - The ID of an existing item representing a lexical category (e.g., "Q42"). Cannot be null or empty. ### Request Example { "lexicalCategory": "Q42" } ### Response Not applicable (change request data) ``` -------------------------------- ### mw.wikibase.lexeme.splitLexemeId Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Splits a Lexeme, Sense, or Form ID into the Lexeme ID part and, if present, the Sense or Form ID part. Returns two strings for Sense or Form IDs, one string for Lexeme IDs, and nil otherwise. ```APIDOC ## mw.wikibase.lexeme.splitLexemeId ### Description Splits a Lexeme, Sense, or Form ID into the Lexeme ID part and (if present) the Sense or Form ID part. Returns two strings for Sense or Form IDs, one string for Lexeme IDs, and nil otherwise. ### Method Function ### Endpoint mw.wikibase.lexeme.splitLexemeId( id ) ### Parameters - **id** (string) - Required - The Lexeme, Sense, or Form ID to split. ### Returns - For Sense or Form IDs: two strings (Lexeme ID and Sense/Form ID). - For Lexeme IDs: one string (Lexeme ID). - Otherwise: nil. ### Example lua l, s = mw.wikibase.lexeme.splitLexemeId( 'L1-S1' ) -- returns 'L1' and 'S1' ``` -------------------------------- ### mw.wikibase.lexeme.entity.form:hasGrammaticalFeature Source: https://github.com/wikimedia/mediawiki-extensions-wikibaselexeme/blob/master/docs/topics/lua.md Tests whether a Form entity has a given grammatical feature. ```APIDOC ## hasGrammaticalFeature( itemId ) ### Description Tests whether this Form has the given grammatical feature or not. ### Method N/A (Lua function) ### Endpoint N/A (Lua function) ### Parameters - **itemId** (string) - Required - The ID of the grammatical feature item to test for. ### Request Example ```lua form:hasGrammaticalFeature( 'Q110786' ) ``` ### Response #### Success Response - **boolean** - Whether the Form has the grammatical feature. #### Response Example ```lua true ``` ```