Wikibase/Extending

From mediawiki.org

Wikibase is a powerful and extensible piece of software, and a large amount of what it can do lies beyond the fairly stripped-down state Wikibase is in when you run your Docker images for the first time.

On this page you can take a quick, link-heavy tour of the resources available to help you extend your instance and give it the functionality you want and need it to have.

Templates[edit]

MediaWiki templates work a bit like text macros in that they contain content meant to be transcluded into other wiki pages. But their functionality can extend far beyond simple text replacement when scripting comes into play (see calling Lua modules).

To view the templates installed on your (or any) instance, navigate to <your Wikibase URL>/wiki/Special:AllPages?from=&to=&namespace=10.

While there is no single repository for MediaWiki templates, Wikipedia does offer a robust template resource page. You can find them easily by searching the web or by looking through what’s installed on any given instance of MediaWiki. When you find a template you want to use, follow these instructions to start using it on your instance.

Simple templates[edit]

A few templates that Wikibase users often find useful:

  • SPARQL - SPARQL query syntax highlighting
  • Q - creates a direct link to an item
  • Property - displays a localised label for a property

You can also check out this helpful third-party overview of templates: ryadel.com

Powerful templates[edit]

Templates can call modules written in the Lua scripting language, making them more powerful.

Primer to MediaWiki extensions[edit]

MediaWiki’s robust software ecosystem offers a wide range of extensions, pieces of code that modify how your installation looks and works. Extensions come in many shapes and sizes, from simple and useful tweaks to large modifications in functionality; as you probably know, Wikibase is itself an extension to MediaWiki. You can browse and download many of these extensions with the MediaWiki ExtensionDistributor. These install instructions should cover most cases, but some extensions have special instructions called out separately below.

To view the extensions you currently have installed, navigate to <your Wikibase URL>/wiki/Special:Version#mw-version-ext.

Extensions to Wikibase[edit]

This section gives an overview over the available MediaWiki extensions that can extend Wikibase. See also Category:Wikibase extensions .

Data quality[edit]

The following extensions help you manage the quality of your Wikibase data.

WikibaseQualityConstraints
A powerful extension that helps you impose constraints on your properties (which are actually more like guidelines) to improve the quality of your Wikibase data. See also the constraints portal which offers many constraints-oriented resources and tips on how to implement them effectively.
EntitySchema
Allows storing Shape Expressions Schemas on wiki pages (using ShExC syntax), as well as validating entities against those Schemas using the ShEx2 — Simple Online Validator.

More data types[edit]

See Category:WikibaseRepoDataTypes extensions and Category:WikibaseClientDataTypes extensions .

Importing data[edit]

See Wikibase/Importing .

Other extensions[edit]

PropertySuggester
Adds useful auto-suggestion of properties for manual edits.

Gadgets[edit]

Gadgets are small interface modifications that each user of an instance can choose to activate or deactivate for their own use. The Gadgets extension enables the use of gadgets (see below). You may well find that this extension is already installed on your instance, but make sure: it needs to be installed and enabled before implementing anything listed in the next section!

Some examples can be found in the MediaWiki gadget list and Wikidata’s installed gadgets. Here’s a guide to writing your own , and here’s how to install a gadget .

Other MediaWiki extensions[edit]

General utility[edit]

Content management and spam protection[edit]

  • Abuse Filter — create filters for editing to forestall abusive activity
  • Nuke — enable mass deletion of pages
  • Confirm Edit — add CAPTCHA checks before an edit is confirmed
  • Tor Block — restrict access for Tor exit nodes

Wikibase-specific[edit]

  • OAuth — implements OAuth, required for some tools to work correctly with Wikibase
  • CLDR — contains and manages locale-specific information regarding the display of data in different languages and formats
  • Universal Language Selector — allows users to configure an interface language of their choice

Other additions[edit]

As if templates, extensions and gadgets weren’t enough, there are many other ways you can customise your Wikibase installation. Here are some of the most commonly used.

Interface messages[edit]

As an administrator (with editInterface permissions), you can customise the messages displayed to the user by Wikibase. A complete list of them can be found on the Special:AllMessages page of your instance: <your instance URL>/wiki/Special:AllMessages

Consult the System message documentation for more information.

Sitelinks[edit]

Sitelinks allow Wikibase’s MediaWiki interface to link to other wikis in a more useful way than a simple hyperlink. A good example is the language selector on Wikipedia pages; it relies on sitelinks established to wikis in other languages.

Although the Docker images handle most of the config changes shown in the Wikibase install documentation, sitelinks are a notable exception.

To get sitelinks working, first work through the sitelinks section of the install doc. Then consult the sites table for further guidance.

Sorted properties and statements[edit]

By default, Wikibase displays content from queries and on entity/item pages in the order in which each item was added to the database. To make a change in the display order, you’ll need to use a sorted properties list.

Learn more about it on the Sorted Properties page, and check out Wikidata’s own Sorted Properties for inspiration.

Pywikibot[edit]

For more advanced users who seek tools to help them manage their data, there’s Pywikibot. It started life as a tool made for Wikipedia but was adapted to work on other Wikimedia projects, including Wikibase installations. Pywikibot amounts to a collection of scripts that can change and manipulate data programmatically, potentially saving large amounts of manual work.

Check out the third-party wiki quick start for Pywikibot to see if it might be right for your installation.