From 7acabda2e0e26534c027bfcf39c41ce54afde449 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Sun, 17 Sep 2023 06:49:07 -0600 Subject: [PATCH] Fix child traversal error in query (#104) * Fix child traversal error in query * Fix graph node coloring --- scripts/graphioGremlin.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/graphioGremlin.js b/scripts/graphioGremlin.js index 8fa2db2..f3a5839 100644 --- a/scripts/graphioGremlin.js +++ b/scripts/graphioGremlin.js @@ -135,7 +135,7 @@ var graphioGremlin = (function(){ let gremlin_query_edges = "edges = " + traversal_source + ".V(nodes).aggregate('node').outE().as('edge').inV().where(within('node')).select('edge').toList();"; let gremlin_query_edges_no_vars = "edges = " + traversal_source + ".V()"+has_str+".aggregate('node').outE().as('edge').inV().where(within('node')).select('edge').toList();"; //let gremlin_query_edges_no_vars = "edges = " + traversal_source + ".V()"+has_str+".bothE();"; - let gremlin_query = gremlin_query_nodes + gremlin_query_edges + "[nodes,edges]"; + let gremlin_query = 'g = graph.traversal();' + gremlin_query_nodes + gremlin_query_edges + "[nodes,edges]"; console.log(gremlin_query); // while busy, show we're doing something in the messageArea. @@ -184,7 +184,7 @@ var graphioGremlin = (function(){ if (communication_method == "GraphSON3_4") { // Version 3.4 gremlin_query_nodes += ".valueMap().with(WithOptions.tokens)"; - gremlin_query_nodes += '.fold().inject(' + traversal_source + '.V(' + id + ').valueMap().with(WithOptions.tokens)).unfold()'; + gremlin_query_nodes += '.fold().inject(' + '__' + '.V(' + id + ').valueMap().with(WithOptions.tokens)).unfold()'; } else { gremlin_query_nodes += '.fold().inject(' + traversal_source + '.V(' + id + ')).unfold()'; } @@ -535,8 +535,12 @@ var graphioGremlin = (function(){ //console.log(prop_dic) for (var key in prop_dic) { if (prop_dic.hasOwnProperty(key)) { - if (data.type == 'vertex') {// Extracting the Vertexproperties (properties of properties for vertices) - var property = prop_dic[key].toString(); + if (key == "properties") { + data_dic.properties = { ...data_dic.properties, ...prop_dic[key]} + continue; + } + else if (data.type == 'vertex') {// Extracting the Vertexproperties (properties of properties for vertices) + //var property = prop_dic[key].toString(); //property['summary'] = get_vertex_prop_in_list(prop_dic[key]).toString(); //property = get_vertex_prop_in_list(prop_dic[key]).toString(); } else {