Commit e8c8c22d authored by PkSM3's avatar PkSM3

portable on the way

parent 0d9cc033
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -176,6 +176,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -176,6 +176,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight") // AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
if(partialGraph._core.graph.edges.length==0) return;
var filterparams = AlgorithmForSliders ( partialGraph._core.graph.edges , type_attrb , type , criteria) var filterparams = AlgorithmForSliders ( partialGraph._core.graph.edges , type_attrb , type , criteria)
var steps = filterparams["steps"] var steps = filterparams["steps"]
...@@ -258,6 +259,8 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -258,6 +259,8 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight") // AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
if(partialGraph._core.graph.nodes.length==0) return;
var filterparams = AlgorithmForSliders ( partialGraph._core.graph.nodes , type_attrb , type , criteria) var filterparams = AlgorithmForSliders ( partialGraph._core.graph.nodes , type_attrb , type , criteria)
var steps = filterparams["steps"] var steps = filterparams["steps"]
var finalarray = filterparams["finalarray"] var finalarray = filterparams["finalarray"]
......
...@@ -7,6 +7,7 @@ $( window ).resize(function() { ...@@ -7,6 +7,7 @@ $( window ).resize(function() {
});// === / monitor windows resize === // });// === / monitor windows resize === //
mainfile = (isUndef(getUrlParam.file))?false:true;
// === [what to do at start] === // // === [what to do at start] === //
if (mainfile) { if (mainfile) {
// http://localhost/adasd/explorerjs.html?file=data/140907Syneco.gexf // http://localhost/adasd/explorerjs.html?file=data/140907Syneco.gexf
...@@ -194,11 +195,26 @@ function bringTheNoise(pathfile,type){ ...@@ -194,11 +195,26 @@ function bringTheNoise(pathfile,type){
// < === EXTRACTING DATA === > // < === EXTRACTING DATA === >
if(mainfile) { if(mainfile) {
pr("mainfile: "+mainfile) pr("mainfile: "+mainfile)
parse(decodeURIComponent(pathfile)); parse(decodeURIComponent(pathfile));
if(type=="mono") { if(type=="mono") {
onepartiteExtract(); onepartiteExtract();
$("#left").hide(); $("#left").hide();
} else if(type=="bi") fullExtract(); }
if(type=="bi") {
semanticConverged=true;
pr("here in fullextract")
fullExtract();
$("#closeloader").click();
pushSWClick("social");
pr(partialGraph._core.graph.nodes.length)
pr(partialGraph._core.graph.edges.length)
}
partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8).draw(2,2,2); partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8).draw(2,2,2);
theListeners(); theListeners();
...@@ -700,6 +716,7 @@ function SigmaLayouting( URL, DATA, NAME) { ...@@ -700,6 +716,7 @@ function SigmaLayouting( URL, DATA, NAME) {
partialGraph.draw(); partialGraph.draw();
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight"); EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size") NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
$("#colorGraph").hide();
} }
console.log("Parsing and FA2 complete for SemanticGraph."); console.log("Parsing and FA2 complete for SemanticGraph.");
......
...@@ -198,6 +198,8 @@ function alertCheckBox(eventCheck){ ...@@ -198,6 +198,8 @@ function alertCheckBox(eventCheck){
// AaBb: Socio-Semantic // AaBb: Socio-Semantic
function RefreshState(newNOW){ function RefreshState(newNOW){
pr("\t\t\tin RefreshState newNOW:_"+newNOW+"_.")
if (newNOW!="") { if (newNOW!="") {
PAST = NOW; PAST = NOW;
NOW = newNOW; NOW = newNOW;
...@@ -1467,11 +1469,7 @@ function changeToMeso(iwannagraph) { ...@@ -1467,11 +1469,7 @@ function changeToMeso(iwannagraph) {
// unHide(id); // unHide(id);
} }
} }
createEdgesForExistingNodes(iwannagraph);/**/ createEdgesForExistingNodes(iwannagraph);/**/
greyEverything();
for(var i in selections) markAsSelected(i,true);
overNodes=true;
} }
if(swclickPrev=="semantic") { if(swclickPrev=="semantic") {
...@@ -1493,7 +1491,7 @@ function changeToMeso(iwannagraph) { ...@@ -1493,7 +1491,7 @@ function changeToMeso(iwannagraph) {
} }
if(swclickPrev=="sociosemantic") { if(swclickPrev=="sociosemantic") {
hideEverything(); // hideEverything();
for(var i in selections) { for(var i in selections) {
if(Nodes[i].type==catSoc){ if(Nodes[i].type==catSoc){
...@@ -1512,10 +1510,6 @@ function changeToMeso(iwannagraph) { ...@@ -1512,10 +1510,6 @@ function changeToMeso(iwannagraph) {
} }
} }
for(var i in selections) {
markAsSelected(i,true);
}
overNodes=true;
} }
} }
} }
...@@ -1593,6 +1587,14 @@ function changeToMeso(iwannagraph) { ...@@ -1593,6 +1587,14 @@ function changeToMeso(iwannagraph) {
// // partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8); // // partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8);
// partialGraph.refresh(); // partialGraph.refresh();
// partialGraph.startForceAtlas2(); // partialGraph.startForceAtlas2();
MultipleSelection(Object.keys(selections));
// greyEverything();
// for(var i in selections) markAsSelected(i,true);
// overNodes=true;
$('.gradient').css({"background-size":"90px 90px"}); $('.gradient').css({"background-size":"90px 90px"});
} }
...@@ -1649,6 +1651,7 @@ function changeToMacro(iwannagraph) { ...@@ -1649,6 +1651,7 @@ function changeToMacro(iwannagraph) {
for(var e in Edges) { for(var e in Edges) {
if(Edges[e].label=="nodes1" || Edges[e].label=="nodes2"){ if(Edges[e].label=="nodes1" || Edges[e].label=="nodes2"){
st=e.split(";"); st=e.split(";");
if(Edges[st[0]+";"+st[1]] && Edges[st[1]+";"+st[0]] && if(Edges[st[0]+";"+st[1]] && Edges[st[1]+";"+st[0]] &&
Edges[st[0]+";"+st[1]].hidden==true && Edges[st[0]+";"+st[1]].hidden==true &&
......
...@@ -29,7 +29,7 @@ function scanCategories() { ...@@ -29,7 +29,7 @@ function scanCategories() {
attvalueNode = attvalueNodes[k]; attvalueNode = attvalueNodes[k];
attr = attvalueNode.getAttribute('for'); attr = attvalueNode.getAttribute('for');
val = attvalueNode.getAttribute('value'); val = attvalueNode.getAttribute('value');
pr(val) // pr(val)
if (attr=="category") categories[val]=val; if (attr=="category") categories[val]=val;
} }
} }
...@@ -403,24 +403,20 @@ function fullExtract(){ ...@@ -403,24 +403,20 @@ function fullExtract(){
/* Para asignar tamaño a los NGrams */ /* Para asignar tamaño a los NGrams */
if(atts["category"]===categoriesIndex[1]) { if(atts["category"]===categoriesIndex[1]) {
if(typeof(node.size)==="undefined") node.size=parseInt(val).toFixed(2); if(typeof(node.size)==="undefined") node.size=parseInt(val).toFixed(2);
/* Type of Node*/
//console.log(val);
//if(val<30) val=30;
//Nodes[id].size=(parseInt(val).toFixed(2)*5)/70;
// Nodes[id].size=parseInt(val).toFixed(2);
// node.size=Nodes[id].size;
// if(id.charAt(0)=="D") {
// Nodes[id].size = "5";
// node.size = "5";
// }
} }
/* Para asignar tamaño a los NGrams */ /* Para asignar tamaño a los NGrams */
} }
//console.log(node.attributes); //console.log(node.attributes);
nodecat=node.attributes["category"]; nodecat=node.attributes["category"];
nodew=parseInt(node.attributes["weight"]); nodew=parseInt(node.attributes["weight"]);
if( nodecat===categoriesIndex[1]){ if( nodecat===categoriesIndex[1]){
node.type=catSoc; node.type=catSoc;
node.id = "D::"+node.id;
node.shape="square"; node.shape="square";
numberOfDocs++; numberOfDocs++;
//node.size=desirableScholarSize; //node.size=desirableScholarSize;
...@@ -428,34 +424,30 @@ function fullExtract(){ ...@@ -428,34 +424,30 @@ function fullExtract(){
} }
else { else {
node.type=catSem; node.type=catSem;
node.id = "N::"+node.id;
numberOfNGrams++; numberOfNGrams++;
if(typeof(node.size)==="undefined") node.size=nodew; if(isUndef(node.size)) node.size=nodew;
} }
if(parseInt(node.size) < parseInt(minNodeSize)) minNodeSize= node.size; if(parseInt(node.size) < parseInt(minNodeSize)) minNodeSize= node.size;
if(parseInt(node.size) > parseInt(maxNodeSize)) maxNodeSize= node.size; if(parseInt(node.size) > parseInt(maxNodeSize)) maxNodeSize= node.size;
// Create Node // Create Node
Nodes[id] = node // The graph node
//pr(Nodes[id]); Nodes[node.id] = node // The graph node
} }
} }
//New scale for node size: now, between 2 and 5 instead [1,70] //New scale for node size: now, between 2 and 5 instead [1,70]
for(var i in Nodes){ for(var i in Nodes){
normalizedSize=desirableNodeSizeMIN+(Nodes[i].size-1)*((desirableNodeSizeMAX-desirableNodeSizeMIN)/(parseInt(maxNodeSize)-parseInt(minNodeSize))); normalizedSize=desirableNodeSizeMIN+(Nodes[i].size-1)*((desirableNodeSizeMAX-desirableNodeSizeMIN)/(parseInt(maxNodeSize)-parseInt(minNodeSize)));
Nodes[i].size = ""+normalizedSize; Nodes[i].size = ""+normalizedSize;
if(Nodes[i].type==catSem) { nodeK = Nodes[i];
nodeK = Nodes[i]; if(Nodes[i].type==catSoc) partialGraph.addNode(i,nodeK);
nodeK.hidden=true;
partialGraph.addNode(i,nodeK);
delete Nodes[i].hidden;
}
else {
partialGraph.addNode(i,Nodes[i]);
unHide(i);
}
} }
var edgeId = 0; var edgeId = 0;
var edgesNodes = gexf.getElementsByTagName('edges'); var edgesNodes = gexf.getElementsByTagName('edges');
for(i=0; i<edgesNodes.length; i++){ for(i=0; i<edgesNodes.length; i++){
...@@ -465,7 +457,13 @@ function fullExtract(){ ...@@ -465,7 +457,13 @@ function fullExtract(){
var edgeNode = edgeNodes[j]; var edgeNode = edgeNodes[j];
var source = edgeNode.getAttribute('source'); var source = edgeNode.getAttribute('source');
var target = edgeNode.getAttribute('target'); var target = edgeNode.getAttribute('target');
source = (Nodes["D::"+source])? ("D::"+source):("N::"+source)
target = (Nodes["D::"+target])? ("D::"+target):("N::"+target)
var indice=source+";"+target; var indice=source+";"+target;
// pr(indice)
var edge = { var edge = {
id: indice, id: indice,
...@@ -486,7 +484,8 @@ function fullExtract(){ ...@@ -486,7 +484,8 @@ function fullExtract(){
var attvalueNode = attvalueNodes[k]; var attvalueNode = attvalueNodes[k];
var attr = attvalueNode.getAttribute('for'); var attr = attvalueNode.getAttribute('for');
var val = attvalueNode.getAttribute('value'); var val = attvalueNode.getAttribute('value');
if(k==1) {
if(k=="category") {
kind=val; kind=val;
edge.label=val; edge.label=val;
} }
...@@ -501,78 +500,102 @@ function fullExtract(){ ...@@ -501,78 +500,102 @@ function fullExtract(){
}); });
} }
// pr(edge)
idS=Nodes[edge.sourceID].type.charAt(0); idS=Nodes[edge.sourceID].type;
idT=Nodes[edge.targetID].type.charAt(0); idT=Nodes[edge.targetID].type;
//pr(idS+";"+idT);
if(idS=="D" && idT=="D"){ Edges[indice] = edge;
edge.label="nodes1";
if( (typeof partialGraph._core.graph.edgesIndex[target+";"+source])=="undefined" ){ if(idS==catSoc && idT==catSoc){
edge.hidden=false; // pr("anything here?")
}
else edge.hidden=true; edge.label = "nodes1";
if((typeof nodes1[source])=="undefined"){ if(isUndef(nodes1[source])) {
nodes1[source] = { nodes1[source] = {
label: Nodes[source].label, label: Nodes[source].label,
neighbours: [] neighbours: []
}; };
nodes1[source].neighbours.push(target);
} }
else nodes1[source].neighbours.push(target); if(isUndef(nodes1[target])) {
nodes1[target] = {
// if((typeof nodes1[target])=="undefined"){ label: Nodes[target].label,
// nodes1[target] = {
// label: Nodes[target].label,
// neighbours: []
// };
// nodes1[target].neighbours.push(source);
// }
// else nodes1[target].neighbours.push(source);
}
if(idS=="N" && idT=="N"){
edge.label="nodes2";
//pr("nodes2");
edge.hidden=true;
if((typeof nodes2[source])=="undefined"){
nodes2[source] = {
label: Nodes[source].label,
neighbours: [] neighbours: []
}; };
nodes2[source].neighbours.push(target); }
} nodes1[source].neighbours.push(target);
else nodes2[source].neighbours.push(target); nodes1[target].neighbours.push(source);
// partialGraph.addEdge(indice,source,target,edge);
} }
if((idS=="D" && idT=="N")||(idS=="N" && idT=="D")){
edge.label="bipartite"; if(idS==catSem && idT==catSem){
//pr("bipartite"); edge.label = "nodes2";
edge.hidden=true;
// Document to NGram if(isUndef(nodes2[source])) {
if((typeof bipartiteD2N[source])=="undefined"){ nodes2[source] = {
bipartiteD2N[source] = {
label: Nodes[source].label, label: Nodes[source].label,
neighbours: [] neighbours: []
}; };
bipartiteD2N[source].neighbours.push(target);
} }
else bipartiteD2N[source].neighbours.push(target); if(isUndef(nodes2[target])) {
nodes2[target] = {
// NGram to Document
if((typeof bipartiteN2D[target])=="undefined"){
bipartiteN2D[target] = {
label: Nodes[target].label, label: Nodes[target].label,
neighbours: [] neighbours: []
}; };
}
nodes2[source].neighbours.push(target);
nodes2[target].neighbours.push(source);
// otherGraph.addEdge(indice,source,target,edge);
}
if((idS==catSoc && idT==catSem)||(idS==catSem && idT==catSoc)) {
edge.label = "bipartite";
s = edge.sourceID
// // Source is Document
if(Nodes[s].type == catSoc) {
if(isUndef(bipartiteD2N[source])) {
bipartiteD2N[source] = {
label: Nodes[source].label,
neighbours: []
};
}
if(isUndef(bipartiteN2D[target])) {
bipartiteN2D[target] = {
label: Nodes[target].label,
neighbours: []
};
}
bipartiteD2N[source].neighbours.push(target);
bipartiteN2D[target].neighbours.push(source); bipartiteN2D[target].neighbours.push(source);
// // Source is NGram
} else {
if(isUndef(bipartiteN2D[source])) {
bipartiteN2D[source] = {
label: Nodes[source].label,
neighbours: []
};
}
if(isUndef(bipartiteD2N[target])) {
bipartiteD2N[target] = {
label: Nodes[target].label,
neighbours: []
};
}
bipartiteN2D[source].neighbours.push(target);
bipartiteD2N[target].neighbours.push(source);
} }
else bipartiteN2D[target].neighbours.push(source);
} }
partialGraph.addEdge(indice,source,target,edge);
delete edge.hidden;
Edges[indice]=edge;
} }
} }
} }
...@@ -662,7 +685,7 @@ function extractFromJson(data,seed){ ...@@ -662,7 +685,7 @@ function extractFromJson(data,seed){
var source = edgesNodes[i].s; var source = edgesNodes[i].s;
var target = edgesNodes[i].t; var target = edgesNodes[i].t;
var indice=source+";"+target; var indice=source+";"+target;
if(indice.indexOf("D::593")!==-1) pr(indice) // if(indice.indexOf("D::593")!==-1) pr(indice)
var edge = { var edge = {
id: indice, id: indice,
sourceID: source, sourceID: source,
...@@ -765,5 +788,5 @@ function extractFromJson(data,seed){ ...@@ -765,5 +788,5 @@ function extractFromJson(data,seed){
//edge.hidden=false/**///should be commented //edge.hidden=false/**///should be commented
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment