semantics_connections.js 1.13 KB
 var connected = {};     // dictionaries of connections and disconnections between frames and schemas 
 var connected_reverse = {};

function memorizeConnections(arguments_connected, frames_connection){
    connected = arguments_connected;
    connected_reverse = frames_connection;
}

function addConnections(arguments_connected, frames_connection){
    var i;
    for (i = 0; i < arguments_connected.length; i++) {
	var argument = arguments_connected[i];
	if (!connected.hasOwnProperty(argument)) {
	    connected[argument] = [];
	}
    }
}

function removeArgumentConnections(frame_id, complement_id) {
    for (var argument in connected) {
        if (argument == 'frame_' + frame_id + '_comp_' + complement_id + '_' ||
            argument == 'frame_' + frame_id + '_comp_' + complement_id + '_lemma_') {
            var i;
            for (i = 0; i < connected[argument].length; i++) {
                var idx = connected_reverse[connected[argument][i]].indexOf('frame_' + frame_id + '_');
                connected_reverse[connected[argument][i]].splice(idx, 1);
            }
            connected[argument] = [];
        }
    }
    return;
}