通过wbgetentities搜索标签获取实体Wikidata的声明

我想知道最简单的方法是通过像这样的标签搜索从wikidata中获取数据:

API_ENDPOINT = "https://www.wikidata.org/w/api.php"
query = "cobalt-70"
params = {
    'action': 'wbsearchentities','format': 'json','language': 'en','type':'item','search': query
}
r = requests.get(API_ENDPOINT,params = params)


Output:

{'searchinfo': {'search': 'cobalt-70'},'search': [{'id': 'Q18844865','title': 'Q18844865','pageid': 20388165,'repository': 'local','url': '//www.wikidata.org/wiki/Q18844865','concepturi': 'http://www.wikidata.org/entity/Q18844865','label': 'cobalt-70','description': 'isotope of cobalt','match': {'type': 'label','text': 'cobalt-70'}},{'id': 'Q18880148','title': 'Q18880148','pageid': 20426734,'url': '//www.wikidata.org/wiki/Q18880148','concepturi': 'http://www.wikidata.org/entity/Q18880148','label': 'cobalt-70m','text': 'cobalt-70m'}}],'success': 1}

因此,我想通过在操作参数中使用“声明”来获取具有相同url请求的语句。 例如:

"P2114": [
                    {
                        "mainsnak": {
                            "snaktype": "value","property": "P2114","hash": "6f767f24024d5e0045afcf4d49d1a1b4dbc88fe5","datavalue": {
                                "value": {
                                    "amount": "+0.5","unit": "http://www.wikidata.org/entity/Q11574","upperBound": "+0.68","lowerBound": "+0.32"
                                },"type": "quantity"
                            },"datatype": "quantity"
                        },....

谢谢!

iCMS 回答:通过wbgetentities搜索标签获取实体Wikidata的声明

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2088468.html

大家都在问