Extension:WikiLexicalData

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
WikiLexicalData

Release status: beta

Implementation API, Ajax
Description Allows users to add structured data to wiki pages, and store them in a structured database.
Author(s) Erik Möller, Kim Bruning, Kip (maintainer) and others
MediaWiki 1.21
Database changes Yes
License GNU General Public License 2.0 or later
Download
Example OmegaWiki.org
Hooks used
AbortMove

ArticleFromTitle
BeforePageDisplay
CustomEditor
GetPreferences
MediaWikiPerformAction
NamespaceIsMovable
SearchGetNearMatchBefore
SkinTemplateNavigation
SpecialSearchNogomatch

Translate the WikiLexicalData extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Phabricator:

Open tasks · Report a bug

In a standard MediaWiki installation, all the text of a page is entered in one field, and stored in one entry of the database (page_text).

WikiLexicalData (previously named Wikidata) allows to configure some namespaces to use several fields of different types (text, Combobox, etc.) on one wikipage and to store these fields in a structured database.

OmegaWiki is the only implementation of WikiLexicalData so far. The structured database used at OmegaWiki is explained at http://www.omegawiki.org/Help:OmegaWiki_database_layout

Requirements[edit | edit source]

Installation[edit | edit source]

You can either install with an existing copy of a WikiLexicalData database (for example with the OmegaWiki database, see [1] ), or install from scratch on any MediaWiki installation, as explained below.

  1. Checkout a copy of the latest "WikiLexicalData" extension
  2. In order to create the tables in the database relating to WikiLexicalData
    go to /extensions/WikiLexicalData/Console
    run php install.php --prefix=uw --template=databaseTemplate.sql --datasetname="OmegaWiki community"
    you can change the prefix and the datasetname to whatever you like. It has not been tested, but it should work...

Configuration[edit | edit source]

  • Edit you LocalSettings.php and add,
require_once("$IP/extensions/WikiLexicalData/App.php");

$wgCapitalLinks = false;

$wgExtraNamespaces = array(
        16 => 'Expression',
        17 => 'Expression_talk',
        24 => 'DefinedMeaning',
        25 => 'DefinedMeaning_talk',
);

$wdHandlerPath = "$IP/extensions/WikiLexicalData/OmegaWiki/";
$wdHandlerClasses = array(
        24 => 'DefinedMeaning',
        16 => 'OmegaWiki',
);
  • Also add the following (the numbers may vary), as suggested by the install script:
$wgDefaultClassMids = array(37);
$wgIso639_3CollectionId = 35;
  • $wgDefaultClassMids should correspond to the DM number of the expression called "lexical item".
    If you have bureaucrat rights (or other rights, see below to modify the "editClassAttributes" right), you can add annotations that will be available for all languages, by editing that DM in the Section "Class attributes". For example:
    - Level: SynTrans , Attribute: IPA , Type: Plain Text. Note: you have to define the word "IPA" first
    - Level: SynTrans , Attribute: etymology , Type: Translatable Text.
    - Level: SynTrans , Attribute: part of speech , Type: Option list.
    - Level: DefinedMeaning , Attribute: image , Type: Link.

Further configuration[edit | edit source]

Languages[edit | edit source]

  • To add other languages
    • Use the language manager ( Special:Languages )
    • If you add a DM for that language, and add it to the "ISO 639-3 collection" with its ISO code, it will be used to translate the language name according to the interface language ( Use Special:ImportLangNames ).

User rights[edit | edit source]

Default user rights are as follows:

$wgGroupPermissions['wikidata-omega']['editwikidata-uw'] = true;
$wgGroupPermissions['wikidata-omega']['deletewikidata-uw'] = true;
$wgGroupPermissions['wikidata-copy']['wikidata-copy'] = true;
$wgGroupPermissions['wikidata-omega']['wikidata-copy'] = true;
$wgGroupPermissions['bureaucrat']['languagenames'] = true;
$wgGroupPermissions['bureaucrat']['addlanguage'] = true;
$wgGroupPermissions['bureaucrat']['addcollection'] = true;
$wgGroupPermissions['bureaucrat']['editClassAttributes'] = true;
$wgGroupPermissions['bureaucrat']['exporttsv'] = true;
$wgGroupPermissions['bureaucrat']['importtsv'] = true;
  • 'editwikidata-uw': rights to edit the lexical data pages and add new data. This permission can be given to anonymous users.
  • 'deletewikidata-uw': rights to modify existing data, such as change a definition or remove a translation.
  • 'addlanguage': rights to add new languages via Special:Languages.
  • 'languagenames': rights to update the translations via Special:ImportLangNames.
  • 'addcollection': rights to add a collection via Special:AddCollection.
  • 'editClassAttributes': rights to add attributes to a class.

Sorting[edit | edit source]

To have proper sorting of diacritics, such as "é" between "e" and "f", you might have to add this to your LocalSettings.php:

  • setlocale(LC_COLLATE, 'en_US.utf-8');

Search suggest[edit | edit source]

To have the search suggestion use the expression namespace instead of the article namespace:

  • edit /resources/mediawiki/mediawiki.searchSuggest.js
  • replace namespace: 0 with namespace: 16.

Notes[edit | edit source]

  • It is possible to use WikiLexicalData for something else than OmegaWiki (e.g. Wikispecies, Wikicommons, or any other very structured data). However, since WikiLexicalData was developed mainly with OmegaWiki in mind, it would need some work to separate what is specific to OmegaWiki from what could be reused in another project.
  • MySQL and SQLite have been tested. Other database backends might work.

See also[edit | edit source]