Jump to content

Extension:WikidataShow

From mediawiki.org
MediaWiki extensions manual
WikidataShow
Release status: beta
Implementation Parser function
Description Allows to add data to a wiki page that were retrieved from Wikidata
Author(s) Julian Hocker (jhockerdipftalk)
Latest version 0.2 (2020-04-24)
MediaWiki 1.30+
Database changes No
License MIT License
Download
README
Example schularchive.bbf.dipf.de

The WikidataShow extension allows to add data to a wiki page that were retrieved from Wikidata.

It is basically developed for the School Archives Project and handles the following information from Wikidata. You can also use it as a blueprint to write your own extension to get data from Wikidata.

Supported items
  • P18 (picture)
  • P6375 (address)
  • P856 (website)
  • P625 (coordinates)
  • P1448 (names)
  • P1249 (earliest written record)
  • P571 (inception)
  • P31 (instance of)
  • P137 (operator)
  • Link to Wikipedia
  • P227: Link to GND (German national library)

The extension adds two parser functions:

  • #wikidatashow: creates a box like to one in the example
  • #wikidatashowlite: takes in the P value you want to show and only this information (if you want to display local data from Semantic MediaWiki together with data from wikidata)

Installation

[edit]
  • Add "freearhey/wikidata": "3.2" to the "require section of your wiki's "composer.local.json" file
  • Run composer update --no-dev
  • Download and place the file(s) in a directory called WikidataShow in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'WikidataShow' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage

[edit]

You can use the extension by simply adding the parser functions #wikidatashow or #wikidatashowlite to the wiki. You can provide the Wikidata ID, but you do not have to. If you do not provide the Wikidata ID, the extension tries to retrieve the Wikidata ID via the "Wikidata ID" property. You need to have Semantic MediaWiki installed for this feature of the extension to work.

Examples
  • {{#wikidatashowlite:P227|Q1533809}} -> gives you P227 of the wikidata ID Q1533809
  • {{#wikidatashowlite:P227}} --> gives you P227 and gets the wikidata ID automatically -> this makes it work very well inside a template
  • {{#wikidatashow:Q1533809}} -> gives you a box with all defined attributes for Q1533809
  • {{#wikidatashow:}} --> gives you the same box and gets wikidata ID automatically

Using #wikidatashow results in this infobox:

Example of the extension WikidataShow in action
Example of the extension WikidataShow in action

See also

[edit]