0

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

Rupesh
  • 27
  • 7

1 Answers1

2

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.

Jason Plurad
  • 6,682
  • 2
  • 18
  • 37
  • Thanks. I used the same config file and changed to titan0.5.4 all. Thant solved the problem. – Rupesh Aug 24 '15 at 07:31