Reputation: 1211
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 ?
Upvotes: 1
Views: 272
Reputation: 511
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.
Upvotes: 1