From 42b680109f6eae094fdd54b28a37ee2e827c854d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=28Lopin=29=20Lopat=C3=A1=C5=99?= Date: Wed, 22 Jun 2022 20:36:45 +0200 Subject: [PATCH] fixed respecting vertex-limit on edges query & handling special characters in property names (#105) * fixed respecting vertex-limit on edges query * fixed handling special characters in property names --- scripts/graphShapes.js | 2 +- scripts/graphioGremlin.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/graphShapes.js b/scripts/graphShapes.js index b9eac30..9c9dbbe 100644 --- a/scripts/graphShapes.js +++ b/scripts/graphShapes.js @@ -224,7 +224,7 @@ var graphShapes = (function(){ for (var prop_idx in item_properties){ var prop_name = item_properties[prop_idx]; var prop_id_nb = prop_idx; - var prop_id = item+"_"+prop_name; + var prop_id = item+"_"+CSS.escape(prop_name); if((!d3.select("#"+prop_id).empty()) && d3.select("#"+prop_id).property("checked")){ attach_property(selected_items,prop_name,prop_id_nb,item); } diff --git a/scripts/graphioGremlin.js b/scripts/graphioGremlin.js index 0da9345..8fa2db2 100644 --- a/scripts/graphioGremlin.js +++ b/scripts/graphioGremlin.js @@ -151,6 +151,9 @@ var graphioGremlin = (function(){ console.log("Node query: "+nodeQuery); console.log("Edge query: "+edgeQuery); send_to_server(nodeQuery, null, null, null, function(nodeData){ + var vIdsArgs = graphson3to1(nodeData).map(function(v) { return `'${v.id}'` }).join(); + edgeQuery = edgeQuery.replace(/^g.V\(\)/, `g.V(${vIdsArgs})`); + console.log("Edge query: "+edgeQuery); send_to_server(edgeQuery, null, null, null, function(edgeData){ var combinedData = [nodeData,edgeData]; handle_server_answer(combinedData, 'search', null, message); @@ -602,7 +605,7 @@ function get_vertex_prop_in_list(vertexProperty){ } function graphson3to1(data){ - // Convert data from graphSON v2 format to graphSON v1 + // Convert data from graphSON v3 format to graphSON v1 if (!(Array.isArray(data) || ((typeof data === "object") && (data !== null)) )) return data; if ('@type' in data) { if (data['@type']=='g:List'){