wikidata-api

Get all Wikidata items that are an instance of a given item

眉间皱痕 提交于 2019-11-30 20:21:42
Wikidata has an item called smartphone model . I want to get all instances of it. QUESTION: How to get the identifiers of the instances programmatically, using the live server? Preferably not including false positives that show up in WhatLinksHere but are in the "Wikidata:" namespace rather than the main namespace. Your question specifies the "Mediawiki API" but this is not possible. Wikidata has a SPARQL query service at https://query.wikidata.org The query that you want is: PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT DISTINCT ?item

Wikidata API wbsearchentities: why are results not the same in Python than in Wikidata?

亡梦爱人 提交于 2019-11-28 05:07:52
问题 I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python: url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission') r = requests.post(url,headers={"User-Agent" : "Magic Browser"}) returns nothing but the same search in the search box of Wikidata

How to get image URL property from Wikidata item by API?

為{幸葍}努か 提交于 2019-11-27 22:35:42
I've made an android app that uses the JSON Google image search API to provide images but I have noticed that Google have stopped supporting it. I have also discovered that Wikidata sometimes provides a image property on some items, however I can't seem to get the URL location of the image using the Wikidata API. Is there any way to get the image URL property from items in Wikidata? If some Wikidata item (with ID: Qxxx ) has image (P18) property, you can access it by MediaWiki API : https://www.wikidata.org/w/api.php?action=wbgetclaims&entity=Qxxx&property=P18 The response will include:

Getting readable results from Wikidata

你说的曾经没有我的故事 提交于 2019-11-26 20:27:16
问题 Ok so I'm trying to get information from Wikidata about movies, take this movie for example: https://www.wikidata.org/wiki/Q24871 On the page the data is clearly displayed in a readable format, however when you trying to extract it via the API you get this: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q24871 Here is a section from it: "P272": [ { "id": "q24871$4721C959-0FCF-49D4-9265-E4FAC217CB6E", "mainsnak": { "snaktype": "value", "property": "P272", "datatype": "wikibase