ppp / wikidataquery-api
A lib to interact with the WikidataQuery API
Installs: 2 129
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 8
Forks: 2
Open Issues: 0
Requires
- php: >=5.5.0
- data-values/geo: ~1.0
- data-values/number: ~0.6
- data-values/time: ~0.8
- guzzlehttp/guzzle: ~6.1
- serialization/serialization: ~3.0
- wikibase/data-model: ~6.0|~5.0|~4.0
This package is not auto-updated.
Last update: 2024-11-09 17:55:58 UTC
README
On Packagist:
WikidataQueryApi is a small wrapper for the WikidataQuery tool. It only supports a subset of the query syntax.
Installation
Use one of the below methods:
1 - Use composer to install the library and all its dependencies using the master branch:
composer require "ppp/wikidataquery-api":dev-master"
2 - Create a composer.json file that just defines a dependency on version 1.0 of this package, and run 'composer install' in the directory:
{
"require": {
"ppp/wikidataquery-api": "~1.0"
}
}
Example
Here is a small usage example:
// Load everything require_once( __DIR__ . '/vendor/autoload.php' ); // Initialise HTTP connection $api = new WikidataQueryApi( 'https://wdq.wmflabs.org/api' ); // Build helper tools $wikidataQueryFactory = new WikidataQueryFactory( $api ); $simpleQueryService = $wikidataQueryFactory->newSimpleQueryService(); //Do a query that returns a list of ItemId //This query finds all the children (P40) of Charlemagne (Q3044) $itemIds = $simpleQueryService->doQuery( new ClaimQuery( new PropertyId( 'P17' ), new ItemId( 'Q3044' ) ); );