I am using a simple Gremlin RESTful server and I am sending simple commands inside a POST request. For example, if I want to create edges (in my specific format), I have the following template:
const nodeCommandFormat = "graph.addVertex('%s', '%s', 'evid', '%s');"
;
Sending a long string with chained commands like this works fine, all the edges are created. My question is: why it does not work with the edges creation? Until now, I tried with this two commands:
const newEdgeCommandFormat = "g.V().has('evid', '%s').addE('next').to(g.V().has('evid', '%s')).property('count', 1);"
;
or
x = g.V().has('evid', ...).next(); y = g.V().has('evid', ...).next(); x.addEdge('next', y, 'count', 1)
;
However, if I concatenate 100 commands like this, only the edge corresponding to the last command is created. Why is that? On the other hand, I also receive errors like this:
- Using first type of edge creation: [WARN] HttpGremlinEndpointHandler - Invalid request - responding with 500 Internal Server Error and The provided traverser does not map to a value: v[3091]->[TinkerGraphStep(vertex,[evid.eq(6ba0b28797dd79a2ee198d8ff280c4ff)])]
- Using the second type of edge creation: java.util.NoSuchElementException at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:204)
How do I achive dynamic edge creation using Gremlin REST server?
P.S. All my nodes have "evid" property (event-id) which is the md5 value of an object. I use this as an identifier for my nodes.
Thank you!