遍历 Freebase 图

发布于 2024-11-09 11:28:51 字数 1619 浏览 3 评论 0原文

我正在尝试从特定的人那里获取多个级别的影响关系。 粗略地说,这个查询解释了我想要完成的任务

{ "id" : "/en/george_orwell",
  "name" : null,
  "type" : "/influence/influence_node",
  "influenced": [{"id": null,"name" : null,
                  "type" : "/influence/influence_node",
                   "influenced": [{"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }],
                  "influenced_by": [ {"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }],
  "influenced_by": [{"id": null,"name" : null,
                  "type" : "/influence/influence_node",
                  "influenced": [{"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }],
                  "influenced_by": [ {"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }] }

是否有任何有效的方法使用 MQL 遍历 Freebase 图形?

I'm trying to fetch multiple levels of influence relationships from a particular person.
Roughly, this query explains what I'm trying to accomplish

{ "id" : "/en/george_orwell",
  "name" : null,
  "type" : "/influence/influence_node",
  "influenced": [{"id": null,"name" : null,
                  "type" : "/influence/influence_node",
                   "influenced": [{"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }],
                  "influenced_by": [ {"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }],
  "influenced_by": [{"id": null,"name" : null,
                  "type" : "/influence/influence_node",
                  "influenced": [{"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }],
                  "influenced_by": [ {"id": null,"name" : null,
                                   "type" : "/influence/influence_node",
                                   "influenced": [{"id": null,"name" : null}],
                                   "influenced_by": [ { "id": null, "name" : null}] }] }

Is there any efficient way of traversing the Freebase graph using MQL ?

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

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

发布评论

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

评论(1

书间行客 2024-11-16 11:28:51

我假设你想受到给定数量的层数的影响和影响?不,不可能在 mql 中执行此操作,它需要某种递归和自引用。

但是,您可以使用此语法传递多个 id
[{ 'id|=' : ['id1', 'id2', ...] }]

通过这种方式,您可以通过给定种子第一次运行查询来获取人员列表,然后重新运行查询以抓取所选任何给定 id 的图表。

如果这不是要以交互方式(由人)完成,那么您可能应该使用 freebase 数据转储来离线预先计算整个过程。

I assume you want to get influenced and influenced_by for a given number of plies out ? No it's not possible to do this in mql, it would require some sort of recursion and self-referencing.

However, you can pass multiple ids using this syntax
[{ 'id|=' : ['id1', 'id2', ...] }]

In that way you can get the list of people from running the query the first time given a seed, and then re-run the query to crawl the graph for any given id selected.

If this is not aimed to be done interactively (by a person) then you should probably use the freebase data dumps to pre-calculate the whole thing offline.

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