Search in sources :

Example 1 with RyaStatementWritable

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();
}
Also used : MapDriver(org.apache.hadoop.mrunit.mapreduce.MapDriver) RyaStatementWritable(org.apache.rya.accumulo.mr.RyaStatementWritable) RyaStatement(org.apache.rya.api.domain.RyaStatement) LongWritable(org.apache.hadoop.io.LongWritable) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with RyaStatementWritable

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;
}
Also used : RyaStatementWritable(org.apache.rya.accumulo.mr.RyaStatementWritable) RyaStatement(org.apache.rya.api.domain.RyaStatement) Text(org.apache.hadoop.io.Text)

Example 3 with RyaStatementWritable

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;
}
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)

Example 4 with RyaStatementWritable

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();
}
Also used : RyaStatementWritable(org.apache.rya.accumulo.mr.RyaStatementWritable) RyaStatement(org.apache.rya.api.domain.RyaStatement) LongWritable(org.apache.hadoop.io.LongWritable) Fact(org.apache.rya.reasoning.Fact) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

RyaStatementWritable (org.apache.rya.accumulo.mr.RyaStatementWritable)4 RyaStatement (org.apache.rya.api.domain.RyaStatement)4 LongWritable (org.apache.hadoop.io.LongWritable)2 Text (org.apache.hadoop.io.Text)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 ArrayList (java.util.ArrayList)1 Edge (org.apache.giraph.edge.Edge)1 MapDriver (org.apache.hadoop.mrunit.mapreduce.MapDriver)1 RyaTypeWritable (org.apache.rya.accumulo.mr.RyaTypeWritable)1 Fact (org.apache.rya.reasoning.Fact)1