I am new to Freebase and I have been trying to find relationships between 2 nodes without success.
For example, I want to find if there is link between Lewis Hamilton(/en/lewis_hamilton) and Formula One(/en/formula_one), which there is in real life, but I can't seem to find it.
I have tried the following MQL codes, alternating IDs as well :
1)
[{
"type" : "/type/link",
"source" : { "id" : "/en/lewis_hamilton" },
"master_property" : null,
"target" : { "id" : "/en/formula_one" },
"target_value" : null
}]
2)
{
"id":"/en/lewis_hamilton",
"/type/reflect/any_master":[{
"link":null,
"name":null
}],
"/type/reflect/any_reverse":[{
"link":null,
"name":null
}],
"/type/reflect/any_value":[{
"link":null,
"value":null
}]
}
I'm also not able to use a couple of their apps that could do this because it returns "user rate limit exceeded" every time. Apps are:
Do you guys have any suggestions?
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.
来源:https://stackoverflow.com/questions/15732477/freebase-finding-relationship-between-nodes