【问题标题】:Freebase MQL query for topic summary and image?Freebase MQL 查询主题摘要和图像?
【发布时间】:2009-03-24 05:01:16
【问题描述】:

我正在尝试编写一个MQL query 以使用Freebase API 执行。我想检索主题摘要和主题图像。

我已经能够计算出以下查询,它将为我获取与 Bill Gates 主题相关联的图像。

MQL:

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "name" : "bill gates",
    "type" : "/people/person"
  }
]

结果:

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "name" : "Bill Gates",
    "type" : "/people/person"
  }
]

对于那些过去可能没有接触过 MQL 但有兴趣尝试它的人。查看Freebase MQL Query Editor

billg profile page http://i.friendfeed.com/c31a22d9e439eb67b0feeb4ffd64c3b5ed9a8e16

更新

我最终使用的查询:

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "article" : [
      {
        "content" : null
      }
    ],
    "name" : "bill gates",
    "type" : "/common/topic"
  }
]

这些结果可以结合 narphorium 的回答来检索实际数据:

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "article" : [
      {
        "content" : null
      },
      {
        "content" : "/guid/9202a8c04000641f800000000903535d"
      }
    ],
    "name" : "Bill Gates",
    "type" : "/common/topic"
  }
]

【问题讨论】:

  • 哇,它居然叫“Freebase?”
  • 是的,很酷

标签: freebase mql


【解决方案1】:

图像和主题摘要分别存储在内容存储中,可通过another web service API 访问。

例如,比尔盖茨的图片可以这样访问:

http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f8000000004fb4c01

同样,主题摘要的 GUID 可以通过在查询中将 /common/topic/image 替换为 /common/topic/article 来找到。可以像这样再次访问结果:

http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f8000000008bfed35

您可以阅读有关内容存​​储库的更多信息here

【讨论】:

  • 有趣,我在我的问题中提到了内容存储(在编辑中删除,因为你的答案更好)。但我认为这只是为了图像。我最终测试了实际的文章/内容,发现它也被退回了,但你的回答比我描述得更好。谢谢!
  • @Shawn 这个答案是否适用于 2012 年?是否建议使用图像服务?
【解决方案2】:

freebase 提供的新图像服务现在可用于使用 freebase id 获取图像,例如,对于比尔盖茨来说,以下是图像 URL:

https://usercontent.googleapis.com/freebase/v1/image/en/bill_gates

有关此服务的更多信息,请访问:http://wiki.freebase.com/wiki/Image_Service

【讨论】:

  • https://usercontent.googleapis.com/freebase/v1/image/en/bill_gates?maxwidth=225&maxheight=225&mode=fillcropmid 默认图片比较小。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多