summaryrefslogtreecommitdiff
path: root/objectapp/templates/objectapp/skeleton.html
diff options
context:
space:
mode:
authoramita singh <amitacr@gmail.com>2012-06-06 16:02:54 +0530
committeramita singh <amitacr@gmail.com>2012-06-06 16:02:54 +0530
commitf2b5e44148129add4f3d8d2ca14f6412fb84de04 (patch)
tree2b3f78ef41c88a66984e5ebd430c8427c51affbd /objectapp/templates/objectapp/skeleton.html
parent25a00deee21e5693bca8d158bd1df77dd9063f16 (diff)
parenta1cd248231180ba82206c6a456345834b519a889 (diff)
downloadgnowsys-f2b5e44148129add4f3d8d2ca14f6412fb84de04.tar.gz
dump_all_rdf.py dumps the rdf of all the objects in one file and fstore_rdf_import imports the rdf to the 4store
Diffstat (limited to 'objectapp/templates/objectapp/skeleton.html')
-rw-r--r--objectapp/templates/objectapp/skeleton.html171
1 files changed, 151 insertions, 20 deletions
diff --git a/objectapp/templates/objectapp/skeleton.html b/objectapp/templates/objectapp/skeleton.html
index d04b02f4..78baf08b 100644
--- a/objectapp/templates/objectapp/skeleton.html
+++ b/objectapp/templates/objectapp/skeleton.html
@@ -214,7 +214,10 @@ function init(a,b)
}
$(function fgraph() {
-
+neighbour_node= new Array();
+clicked_node=new Array();
+prev_node=new Array();
+neighbour_node= neighbour_node.concat({{object.id}});
$.getJSON('/nodetypes/graphs/graph_json/' + {{object.id}}, function (json1) {
metadata=json1.node_metadata;
@@ -350,26 +353,124 @@ var q = 110 + "%";
-$(window).bind('keydown',function(event){
- if(17==event.keyCode){
- new_g.on("click",function(d){
- if(d._id>0 && d.expanded=="false")
- {
- d3.select("#amazingViz").remove();
- d.expanded="true";
- $.getJSON('/nodetypes/graphs/graph_json/' + d._id , function (json2) {
- new_metadata=json2.node_metadata;
- new_relations=json2.relations;
- metadata=_.union(new_metadata,metadata);
- relations=_.union(new_relations,relations);
- init(metadata,relations);
- load(d._id)
- })
-
+$(window).bind('keydown',function(event) {
+ if(event.keyCode==17){
+
+ new_g.on("click",function(d){
+
+
+
+
+ if(d._id>0 && d.expanded=="true")
+ {
+
+ $.getJSON('/nodetypes/graphs/graph_json/' + d._id , function (json2) {
+ new_metadata=json2.node_metadata;
+
+ });
+
+ _.filter(new_metadata, function(e){if(e._id>0)
+ {
+ clicked_node=clicked_node.concat(e._id) ;
+ }
+ });
+
+
+ index = _.indexOf(neighbour_node , d._id);
+ prev_node=neighbour_node.slice(0,index);
+
+ neighbour_node = _.difference(neighbour_node,clicked_node) ;
+
+ neighbour_node= neighbour_node.concat(prev_node);
+ neighbour_node = _.uniq(neighbour_node);
+ metadata=[]
+ relations=[]
+ metadata1=[]
+ relations1=[]
+ for(i=0;i<(neighbour_node.length);i++)
+ {
+
+ d3.select("#amazingViz").remove();
+ g=neighbour_node[i]
+
+
+
+ $.ajax({
+ async:false,
+ url:'/nodetypes/graphs/graph_json/' + g ,
+ datatype:'json',
+ success:function (json2) {
+ new_metadata=json2.node_metadata;
+ new_relations=json2.relations;
+ metadata=_.union(new_metadata,metadata);
+
+ relations=_.union(new_relations,relations);
+ relations= check_Relation(metadata,relations);
+
+ }});
+
}
- });
-}
+ _.each(metadata, function(m){
+
+ for(i=0;i<neighbour_node.length;i++)
+ {
+ if(m._id==neighbour_node[i])
+ {m.expanded="true";}
+ else
+ {m.expanded="false";}
+ }
+
+
+ });
+
+ init(metadata,relations);
+ load({{object.id}}) ;
+
+
+
+ }
+
+
+
+
+ else if(d._id>0)
+ {
+
+ neighbour_node =neighbour_node.concat(d._id);
+
+ d3.select("#amazingViz").remove();
+
+ $.getJSON('/nodetypes/graphs/graph_json/' + d._id , function (json2) {
+ new_metadata=json2.node_metadata;
+ new_relations=json2.relations;
+
+ metadata=_.union(new_metadata,metadata);
+ relations=_.union(new_relations,relations);
+ relations= check_Relation(metadata,relations);
+
+ _.each(metadata, function(m){
+
+ for(i=0;i<neighbour_node.length;i++)
+ {
+ if(m._id==neighbour_node[i])
+ m.expanded="true";
+ }
+
+
+ });
+
+ init(metadata,relations);
+ load({{object.id}});
+
+
+ });
+
+ }
});
+}
+
+});
+
new_g.on("click", function(d) {
@@ -429,7 +530,8 @@ $(window).bind('keydown',function(event){
.style("fill-opacity", ".2")
.style("stroke", "#666")
.style("stroke-width", "1.5px")
- .style("fill", function color(d) {var e=(d._id).charAt(0); if (d.expanded=="true") return "red"; else return "none"});
+ .style("fill", function color(d) {if (d.expanded=="true" && d.refType=="Objecttype") return "blue"; else if(d.expanded=="true" && d.refType=="Gbobject") return "red"; else return "none"});
+
@@ -467,6 +569,35 @@ $(window).bind('keydown',function(event){
}
+function check_Relation(metadata,relations)
+{
+ _.each(metadata,function(d){
+ if (d.refType=="Relation")
+ {
+ a=d.inverse;
+ if (d.flag==1)
+ {
+ relations= _.reject(relations,function(e)
+ {
+ return e.type==a
+ });
+ }
+ else if (d.flag==0)
+ {
+ relations= _.reject(relations,function(e)
+ {
+ return e.type==d.screen_name
+ });
+ }
+ }
+
+ });
+ return relations;
+
+
+}
+
+
});
//fgraph({{object.id}});