I had to use JanusGraph to retrieve and add data to it from java program. But i don't know how do i connect to a particular graph of db.Below is the code that i am using to insert data in the db but when i try to see the data from gremlin console, i cannot find the same data.
JanusGraph graph = JanusGraphFactory.open("conf/janusgraph-cassandra-es.properties");
GraphTraversalSource g = graph.traversal();
graph.addVertex("psid",psid,"firstname",firstname,"last_name",lastname, "locale", locale ,"timezone",timezone, "gender" ,gender,"channel_id",channel_id);
Gremlin query that i am doing:
gremlin> JanusGraph graph = JanusGraphFactory.open("conf/janusgraph-cassandra-es.properties");
gremlin> GraphTraversalSource g = graph.traversal();
gremlin> g.V().count()
count query gives 0 as output and i cannot find any data in the db.
Did you commit your graph transaction after adding the vertex? Till the time you do not commit a transaction it stays in memory instance and is not committed to the graph. Commit using:
graph.tx().commit()
Try again to query the graph through gremlin after executing the above line of code. Your vertex should now be there on the graph.