https://github.com/professionalwiki/wikibaserdf
Wikibase extension that allows defining RDF mappings for Wikibase Entities
https://github.com/professionalwiki/wikibaserdf
mediawiki mediawiki-extension rdf wikibase wikibase-extension
Last synced: 4 months ago
JSON representation
Wikibase extension that allows defining RDF mappings for Wikibase Entities
- Host: GitHub
- URL: https://github.com/professionalwiki/wikibaserdf
- Owner: ProfessionalWiki
- License: gpl-2.0
- Created: 2022-06-01T12:37:45.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-09T12:10:44.000Z (5 months ago)
- Last Synced: 2024-12-20T09:07:22.677Z (4 months ago)
- Topics: mediawiki, mediawiki-extension, rdf, wikibase, wikibase-extension
- Language: PHP
- Homepage: https://rdf.wikibase.wiki
- Size: 282 KB
- Stars: 14
- Watchers: 8
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wikibase RDF
[](https://github.com/ProfessionalWiki/WikibaseRDF/actions?query=workflow%3ACI)
[](https://shepherd.dev/github/ProfessionalWiki/WikibaseRDF)
[](psalm.xml)
[](https://packagist.org/packages/professional-wiki/wikibase-rdf)
[](https://packagist.org/packages/professional-wiki/wikibase-rdf)
[](LICENSE)[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**
- [Usage](#usage)
* [REST API](#rest-api)
- [Installation](#installation)
- [PHP Configuration](#php-configuration)
- [Development](#development)
- [Release notes](#release-notes)## Usage
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](#php-configuration).
### REST API
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](docs/rest.md).
## Installation
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][Composer install].On the commandline, go to your wikis root directory. Then run these two commands:
```shell script
COMPOSER=composer.local.json composer require --no-update professional-wiki/wikibase-rdf:~1.0
```
```shell script
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:
```php
wfLoadExtension( 'WikibaseRDF' );
```You can verify the extension was enabled successfully by opening your wikis Special:Version page in your browser.
## PHP Configuration
Configuration can be changed via [LocalSettings.php].
### Allowed predicates
List of allowed predicates.
Variable: `$wgWikibaseRdfPredicates`
Default: `[]`
Example:
```php
$wgWikibaseRdfPredicates = [
'owl:sameAs',
'owl:SymmetricProperty',
'rdfs:subClassOf',
'rdfs:subPropertyOf',
];
```You can also configure what predicates are allowed via the `MediaWiki:MappingPredicates` page.
## Development
To ensure the dev dependencies get installed, have this in your `composer.local.json`:
```json
{
"require": {
"vimeo/psalm": "^4",
"phpstan/phpstan": "^1.4.9"
},
"extra": {
"merge-plugin": {
"include": [
"extensions/WikibaseRDF/composer.json"
]
}
}
}
```### Running tests and CI checks
You can use the `Makefile` by running make commands in the `WikibaseRDF` directory.
* `make ci`: Run everything
* `make test`: Run all tests
* `make cs`: Run all style checks and static analysisAlternatively, 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`## Release notes
### Version 1.1.0 - 2022-11-25
* Added translations for various languages
* Added notification about SPARQL store behavior that shows on first edit### Version 1.0.0 - 2022-10-04
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[Professional.Wiki]: https://professional.wiki
[Wikibase]: https://wikibase.consulting/what-is-wikibase/
[Wikibase hosting]: https://professional.wiki/en/hosting/wikibase
[Wikibase development]: https://professional.wiki/en/wikibase-software-development
[Wikibase consulting]: https://wikibase.consulting/
[MediaWiki]: https://www.mediawiki.org
[PHP]: https://www.php.net
[Composer]: https://getcomposer.org
[Composer install]: https://professional.wiki/en/articles/installing-mediawiki-extensions-with-composer
[LocalSettings.php]: https://www.pro.wiki/help/mediawiki-localsettings-php-guide
[Wikibase Stakeholder Group]:https://wbstakeholder.group/