Search in sources :

Example 1 with Edge

use of org.apache.giraph.edge.Edge in project incubator-rya by apache.

the class RyaVertexReader method getCurrentVertex.

@Override
public Vertex<Text, RyaTypeWritable, RyaStatementWritable> getCurrentVertex() throws IOException, InterruptedException {
    RyaStatementWritable currentStatement = reader.getCurrentValue();
    RyaStatement ryaStatement = currentStatement.getRyaStatement();
    RyaTypeWritable vertexWritable = new RyaTypeWritable();
    vertexWritable.setRyaType(ryaStatement.getSubject());
    Text vertexId = new Text(ryaStatement.getSubject().getData());
    Vertex<Text, RyaTypeWritable, RyaStatementWritable> vertex = classesConfiguration.createVertex();
    Edge<Text, RyaStatementWritable> edge = EdgeFactory.create(new Text(ryaStatement.toString()), currentStatement);
    List<Edge<Text, RyaStatementWritable>> edges = new ArrayList<Edge<Text, RyaStatementWritable>>();
    edges.add(edge);
    vertex.initialize(vertexId, vertexWritable, edges);
    return vertex;
}
Also used : RyaStatementWritable(org.apache.rya.accumulo.mr.RyaStatementWritable) ArrayList(java.util.ArrayList) RyaStatement(org.apache.rya.api.domain.RyaStatement) Text(org.apache.hadoop.io.Text) RyaTypeWritable(org.apache.rya.accumulo.mr.RyaTypeWritable) Edge(org.apache.giraph.edge.Edge)

Aggregations

ArrayList (java.util.ArrayList)1 Edge (org.apache.giraph.edge.Edge)1 Text (org.apache.hadoop.io.Text)1 RyaStatementWritable (org.apache.rya.accumulo.mr.RyaStatementWritable)1 RyaTypeWritable (org.apache.rya.accumulo.mr.RyaTypeWritable)1 RyaStatement (org.apache.rya.api.domain.RyaStatement)1