wikibase/import

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
There is no license information available for the latest version (0.1) of this package.

Import entities from another Wikibase instance (e.g. Wikidata)

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 25

Watchers: 6

Forks: 16

Open Issues: 30

Type:mediawiki-extension

0.1 2016-04-08 18:02 UTC

README

Build Status

WikibaseImport is a MediaWiki extension that provides a maintenance script for importing entities from another Wikibase instance. (e.. Wikidata)

The script imports the specified entity or entities, including statements, sitelinks, labels, descriptions and aliases. The extension tracks the newly assigned entity id and the original id, so that any other entity that references can be linked appropriately.

The script also imports any referenced entities (e.g. properties, badge items, wikibase-item values) without the statements.

Install

Clone https://github.com/filbertkm/WikibaseImport.git to the extensions folder of your MediaWiki instance.

Then go into the WikibaseImport extension directory and run composer update.

Then, to enable the extension, add it in your LocalSettings.php file:

wfLoadExtension( 'WikibaseImport' );

The extension requires a new database table to map entity ids from the foreign wiki to corresponding ids in the local wiki.

To add the table, run MediaWiki's update.php maintenance script.

Usage

First, navigate to WikibaseImport ’s extension folder.

Import a specific entity:

php maintenance/importEntities.php --entity Q147

Import a list of entities from a text file:

php maintenance/importEntities.php --file presidents.csv

You need to create the csv with a list of entity ids. For example, get a list of entity ids from a query (e.g. Wikidata sparql).

Import all properties:

php maintenance/importEntities.php --all-properties

Import Wikidata entities with specified property:entityId value pair:

php maintenance/importEntities.php --query P131:Q64

Import a range of entities:

php maintenance/importEntities.php --range Q1:Q20

Import a list of entities printed by another program:

printf 'Q%s\n' {1..20} {100..120} | php maintenance/importEntities.php --stdin