在MQL中获取维基百科ID [英] Getting Wikipedia IDs in MQL

查看:148
本文介绍了在MQL中获取维基百科ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Freebase WEX转储包含与源MediaWiki中的page_id相对应的wpid列. freebase_wpid 表中的数据库.该表提供了Wikipedia数字文章/重定向ID与Freebase GUID(全局唯一ID)之间的映射.

Freebase WEX dumps contain a wpid column corresponding to the page_id from the source MediaWiki database in the freebase_wpid table. This table provides a mapping between Wikipedia numeric article/redirect IDs and Freebase GUIDs (Global Unique IDs).

guid用作很多正当理由的已被mid弃用. ,但这并不会改变guid仍在系统级别使用的事实,因此,我将从这里开始将mid称为访问器.

guid use as foreign keys is deprecated by mid for lots of good reasons, but that doesn't change the fact that guids are still used at a system level so I'm going to call mid an accessor from here on.

在MQL中灵活使用mid访问器.可以使用"mid": null"mid":[]进行查询,具体取决于是需要当前的mid还是每个mid.

Using the mid accessor is flexible in MQL. One can query using "mid": null and using "mid":[] depending on whether one needs the current mid or every mid.

在MQL中很容易找到每个midwpid个值的列表:

Finding a list of wpid values per mid is straightforward in MQL:

[{
  "mid": null
  "key": [{"namespace":"/wikipedia/en_id", "value":null}]
}]

但是如果宇宙中一切都好,每个当前mid应该只具有一个当前wpid,那么有没有办法像"wpid": null那样使用mql访问器来做某事?

But if all is well in the universe, each current mid should have only one current wpid, so is there a way to do something like "wpid": null like one can with the mql accessor?

推荐答案

如果您每次中间只需要一个wpid值,则可以执行以下操作:

If you only want one wpid value per mid you could do something like this:

[{
  "mid": null,
  "key": {
    "namespace": "/wikipedia/en_id",
    "value":     null,
    "limit":     1
  }
}]​

尝试一下

请记住,Freebase主题完全有可能出现多个错误.每当我们需要合并从Wikipedia导入的重复主题时,或者在将它们合并到Wikipedia中之前导入它们时,就会发生这种情况.

Bare in mind that it is entirely possible that a Freebase topic would have more than one wmid. This happens whenever we need to merge duplicate topics that we've imported from Wikipedia, or if we import them before they get merged in Wikipedia.

如果您要查找到Wikipedia页面的链接,则可能对/wikipedia/en_title namepace感兴趣:

If you're looking for links to Wikipedia pages you might also be interested in the /wikipedia/en_title namepace:

[{
  "mid": null,
  "key": {
    "namespace": "/wikipedia/en_title",
    "value":     null,
    "limit":     1
  }
}]​

尝试一下

这篇关于在MQL中获取维基百科ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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