Skip to content

Commit

Permalink
Bug fix for Neptune Compatability (#28)
Browse files Browse the repository at this point in the history
* fix bug with search and single command no vars options - useful for neptune

* add the option to set host value in conf
  • Loading branch information
jwalton922 authored and bricaud committed May 9, 2018
1 parent 13d7423 commit 3756dd2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion graphexp.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ <h1 class="header-heading">Graph Explorer v 0.6</h1>
</div>
<!-- INITIALIZATION -->
<script type="text/javascript">

if(host){
$('#server_address').val(host);
}
init_property_bar();
// Create the graph canvas in the chosen div element
graph_viz.init("#main");
Expand Down
3 changes: 2 additions & 1 deletion scripts/graphConf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

// configuration for the graph database access

// if host is set, will override default localhost server option
//const host = "some_gremlin_server"
// For implementations like Neptune where only single commands are allowed per request
// set to true
const SINGLE_COMMANDS_AND_NO_VARS = false;
Expand Down
13 changes: 9 additions & 4 deletions scripts/graphioGremlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ var graphioGremlin = (function(){
query = query.substring(equalIndex+1,semiColonIndex);
}
}
var returnQuery = query.trim()+".toList();";
var returnQuery = query.trim();
// if(returnQuery.endsWith(".toList();")){
// returnQuery = returnQuery+".toList();";
// }
return returnQuery;
}

Expand Down Expand Up @@ -119,6 +122,8 @@ var graphioGremlin = (function(){
gremlin_query_nodes += ".toList();";
}
let gremlin_query_edges = "edges = g.V(nodes).aggregate('node').outE().as('edge').inV().where(within('node')).select('edge').toList();";
let gremlin_query_edges_no_vars = "edges = g.V()"+has_str+".aggregate('node').outE().as('edge').inV().where(within('node')).select('edge').toList();";
//let gremlin_query_edges_no_vars = "edges = g.V()"+has_str+".bothE();";
let gremlin_query = gremlin_query_nodes + gremlin_query_edges + "[nodes,edges]";
console.log(gremlin_query);

Expand All @@ -131,11 +136,11 @@ var graphioGremlin = (function(){
var message = "";
if (SINGLE_COMMANDS_AND_NO_VARS) {
var nodeQuery = create_single_command(gremlin_query_nodes);
var edgeQuery = create_single_command(gremlin_query_edges);
var edgeQuery = create_single_command(gremlin_query_edges_no_vars);
console.log("Node query: "+nodeQuery);
console.log("Edge query: "+edgeQuery);
send_to_server(nodeQuery, null, null, null, function(nodeData){
send_to_server(edgeQuery, null, null, null, function(edgeData){
send_to_server(nodeQuery, null, null, null, function(nodeData){
send_to_server(edgeQuery, null, null, null, function(edgeData){
var combinedData = [nodeData,edgeData];
handle_server_answer(combinedData, 'search', null, message);
});
Expand Down

0 comments on commit 3756dd2

Please sign in to comment.