ppp / wikidataquery-api
用于与 WikidataQuery API 交互的库
1.4
2016-04-07 15:04 UTC
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-09-14 17:11:06 UTC
README
在Packagist上:
WikidataQueryApi 是WikidataQuery 工具的一个小型包装器。它仅支持查询语法的一个子集。
安装
使用以下方法之一
1 - 使用 composer 通过 master 分支安装库及其所有依赖项
composer require "ppp/wikidataquery-api":dev-master"
2 - 创建一个 composer.json 文件,只定义对该包版本 1.0 的依赖,然后在目录中运行 'composer install'
{
"require": {
"ppp/wikidataquery-api": "~1.0"
}
}
示例
以下是一个简单的使用示例
// 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' ) ); );