Freebase 检索未编辑的数据

发布于 2024-12-13 03:40:34 字数 167 浏览 0 评论 0原文

除了这个问题:链接我问我是否可以检索数据就像主题中的文本甚至地理位置一样,它们似乎没有输入任何信息(但有来自维基百科的文本描述)

In addition to this question:link i'm asking if i can retrieve data like the text or even geolocation from topics that seems that they have not any info been entered(but there is text description from wikipedia)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各自安好 2024-12-20 03:40:34

因此,问题是,当您运行以下查询时,您不会得到任何结果:

[{
  "name": "River Thames",
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

尝试一下

这是因为 Freebase 还没有名为“泰晤士河”的主题的地理坐标。换句话说,Freebase 中没有与此查询结构完全匹配的事实组合,因此它不会返回任何内容。不过,它确实有河口的坐标,因此您将获得类似查询的结果:

[{
  "name": "River Thames",
  "type": "/location/location",
  "/geography/river/mouth_long_lat": [{
    "latitude":  null,
    "longitude": null
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

尝试一下

但是如果您事先不知道您要查找的数据是否已在 Freebase 中完全填写,您该怎么办?

您可以将查询的某些部分标记为“可选”,这意味着如果数据存在,则应返回它们,但即使数据不存在,查询仍应返回结果。因此,对于您的原始查询,如下所示:

[{
  "name": "River Thames",
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null,
    "optional":  true
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

尝试一下

现在您应该得到包含文章文本的结果存在,但地理位置返回为空数组。

我还应该指出的一件事是,您应该意识到您编写的查询正在要求 Freebase 中名为“River Thames”的所有主题的列表。目前,该查询仅返回一个结果,但将来,当更多数据添加到 Freebase 时,它​​可能会返回多个结果。如果您确实只对这条泰晤士河感兴趣,则应该使用其独特的 MID 进行查询,如下所示:

{
  "id": "/m/0d2kt"
  "name": null,
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null,
    "optional":  true
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}​

尝试一下

So, the problem is that when you run the following query you don't get any results:

[{
  "name": "River Thames",
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

Try it out

This is because Freebase doesn't have geocoordinates (yet) for a topic called "River Thames". In other words, there are no combination of facts in Freebase that will match this query structure exactly so it returns nothing. It does however have coordinates for the mouth of the river so you will get results for this similar query:

[{
  "name": "River Thames",
  "type": "/location/location",
  "/geography/river/mouth_long_lat": [{
    "latitude":  null,
    "longitude": null
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

Try it out

But what should you do if you don't know beforehand whether the data that you're looking for is completely filled out in Freebase yet?

You can mark certain parts of a query as being "optional" which means that they should be returned if the data is present but that the query should still return results even if that data isn't present. So for your original query that would look like this:

[{
  "name": "River Thames",
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null,
    "optional":  true
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

Try it out

Now you should get results with the text of the article present but the geolocation returned as an empty array.

One more thing I should point out is that you should be aware that the query you've written is asking for a list of ALL topics in Freebase with the name "River Thames". Right now, that query only returns one result but in the future, when more data is added to Freebase, it may return multiple results. If you're really only interested in THIS River Thames, you should query it using its unique MID like this:

{
  "id": "/m/0d2kt"
  "name": null,
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null,
    "optional":  true
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}​

Try it out

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文