Wikibase Query adds query capabilities to Wikibase Repo.
Features:
- New Query page type that allows people to define queries (in the Query namespace by default).
- Query execution against a query engine that returns a query result
- PHP 5.3 or later
- Wikibase DataModel 0.5 or later
- Wikibase Repo 0.5 or later
- Wikibase QueryEngine 0.1 or later
- Ask 1.x
- DataValues 0.1 or later
- Serialization 2.x
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.*"
}
}
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 library comes with a set up PHPUnit tests that cover all non-trivial code. You can run these tests using the PHPUnit configuration file found in the root directory. The tests can also be run via TravisCI, as a TravisCI configuration file is also provided in the root directory.
Wikibase Query has been written by Jeroen De Dauw as Wikimedia Germany employee for the Wikidata project.