[Freebase]: Finding relationship between nodes

◇◆丶佛笑我妖孽 提交于 2019-12-06 15:48:21

The queries that you gave are correct except that they only look at relationships that are one link apart. Surprisingly there isn't a path from Lewis Hamilton to Formula One in Freebase right now. If there was it might look something like this:

/en/lewis_hamilton → /type/object/type → /base/formula1/formula_1_driver
/base/formula1/formula_1_driver → /type/type/domain → /base/formula1
/base/formula1 → /freebase/domain_profile/equivalent_topic → /en/formula_one

Freebase doesn't support recursive queries so there's no good way to find these multi-link paths between topics. The apps that you tried simulate recursion by generating queries with increasingly nested subqueries. Unfortunately they are out of date and missing the proper API keys to run properly right now. Here's what those nested queries look like:

{
  "id": "/en/lewis_hamilton",
  "name": null,
  "/type/reflect/any_master": [{
    "link": {
      "master_property": null,
      "target": {
        "id": null,
        "name": null,
        "/type/reflect/any_master": [{
          "link": {
            "master_property": null,
            "target": {
              "id": "//base/formula1",
              "name": null
            }
          },
          "name": null
        }]
      }
    },
    "name": null
  }]
}

These sorts of queries can take a long time to run and are probably better if run locally over the Freebase data dumps.

Freebase is returning nothing but 503s right now, so it's a little difficult to experiment, but

  • All apps on Freebaseapps are open source, so looking at the sources for the apps you found should give you some good hints. The app directory is at https://www.freebase.com/apps (but isn't rendering right now)

  • All apps on Freebaseapps can be cloned with a single click. Pretty much every app written on that infrastructure stopped working when Google switched to the new API and the developers are unlikely to fix them if they haven't been looked at in years, but you can probably get the ones of interest working by a) cloning them, b) registering for an API key and c) adding that API key to cloned app.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!