use of org.apache.rya.accumulo.mr.RyaStatementWritable in project incubator-rya by apache.
the class DuplicateEliminationTest method testRdfMapperOutput.
@Test
public void testRdfMapperOutput() throws Exception {
RyaStatement rya = TestUtils.ryaStatement("x", "subOrganizationOf", "y");
RyaStatementWritable rsw = new RyaStatementWritable();
rsw.setRyaStatement(rya);
LongWritable l = new LongWritable();
new MapDriver<LongWritable, RyaStatementWritable, Fact, Derivation>().withMapper(new DuplicateElimination.DuplicateRdfMapper()).withInput(l, rsw).withOutput(X_SUB_Y, X_SUB_Y.getDerivation()).runTest();
}
use of org.apache.rya.accumulo.mr.RyaStatementWritable in project incubator-rya by apache.
the class RyaEdgeReader method getCurrentEdge.
@Override
public Edge<Text, RyaStatementWritable> getCurrentEdge() throws IOException, InterruptedException {
RyaStatementWritable currentStatement = reader.getCurrentValue();
RyaStatement ryaStatement = currentStatement.getRyaStatement();
Edge<Text, RyaStatementWritable> edge = EdgeFactory.create(new Text(ryaStatement.toString()), currentStatement);
return edge;
}
use of org.apache.rya.accumulo.mr.RyaStatementWritable 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;
}
use of org.apache.rya.accumulo.mr.RyaStatementWritable in project incubator-rya by apache.
the class ForwardChainTest method testRdfMapperOutput.
@Test
public void testRdfMapperOutput() throws Exception {
RyaStatement rya = TestUtils.ryaStatement("x", "subOrganizationOf", "y");
RyaStatementWritable rsw = new RyaStatementWritable();
rsw.setRyaStatement(rya);
LongWritable l = new LongWritable();
ResourceWritable rw1 = new ResourceWritable();
ResourceWritable rw2 = new ResourceWritable();
rw1.set(TestUtils.uri("x"));
rw2.set(TestUtils.uri("y"));
new MapDriver<LongWritable, RyaStatementWritable, ResourceWritable, Fact>().withMapper(new ForwardChain.RdfMapper(schema)).withInput(l, rsw).withOutput(rw1, X_SUB_Y).withOutput(rw2, X_SUB_Y).runTest();
}
Aggregations