title: DSE Graph with Java Driver, how to add edges
body: <p>I want to build a graph completely with the Datastax Java Driver. I managed to insert vertices, but I have no clue how to add edges to existing vertices.</p>
  
  <p>When I run the following code</p>
  
  <pre><code>session.executeGraph("parent = g.V().has('businessId','sys-1').next()");
  session.executeGraph("child = g.V().has('businessId','sys-2').next()");
  session.executeGraph("parent.addEdge('consistsOf', child)");
  </code></pre>
  
  <p>I get an exception</p>
  
  <pre><code>Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: No such property: parent for class: Script285
      at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50)
      at com.datastax.driver.dse.DriverThrowables.propagateCause(DriverThrowables.java:29)
      at com.datastax.driver.dse.DefaultDseSession.executeGraph(DefaultDseSession.java:77)
      at com.datastax.driver.dse.DefaultDseSession.executeGraph(DefaultDseSession.java:64)
      at de.pratho.valpro.tools.Main.main(Main.java:41)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: No such property: parent for class: Script285
      at com.datastax.driver.core.Responses$Error.asException(Responses.java:136)
      at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:179)
      at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:173)
      at com.datastax.driver.core.RequestHandler.access$2500(RequestHandler.java:43)
      at com.datastax.driver.core.RequestHandler$SpeculativeExecution.setFinalResult(RequestHandler.java:788)
      at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:607)
      at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1012)
      at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:935)
      at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
      at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
      at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
      at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
      at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
      at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
      at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:276)
      at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:263)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
      at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
      at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
      at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
      at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
      at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>When I run the gremlin statements in the gremlin_console_window it is working fine. So I think variables like <code>parent</code> and <code>child</code> are not working within a Java <code>DseSession</code>?</p>
  
  <p>Unfortunately, I was not able to find much information about how to work with the Java Driver properly.</p>