Search code examples
freebasemql

How do I use the influence node on Freebase?


I am looking to search for influential people from Freebase database. I have tried to look at this but I can't get my head around developing the query to get a bug-free result. Here's the link: www.freebase.com/influence/influence_node.


Solution

  • To get started, you can get the count of all influence nodes on Freebase via this query:

    {
      "type": "/influence/influence_node",
      "return": "count"
    }
    

    (which returns 50856 for me just now)

    To get the graph structure, you will need to first query the influence nodes and their neighbors like this:

    [{
      "mid": null,
      "name": null,
      "type": "/influence/influence_node",
      "influenced": [{
        "mid": null,
        "name": null,
        "optional": true
      }],
      "influenced_by": [{
        "mid": null,
        "name": null,
        "optional": true
      }]
    }]
    

    then transform the resulting list of nodes into edges by using the mid field (machine id, one of several unique ids on Freebase). Note while Freebase returns only the first 100 nodes, you can page through the result by using the cursor parameter in the mqlread API. Note also that "option": true keep nodes with no influencers or influencees around in the result.