Database Reference
In-Depth Information
conf.setProperty("storage.port", "9160");
conf.setProperty("storage.keyspace",
"batchprocess");
conf.setProperty("storage.batch-loading",
"true");
2.
Let's load the sample .csv file using FileReader :
File file = new File("src/main/resources/
bulk_load.csv");
BufferedReader reader = new
BufferedReader(new FileReader(file));
3.
Next, create an instance of a graph and wrap it with BatchGraph :
TitanGraph graph = TitanFactory.open(conf);
BatchGraph bgraph = new BatchGraph(graph,
VertexIDType.STRING, 1000);
Here 1000 is the batch size and the vertex ID is of string type.
4.
Now let's define each vertex property as a vertex key and each edge's
property as a label key:
// prepare vertex key for each property
KeyMaker maker = graph.makeKey("twitter_tag");
maker.dataType(String.class);
maker.make();
graph.makeKey("fname").dataType(String.class).make();
graph.makeKey("lname").dataType(String.class).make();
// prepare edge properties as label
LabelMaker labelMaker =
graph.makeLabel("contentType");
labelMaker.make();
graph.makeLabel("following").make();
Search WWH ::




Custom Search