javascript/web/DDBrowse.js
function _resp2json(doc){
	console.log("_resp2json: " + doc);

	var kids = []; // ret

	// Extract the intersting graphs.
	var topo_graph_field = 'topology_graph_json';
	var trans_graph_field = 'regulates_transitivity_graph_json';
	var topo_graph = new model.graph();
	topo_graph.load_base_json(JSON.parse(doc[topo_graph_field]));
	var trans_graph = new model.graph();
	trans_graph.load_base_json(JSON.parse(doc[trans_graph_field]));

	//console.log('topo: ' + doc[topo_graph_field]);

	// Collect child ids.
	var child_ids = [];
	us.each(topo_graph.get_child_nodes(doc['id']), function(kid){
	    child_ids.push(kid.id());
	});

	// Using the badger, get the spans for the IDs.
	var ac_badges = new CountBadges(filter_manager);
	var ids_to_badge_text = ac_badges.get_future_badges(child_ids);

	//
	us.each(topo_graph.get_child_nodes(doc['id']), function(kid){

	    // Extract some info.
	    var oid = doc['id'];
	    var sid = kid.id();
	    var preds = topo_graph.get_predicates(sid, oid);
	    var imgsrc = bbop.resourcify(sd.image_base, preds[0], 'gif');

	    var lbl_txt =  kid.label() || sid;
	    
	    // Push template.
	    kids.push({
		'id': sid,
		'text': lbl_txt + ids_to_badge_text[sid],
		'icon': imgsrc,
		'state': {
		    'opened': false,
		    'disabled': false,
		    'selected': false
		},
		'children': true, // unknowable w/o lookahead
		'li_attr': {},
		'a_attr': {}
	    });
	});

	return kids;
    }
function _resp2json(doc){
	console.log("_resp2json: " + doc);

	var kids = []; // ret

	// Extract the intersting graphs.
	var topo_graph_field = 'topology_graph_json';
	var trans_graph_field = 'regulates_transitivity_graph_json';
	var topo_graph = new model.graph();
	topo_graph.load_base_json(JSON.parse(doc[topo_graph_field]));
	var trans_graph = new model.graph();
	trans_graph.load_base_json(JSON.parse(doc[trans_graph_field]));

	//console.log('topo: ' + doc[topo_graph_field]);

	// Collect child ids.
	var child_ids = [];
	us.each(topo_graph.get_child_nodes(doc['id']), function(kid){
	    child_ids.push(kid.id());
	});

	// Using the badger, get the spans for the IDs.
	var ac_badges = new CountBadges(filter_manager);
	var ids_to_badge_text = ac_badges.get_future_badges(child_ids);

	//
	us.each(topo_graph.get_child_nodes(doc['id']), function(kid){

	    // Extract some info.
	    var oid = doc['id'];
	    var sid = kid.id();
	    var preds = topo_graph.get_predicates(sid, oid);
	    var imgsrc = bbop.resourcify(sd.image_base, preds[0], 'gif');

	    var lbl_txt =  kid.label() || sid;
	    
	    // Push template.
	    kids.push({
		'id': sid,
		'text': lbl_txt + ids_to_badge_text[sid],
		'icon': imgsrc,
		'state': {
		    'opened': false,
		    'disabled': false,
		    'selected': false
		},
		'children': true, // unknowable w/o lookahead
		'li_attr': {},
		'a_attr': {}
	    });
	});

	return kids;
    }
function _resp2json ( doc ) { console . log ( "_resp2json: " + doc ) ; var kids = [ ] ; // ret // Extract the intersting graphs. var topo_graph_field = 'topology_graph_json' ; var trans_graph_field = 'regulates_transitivity_graph_json' ; var topo_graph = new model . graph ( ) ; topo_graph . load_base_json ( JSON . parse ( doc [ topo_graph_field ] ) ) ; var trans_graph = new model . graph ( ) ; trans_graph . load_base_json ( JSON . parse ( doc [ trans_graph_field ] ) ) ; //console.log('topo: ' + doc[topo_graph_field]); // Collect child ids. var child_ids = [ ] ; us . each ( topo_graph . get_child_nodes ( doc [ 'id' ] ) , function ( kid ) { child_ids . push ( kid . id ( ) ) ; } ) ; // Using the badger, get the spans for the IDs. var ac_badges = new CountBadges ( filter_manager ) ; var ids_to_badge_text = ac_badges . get_future_badges ( child_ids ) ; // us . each ( topo_graph . get_child_nodes ( doc [ 'id' ] ) , function ( kid ) { // Extract some info. var oid = doc [ 'id' ] ; var sid = kid . id ( ) ; var preds = topo_graph . get_predicates ( sid , oid ) ; var imgsrc = bbop . resourcify ( sd . image_base , preds [ 0 ] , 'gif' ) ; var lbl_txt = kid . label ( ) || sid ; // Push template. kids . push ( { 'id' : sid , 'text' : lbl_txt + ids_to_badge_text [ sid ] , 'icon' : imgsrc , 'state' : { 'opened' : false , 'disabled' : false , 'selected' : false } , 'children' : true , // unknowable w/o lookahead 'li_attr' : { } , 'a_attr' : { } } ) ; } ) ; return kids ; }
Convert a term children's into the proper json.
Convert a term children s into the proper json .