Citoid/Wikibase

From mediawiki.org

Installing Citoid with Wikibase, for developers[edit]

Manual[edit]

First, follow the installation instructions for Wikibase here: Wikibase/Installation

And install CirrusSearch, Citoid extension, and WikibaseCirrusSearch extension.

Vagrant[edit]

Alternatively, if you are a developer using vagrant, enable the following roles:

  • wikidata
  • wikibasecirrussearch

(but not citoid because it's broken in vagrant)

Just enabling the roles for wikidata typically fails, there are extra steps here: MediaWiki-Vagrant#wikidata

Due to issues with merging composer files, typically updating composer from inside the machine helps as well:

> vagrant ssh
> cd /vagrant/mediawiki
> composer update

Additional modifications need to be made to LocalSettings.php, whether you are installing manually or with vagrant:

LocalSettings.php[edit]

wfLoadExtension( 'Citoid' );
wfLoadExtension( 'WikibaseCirrusSearch' );

$wgWBCSUseCirrus = true;

$wgWBCitoidFullRestbaseURL = 'http://en.wikipedia.org/api/rest_'; // you can avoid setting up the service locally and just use this one

$wgWBRepoSettings['enableRefTabs'] = true;

$wgWBRepoSettings['searchIndexProperties'] = [ 'P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9', 'P10', 'P11', 'P12']; // Which properties to index will be covered later
$wgWBRepoSettings['searchIndexTypes'] = [ 'string', 'external-id', 'wikibase-item', 'wikibase-property' ];

Index / Re-index[edit]

To index or reindex the searchIndex:

created the index:

> mwscript extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php --wiki wikidatawiki

populated the index:

> mwscript extensions/CirrusSearch/maintenance/forceSearchIndex.php --wiki wikidatawiki

Configuring Citoid with Wikibase[edit]

Create the message MediaWiki:Citoid-wikibase-config.json. For example, if you are using vagrant, navigate to http://wikidata.wiki.local.wmftest.net:8080/wiki/MediaWiki:Citoid-wikibase-config.json.

There is a sample message on test and beta.

A minimally viable config message for developers is here: Citoid/Wikibase/Citoid-wikibase-config.json

This contains only two properties, one for DOI (P1) which is a string property, and one for "stated in" (P2) to point to entities which have a DOI. entityIdentifyingProperties are only used in wikibase instances that have WikibaseCirrusSearch enabled, and only work for properties which are indexed (corresponding to P1 in this example.)

If you have a new environment you may need to manually create properties. i.e in vagrant: http://wikidata.wiki.local.wmftest.net:8080/wiki/Special:NewProperty

Important: only non-wikibase entity properties should be added to the "zoteroProperties" block, i.e. string, monolingual snak, etc. Entity properties should only be added to the entityIdentifyingProperties block.