如何从YouTube视频中查询带有Freebase ID的Wikidata? [英] How can I query wikidata with a freebase id from a youtube video?

查看:181
本文介绍了如何从YouTube视频中查询带有Freebase ID的Wikidata?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 youtube API 来检索freebase主题特定视频的详细信息.由于 freebase即将关闭我该如何使用

I am using the youtube API to retrieve the freebase topic details of particular videos. Since freebase is closing down how do I use wikidata to query for a specific topic id?

例如,以下主题ID /m/0181lj应提供以下信息

For example the following topic id /m/0181lj should give the following information

我尝试使用 wikidata REST API ,但我还没有找不到符合我需求的请求.

I have tried playing with the wikidata REST API but I haven't found a request which matches what I need.

更新

Freebase已发布了知识图,使您可以通过topicId进行查询如此

Freebase have released the Knowledge graph which allows you to query via topicId as so

但是,某些ID似乎没有返回数据,例如以下音乐流派/m/05fqyx/m/02w1p3

However, some ids don't seem to be returning data e.g. the following music genres /m/05fqyx, /m/02w1p3

作为替代方法免费库可以下载,但是我还没有尝试过!

As an alternative freebase can be downloaded, but I haven't tried that just yet!

推荐答案

没有等于Freebase建议,搜索或主题API的Wikidata.

There isn't a Wikidata equivalent to the Freebase Suggest, Search, or Topic APIs.

他们有一个beta SPARQL端点,可用于(痛苦地)推出自己的Freebase Topic替代品(以下详细信息),但是如果您没有立即迁移的需求,则可以考虑等到提供了新的,承诺的知识图等效项. Google承诺在新API可用后3个月的过渡期之前,必须关闭Freebase. (但是您需要决定如何愿意信任他们.)

They've got a beta SPARQL endpoint that you could use to (painfully) roll your own replacement for Freebase Topic (details below), but if you don't have an immediate need to migrate, you might consider waiting until the new, promised, Knowledge Graph equivalents are available. Google has promised a 3 month transition period after the availability of the new APIs before they shut down Freebase. (But you need to decide how willing you are to trust them.)

延迟过渡的另一个好处是,它使Wikidata人士有更多的时间来共同行动并构建一些可用的API.当然,您需要能够承受Freebase是只读的事实.

The other advantage to delaying the transition is that it gives the Wikidata folks more time to get their act together and build some usable APIs. Of course, you need to be able to live with the fact that Freebase is read-only.

如果要滚动自己的Wikidata查询以获取Freebase ID,可以使用以下查询作为起点:

If you want to roll your own Wikidata query for Freebase IDs, you can use the following query as a starting point:

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>

SELECT  ?s ?sLabel ?p ?o ?oLabel WHERE {
 ?s ?p ?o .
 ?s wdt:P646 "/m/0181lj" .

   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
   }
 }

TinyURL到查询编辑器 http://tinyurl.com/otdc78s

TinyURL to query editor http://tinyurl.com/otdc78s

通过使用此基本URL

You can get back JSON results by sending the query to the API endpoint with this base URL https://query.wikidata.org/bigdata/namespace/wdq/sparql?format=json&query= followed by your URL encoded query

TinyURL到API调用 http://tinyurl.com/nfcp2rh

TinyURL to API call http://tinyurl.com/nfcp2rh

这篇关于如何从YouTube视频中查询带有Freebase ID的Wikidata?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆