Database Reference
In-Depth Information
while(iter.hasNext())
{
Vertex v = iter.next();
Iterable<Edge> keys =
v.getEdges(Direction.BOTH);
...
}
3.
Each edge will have IN and OUT vertices, and we can retrieve those
vertices via edges:
for(Edge key : keys)
{
System.out.print(key.getVertex(Direction.IN).toString());
// will print vivs on consle
System.out.print("=>");
System.out.print(key.getLabel());
System.out.print("=>");
System.out.println(key.getVertex(Direction.OUT).toString());
// will print tweets or apress
}
The preceding reading and writing to a Titan graph provides a simple recipe for
how to use Titan with Cassandra.
Cassandra is all about large data processing and analytics. It is no different when
working with a graph-based model using Cassandra. So what about batch processing of
data with a Titan graph database? Titan does provide support for batch data processing,
and in the next example we will explore how to perform batch loading using the Titan
Java API.
Batch Loading
Titan provides support for batch loading using the BatchGraph API, which can be
thought of as a wrapper around TitanGraph with configurable parameters to define
batch size and the type of vertex ID. We can create a BatchGraph instance as fol-
lows:
Search WWH ::




Custom Search