close

  
<p> function rename_info(record)
{
    var info = {
        "creator": {
            "id": record["creator"]["id"],
            "name": record["creator"]["/freebase/user_profile/my_full_name"] ? record["creator"]["/freebase/user_profile/my_full_name"]["value"] : record["creator"]["name"]
        },
        "source": {
            "id": record["source"]["id"],
            "name": {
                "value": record["target_value"],
                "lang": record["target"]
            },
            "old:name": null
        },
        "timestamp": record["timestamp"]
    };
    
    var names = record["source"]["name"];
    for (var i = 0; i &lt; names.length; i++) {
        if (names[i]["link"]["valid"] === false &amp;&amp; names[i]["lang"] == record["target"]["id"]) {
            info["source"]["old:name"] = names[i]["value"];
            break;
        }
    }
    
    return info;
}

function run()
{
    var query = acre.require("renameq").query;
    var renames = acre.freebase.mqlread(query).result;
    return renames.map(rename_info);
}

 </p>

Comments

Hide