Wikibase extension that allows defining RDF mappings for Wikibase Entities.
Professional.Wiki created and maintains Wikibase RDF. We provide Wikibase hosting, Wikibase development and Wikibase consulting.
The Wikibase Stakeholder Group concieved and funded the extension.
Table of Contents
When the extension is enabled, Item and Property pages show a "Mapping to other ontologies" section. This section is located in between the "In more languages" and "Statements" sections.
Users with editing permissions can add, edit or remove mappings.
A mapping consists of a predicate and a URL. The predicate can only be one out of a preconfigured set of values. The URL has to be a valid URL.
Mapping predicates can be configured via the MediaWiki:MappingPredicates
page by anyone with interface-admin permissions.
You can also configure mapping predicates via PHP Configuration.
This extension provides REST API endpoints for getting and setting the RDF mappings for a Wikibase entity.
For more information, refer to the REST API documentation.
Platform requirements:
- PHP 8.0 or later (tested up to 8.1)
- MediaWiki 1.37 or later (tested up to 1.37)
- Wikibase 1.37 or later (tested up to 1.37)
The recommended way to install Wikibase RDF is using Composer with MediaWiki's built-in support for Composer.
On the commandline, go to your wikis root directory. Then run these two commands:
COMPOSER=composer.local.json composer require --no-update professional-wiki/wikibase-rdf:~1.0
composer update professional-wiki/wikibase-rdf --no-dev -o
Then enable the extension by adding the following to the bottom of your wikis LocalSettings.php file:
wfLoadExtension( 'WikibaseRDF' );
You can verify the extension was enabled successfully by opening your wikis Special:Version page in your browser.
Configuration can be changed via LocalSettings.php.
List of allowed predicates.
Variable: $wgWikibaseRdfPredicates
Default: []
Example:
$wgWikibaseRdfPredicates = [
'owl:sameAs',
'owl:SymmetricProperty',
'rdfs:subClassOf',
'rdfs:subPropertyOf',
];
You can also configure what predicates are allowed via the MediaWiki:MappingPredicates
page.
To ensure the dev dependencies get installed, have this in your composer.local.json
:
{
"require": {
"vimeo/psalm": "^4",
"phpstan/phpstan": "^1.4.9"
},
"extra": {
"merge-plugin": {
"include": [
"extensions/WikibaseRDF/composer.json"
]
}
}
}
You can use the Makefile
by running make commands in the WikibaseRDF
directory.
make ci
: Run everythingmake test
: Run all testsmake cs
: Run all style checks and static analysis
Alternatively, you can execute commands from the MediaWiki root directory:
- PHPUnit:
php tests/phpunit/phpunit.php -c extensions/WikibaseRDF/
- Style checks:
vendor/bin/phpcs -p -s --standard=extensions/WikibaseRDF/phpcs.xml
- PHPStan:
vendor/bin/phpstan analyse --configuration=extensions/WikibaseRDF/phpstan.neon --memory-limit=2G
- Psalm:
php vendor/bin/psalm --config=extensions/WikibaseRDF/psalm.xml
- Added translations for various languages
- Added notification about SPARQL store behavior that shows on first edit
Initial release for Wikibase 1.37 with these features:
- Ability to add mappings to Items and Properties via an on-page UI
- Inclusion of mappings in the RDF output
- Configurable relationships (predicates), including configuration UI on
MediaWiki:MappingPredicates
- API endpoint to retrieve or update the mappings for an Entity
- API endpoint to retrieve all mappings defined on the wiki
- TranslateWiki integration
- Support for PHP 8.0 and 8.1