This package is abandoned and no longer maintained. No replacement package was suggested.

Extension to Wikibase Repo that adds the ability to define and execute queries

Installs: 462

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 27

Forks: 2

Open Issues: 1


dev-master 2019-09-20 10:41 UTC

This package is not auto-updated.

Last update: 2020-03-06 15:52:56 UTC


This extension is no longer maintained nor developed.

Wikibase Query

Build Status Scrutinizer Code Quality

On Packagist: Latest Stable Version Download count

Wikibase Query adds query capabilities to Wikibase Repo. It is part of the Wikibase software.


You can use Composer to download and install this package as well as its dependencies. Alternatively you can simply clone the git repository and take care of loading yourself.


To add this package as a local, per-project dependency to your project, simply add a dependency on wikibase/query to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on Wikibase Query 1.0:

        "require": {
            "wikibase/query": "1.0.*"


To get a list of available CLI commands, execute this in the root directory:

php querycli

Technical documentation

All classes provided by WikibaseQuery reside in the Wikibase\Query namespace.

Public classes and interfaces have an @since tag denoting the version since which they can be accessed. Constructs without an @since tag are package private and should not be used by extensions.

Object graph construction is done via the dependency injection container defined in Wikibase\Query\DIC. Individual builders reside in Wikibase\Query\DIC\Builders. Builders are registered in Wikibase\Query\DIC\WikibaseQueryBuilder. All access to the DIC from outside the DIC happens via Wikibase\Query\DIC\WikibaseQuery. When requiring access to this class from a legacy API, the ExtensionAccess::getWikibaseQuery method should be used. Usage of this method is forbidden outside of legacy APIs in which we cannot achieve proper dependency construction.


This extension comes with a set up PHPUnit tests that cover all non-trivial code. The extension needs to be loaded via MediaWiki, after which the tests can be run via the MediaWiki test runner.

php phpunit.php -c ../../extensions/WikibaseQuery/

You might need to specify that MediaWiki should use normal tables

php phpunit.php -c ../../extensions/WikibaseQuery/ --use-normal-tables

If this does not work due to using PHPUnit 4.0 or later, you can temporarily modify your MediaWikis MediaWikiPHPUnitCommand.php file.


Wikibase Query has been written by the Wikidata team for the Wikidata project. You can view the full list of contributors.


See also

Bugs on Phabricator