本文介绍了如何在Wikidata上获取所有电影的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当时正在使用Freebase将所有电影/电影放到我的网站上,但是很快就会关闭.所以我在寻找另一个免费的电影数据库,并遇到了Wikidata.老实说,要了解如何查询所有电影太复杂了.

I was using Freebase to get all movies/films there for my website, but it's getting shut down soon. so I was searching for another free database for movies and came across Wikidata. To be honest it's too complicated to understand how to query all the movies.

所以我想你们可以帮助我在Wikidata中获取所有电影.将来我也希望包括电视节目和电视剧.

So I thought you guys could help me to get all the movies in Wikidata. In the future I want to include TV shows and series as well.

编程语言无关紧要,我想使用带有链接的网络查询.

Programming language doesn't matter, I want to use web query with a link.

推荐答案

您可以查找作为电影实例的所有实体,在Wikidata中将其翻译为:

you can look for all the entities that are an instance of film, which in Wikidata is translated as:

P31 (实例)-> Q11424 (电影)

P31 (instance of) -> Q11424 (film)

目前,执行此查询的最佳方法是使用wdq.wmflabs.org API,该查询的翻译方式为:http://wdq.wmflabs.org/api?q=claim[31:11424](避免在浏览器中进行此查询,因为它可能会因崩溃而崩溃到).在撰写本文时,此请求以数字ID(例如:125)的形式返回了157038个项目.要获取Wikidata ID,只需添加前导Q-> Q125.

For the moment, the best way to do this query is to use the wdq.wmflabs.org API, where this query translate as: http://wdq.wmflabs.org/api?q=claim[31:11424] (avoid making this query in a browser as it will probably make it crash due to the ). At the moment I'm writting, this requests returns 157038 items in the form of numeric ids (ex: 125). To get the Wikidata ids, just add a leading Q -> Q125.

要从所有这些Wikidata ID中获取标签和数据,请使用Wikidata API wbgetentities操作:https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q180736&format=json&languages=en.不过要提防每个查询最多50个实体

To get the labels and data from all those Wikidata ids, use the Wikidata API wbgetentities action: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q180736&format=json&languages=en.Beware of the 50 entities per-query limit though

[更新] Wikidata现在提供了 SPARQL 端点:在SPARQL中使用相同的查询,甚至是查询相同,但还包括电影的子类

[UPDATE] Wikidata now offers a SPARQL endpoints: the same query in SPARQL or even this same query but also including subclasses of films

这篇关于如何在Wikidata上获取所有电影的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-07 15:02