0

The following code snippet tries to connect to Graph and perform some operations on it. It is intended to run using DSE Java driver 1.1, for Graph.

import com.datastax.driver.dse.graph.GraphStatement; 
import com.datastax.driver.dse.graph.SimpleGraphStatement; 
import com.datastax.driver.dse.DseCluster; 
import com.datastax.driver.dse.DseSession;

public class GraphTest {

    public static void main(String[] args) {
        System.out.println("Start...");

        DseCluster dseCluster = DseCluster.builder()
                    .addContactPoint("127.0.0.1")
                    .build();
        DseSession dseSession = dseCluster.connect();dseSession.executeGraph("system.graph('demo').ifNotExists().create()");

        GraphStatement s1 = new SimpleGraphStatement("g.addV(label, 'test_vertex')").setGraphName("demo");      
        dseSession.executeGraph(s1);

        GraphStatement s2 = new SimpleGraphStatement("g.V()").setGraphName("demo");         
        GraphResultSet rs = dseSession.executeGraph(s2);

        System.out.println(rs.one().asVertex());
        System.out.println("End."); 
    }
}

However, compilation gives the following error:

javac -cp .\dse-driver-1.1.0.jar GraphTest.java

GraphTest.java:12: error: cannot access DelegatingCluster DseCluster dseCluster = DseCluster.builder() ^ class file for com.datastax.driver.core.DelegatingCluster not found GraphTest.java:16: error: cannot access Session DseSession dseSession = dseCluster.connect();dseSession.executeGraph("system.graph('demo').ifNotExists().create()"); ^ class file for com.datastax.driver.core.Session not found GraphTest.java:22: error: cannot find symbol GraphResultSet rs = dseSession.executeGraph(s2); ^ symbol: class GraphResultSet location: class GraphTest 3 errors

Which looks like something wrong accessing the classes for setting up the session. Is there anything missing here?

stephen mallette
  • 45,298
  • 5
  • 67
  • 135
peleitor
  • 459
  • 7
  • 24

1 Answers1

0

Get the dependencies from Maven and it will do it.

Check: http://docs.datastax.com/en/developer/java-driver-dse//1.1.0/

peleitor
  • 459
  • 7
  • 24