[ 
https://issues.apache.org/jira/browse/TINKERPOP-1839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16259297#comment-16259297
 ] 

David Pitera commented on TINKERPOP-1839:
-----------------------------------------

According to this 
http://tinkerpop.apache.org/docs/3.2.6/reference/#connecting-via-remotegraph we 
can grab a remote traversal source reference via `withRemote()` if we pass in 
the variable name that is bound to the graph's traversal source (in the example 
listed:

```
gremlin> cluster = Cluster.open('conf/remote-objects.yaml')
==>localhost/127.0.0.1:8182
gremlin> b = Bindings.instance()
==>bindings[main]
gremlin> g = 
EmptyGraph.instance().traversal().withRemote(DriverRemoteConnection.using(cluster,
 "g"))
==>graphtraversalsource[emptygraph[empty], standard]
```

`g` is the variable name bound to the traversal reference on the remote server. 
I assume this binding is done through global bindings, i.e. defined in one of 
the startup scripts.

 Similarly, many clients make you pass in the variable name bound to the graph 
for access to a Gremlin Server.

However, JanusGraph's new notion of dynamic graphs instantiates graph 
references post server start; the documentation for this new functionality is 
here: http://docs.janusgraph.org/latest/configuredgraphfactory.html

The gist of it is that you dynamically create configurations for your graphs, 
stored on vertices, and then you use those configurations to dynamically create 
and access graphs doing: `def graph = 
ConfiguredGraphFactory.open(<graphName>);`. Since these graphs are not known 
are server start, they cannot currently be bound to any variables through the 
use of global bindings; currently users must "grab the graph reference" every 
gremlin script execution by doing the aforementioned command at the beginning 
of the every script. 

It would be great if there were a way to dynamically update the server's global 
bindings so that `graph` can always be bound to the literal graph reference 
bound to `ConfiguredGraphFactory.open(<graphName>);` as well as `g` to 
`graph.traversal();` so they can make use of the `withRemote` of the clients 
that need variable names bound to references to work.

> We need a way to dynamically modify global bindings on the Gremlin Server.
> --------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1839
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1839
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.2.6
>            Reporter: David Pitera
>
> This question on StackOverflow 
> https://stackoverflow.com/questions/47342524/how-to-traverse-graph-created-using-configuredplanfactory-in-janusgraph/47354728?noredirect=1#comment81670711_47354728
>  along with the fact that most language client's interact with the Gremlin 
> Server through the use of a variable bound to a graph of traversal reference, 
> i.e. `graph` is usually bound to a graph and `g` is usually bound to its 
> traversal 
> https://github.com/apache/tinkerpop/blob/master/gremlin-server/scripts/empty-sample.groovy#L40
>  mean that we need a way to bind these dynamically created graphs to the 
> script executor.
> With JanusGraph's notion of dynamic graphs, there is no way to make use of 
> the `withRemote()` functionality or make use of language clients demanding 
> the traversal reference be bound to a variable.
> Therefore, we need a way to dynamically modify the global bindings on the 
> gremlin script engine without having to restart the server.
> Note; I answered the original stack overflow question above, however I am 
> pretty sure my answer is actually incorrect because the global binding will 
> be evaluated once at server start and the evaluated references will be stored 
> in the map and passed into the gremlin executor. Is this true?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to