Not loading data from titan graph with cassandra backend using gremlin.

262 views Asked by At

I have added data in titan(cassandra backend) using blueprint api with java. I used following configuration in java for inserting data.

 TitanGraph getTitanGraph()
{
    conf2 = new BaseConfiguration();
    conf2.setProperty("storage.backend", "cassandra");
    conf2.setProperty("storage.directory","/some/directory");
    conf2.setProperty("storage.read-only", "false");
    conf2.setProperty("attributes.allow-all", true);
    return TitanFactory.open(conf2);
}

Now I am trying to query that database using gremlin. I used following cmd to load it

 g = TitanFactory.open("bin/cassandra.local");

following is my cassandra.local file

 conf = new BaseConfiguration();
 conf.setProperty("storage.backend","cassandra");
 conf.setProperty("storage.hostname","127.0.0.1");
 conf.setProperty("storage.read-only", "false");
 conf.setProperty("attributes.allow-all", true)

but when I am running "g.V", I am getting empty graph. Please help

thanks

1

There are 1 answers

1
Jason Plurad On BEST ANSWER

Make sure that you commit the changes to your TitanGraph after making graph mutations in your Java program. If you're using Titan 0.5.x, the call is graph.commit(). If you're using Titan 0.9.x, the call is graph.tx().commit().

Note that storage.directory isn't valid for a Cassandra backend, however the default value for storage.hostname is 127.0.0.1 so those should be the same between your Java program and cassandra.local. It might be easier to use a properties file to store your connection properties.