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

ASF GitHub Bot commented on TINKERPOP-1959:
-------------------------------------------

dkuppitz commented on a change in pull request #952: TINKERPOP-1959 submit 
scripts in javascript
URL: https://github.com/apache/tinkerpop/pull/952#discussion_r223372405
 
 

 ##########
 File path: docs/src/upgrade/release-3.2.x-incubating.asciidoc
 ##########
 @@ -105,6 +105,48 @@ packaged dataset that needed to be loaded through the 
various IO options availab
 benefit of `TinkerFactory` to help get them bootstrapped. For 3.2.10, Grateful 
Dead is now more conveniently loaded
 via that same method as the other toy graphs with 
`TinkerFactory.createGratefulDead()`.
 
+==== Gremlin Javascript Script Submission
+
+Gremlin Javascript can now submit script, with optional bindings, using the 
`Client` class:
+
+[source,javascript]
+----
+const gremlin = require('gremlin');
+const connection = new gremlin.driver.Client('ws://localhost:8182/gremlin', { 
traversalSource: 'g' });
+
+connection.submit('g.V().tail()')
+    .then(response => {
+        console.log(response.traversers.length);
+        console.log(response.traversers[0]);
+    });
+
+connection.submit('g.V(vid)', {vid: 1})
+    .then(response => {
+        console.log(response.traversers.length);
+        console.log(response.traversers[0]);
+    });
+----
+
+and also allows translation of bytecode steps into script:
+
+[source,javascript]
+----
+const gremlin = require('gremlin');
+const graph = new gremlin.process.Graph();
+const connection = new gremlin.driver.Client('ws://localhost:8182/gremlin', { 
traversalSource: 'g' });
+const translator = new gremlin.process.Translator('g');
+
+const g = graph.traversal();
+g.V().tail();
+const script = translator.translate(g.getBytecode());
 
 Review comment:
   Shouldn't these 2 lines be 1?
   ```
   const script = translator.translate(g.V().tail().getBytecode());
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Provide a way to submit scripts to the server in gremlin-javascript
> -------------------------------------------------------------------
>
>                 Key: TINKERPOP-1959
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1959
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: javascript
>    Affects Versions: 3.2.8
>            Reporter: stephen mallette
>            Priority: Critical
>
> It is currently only possible to submit bytecode based requests to the server 
> with gremlin-javascript. We should also provide some means for submitting 
> scripts.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to