Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bricaud/graphexp
Browse files Browse the repository at this point in the history
  • Loading branch information
bricaud committed Apr 15, 2020
2 parents 20c76e5 + 568eabf commit 219115a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store

d3/
font-awesome-4.7.0/
jquery*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ On your web browser, just access the file `graphexp.html`.

Next step, configure the server settings on the bottom of the page. The default Gremlin server address is `localhost:8182`. You will have to specify the communication protocol `websocket` or `REST` and the gremlin server version. Graphexp is not able to handle secure connections yet and a contribution on this topic would be welcome.

Graphexp works with [Amazon Neptune](https://aws.amazon.com/neptune) thanks to a pull request of [jwalton922](https://github.com/jwalton922). With this database, set `SINGLE_COMMANDS_AND_NO_VARS = true` in the file `graphConf.js`.
Graphexp works with [Amazon Neptune](https://aws.amazon.com/neptune). With this database, set `SINGLE_COMMANDS_AND_NO_VARS = true` in the file `graphConf.js`. if you use REST over `https` you may need to set `REST_USE_HTTPS = true` as well.

Additional parameters can be configured inside the file `graphConf.js`.

Expand Down
1 change: 1 addition & 0 deletions graphexp.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ <h1 class="header-heading">Graph Explorer v 0.6</h1>
<label for="server_protocol">Protocol:</label>
<select name="server_protocol" id="server_protocol">
<option value="websocket">websocket</option>
<option value="websockets">websocket secure</option>
<option value="REST">REST</option>
</select>
</div>
Expand Down
3 changes: 3 additions & 0 deletions scripts/graphConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const host = false;
// For implementations like Neptune where only single commands are allowed per request
// set to true
const SINGLE_COMMANDS_AND_NO_VARS = false;
// For implementations like Neptune where communication only over https is allowed
// set to true
const REST_USE_HTTPS = false;

// Time out for the REST protocol. Increase it if the graphDB is slow.
const REST_TIMEOUT = 2000
Expand Down
15 changes: 12 additions & 3 deletions scripts/graphioGremlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ var graphioGremlin = (function(){
var edge_filter = $('#edge_filter').val();
var communication_method = $('#communication_method').val();
var id = d.id;
if(isNaN(id)){ // Add quotes if id is a string (not a number).
if (typeof id === 'string' || id instanceof String) { // Add quotes if id is a string (not a number).
id = '"'+id+'"';
}
// Gremlin query
Expand Down Expand Up @@ -216,13 +216,22 @@ var graphioGremlin = (function(){
let server_port = $('#server_port').val();
let COMMUNICATION_PROTOCOL = $('#server_protocol').val();
if (COMMUNICATION_PROTOCOL == 'REST'){
let server_url = "http://"+server_address+":"+server_port;
let server_url = ""
if(REST_USE_HTTPS){
server_url = "https://"+server_address+":"+server_port;
} else{
server_url = "http://"+server_address+":"+server_port;
}
run_ajax_request(gremlin_query,server_url,query_type,active_node,message,callback);
}
else if (COMMUNICATION_PROTOCOL == 'websocket'){
let server_url = "ws://"+server_address+":"+server_port+"/gremlin"
run_websocket_request(gremlin_query,server_url,query_type,active_node,message,callback);
}
else if (COMMUNICATION_PROTOCOL == 'websockets'){
let server_url = "wss://"+server_address+":"+server_port+"/gremlin"
run_websocket_request(gremlin_query,server_url,query_type,active_node,message,callback);
}
else {
console.log('Bad communication protocol. Check configuration file. Accept "REST" or "websocket" .')
}
Expand Down Expand Up @@ -442,7 +451,7 @@ var graphioGremlin = (function(){
// find the element in list with id equal to elem
// return its index or null if there is no
for (var i=0;i<list.length;i++) {
if (list[i].id == elem) return i;
if (list[i].id === elem) return i;
}
return null;
}
Expand Down

0 comments on commit 219115a

Please sign in to comment.