From 20c76e5e53a683de43845e8b973a05632a572d18 Mon Sep 17 00:00:00 2001 From: bricaud Date: Wed, 15 Apr 2020 16:48:47 +0200 Subject: [PATCH] add node and edge limits to graph info query --- scripts/graphConf.js | 2 ++ scripts/graphioGremlin.js | 8 ++++---- scripts/infobox.js | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/graphConf.js b/scripts/graphConf.js index 8a0b882..f002e39 100644 --- a/scripts/graphConf.js +++ b/scripts/graphConf.js @@ -13,6 +13,8 @@ const SINGLE_COMMANDS_AND_NO_VARS = false; const REST_TIMEOUT = 2000 // TODO: configuration for the secure server +// limit number for graph info (avoid overwhelming the server for large graphs) +const limit_request = 10000 // Graph configuration const default_nb_of_layers = 3; diff --git a/scripts/graphioGremlin.js b/scripts/graphioGremlin.js index 25f993c..46bb2b5 100644 --- a/scripts/graphioGremlin.js +++ b/scripts/graphioGremlin.js @@ -53,10 +53,10 @@ var graphioGremlin = (function(){ } function get_graph_info(){ - var gremlin_query_nodes = "nodes = " + traversal_source + ".V().groupCount().by(label);" - var gremlin_query_edges = "edges = " + traversal_source + ".E().groupCount().by(label);" - var gremlin_query_nodes_prop = "nodesprop = " + traversal_source + ".V().valueMap().select(keys).groupCount();" - var gremlin_query_edges_prop = "edgesprop = " + traversal_source + ".E().valueMap().select(keys).groupCount();" + var gremlin_query_nodes = "nodes = " + traversal_source + ".V().limit(" + limit_request + ").groupCount().by(label);" + var gremlin_query_edges = "edges = " + traversal_source + ".E().limit(" + limit_request + ").groupCount().by(label);" + var gremlin_query_nodes_prop = "nodesprop = " + traversal_source + ".V().limit(" + limit_request + ").valueMap().select(keys).groupCount();" + var gremlin_query_edges_prop = "edgesprop = " + traversal_source + ".E().limit(" + limit_request + ").valueMap().select(keys).groupCount();" var gremlin_query = gremlin_query_nodes+gremlin_query_nodes_prop +gremlin_query_edges+gremlin_query_edges_prop diff --git a/scripts/infobox.js b/scripts/infobox.js index 73cbf43..505649f 100644 --- a/scripts/infobox.js +++ b/scripts/infobox.js @@ -31,6 +31,7 @@ var infobox = (function(){ function create(label_graph,label_graphElem){ var graph_bar = d3.select(label_graph); graph_bar.append("h2").text("Graph Info"); + graph_bar.append("h4").text("Limited to the first " + limit_request + " nodes and edges"); _table_Graphinfo = graph_bar.append("table").attr("id","tableGraph"); init_table(_table_Graphinfo,["Type","Count"]);