Search in sources :

Example 6 with Fact

use of org.apache.rya.reasoning.Fact in project incubator-rya by apache.

the class ForwardChainTest method testTableMapperOutput.

@Test
public void testTableMapperOutput() throws Exception {
    RyaStatement rya = TestUtils.ryaStatement("x", "subOrganizationOf", "y");
    TripleRowResolver trr = new WholeRowTripleResolver();
    Map<TABLE_LAYOUT, TripleRow> map = trr.serialize(rya);
    TripleRow tr = map.get(TABLE_LAYOUT.SPO);
    byte[] b = new byte[0];
    Key key = new Key(tr.getRow(), tr.getColumnFamily(), tr.getColumnQualifier(), b, 1);
    Value val = new Value(b);
    ResourceWritable rw1 = new ResourceWritable();
    ResourceWritable rw2 = new ResourceWritable();
    rw1.set(TestUtils.uri("x"));
    rw2.set(TestUtils.uri("y"));
    new MapDriver<Key, Value, ResourceWritable, Fact>().withMapper(new ForwardChain.TableMapper(schema)).withInput(key, val).withOutput(rw1, X_SUB_Y).withOutput(rw2, X_SUB_Y).runTest();
}
Also used : TripleRowResolver(org.apache.rya.api.resolver.triple.TripleRowResolver) RyaStatement(org.apache.rya.api.domain.RyaStatement) Fact(org.apache.rya.reasoning.Fact) TABLE_LAYOUT(org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT) TripleRow(org.apache.rya.api.resolver.triple.TripleRow) WholeRowTripleResolver(org.apache.rya.api.resolver.triple.impl.WholeRowTripleResolver) Value(org.apache.accumulo.core.data.Value) Key(org.apache.accumulo.core.data.Key) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Fact (org.apache.rya.reasoning.Fact)6 Test (org.junit.Test)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 NullWritable (org.apache.hadoop.io.NullWritable)2 MapDriver (org.apache.hadoop.mrunit.mapreduce.MapDriver)2 ReduceDriver (org.apache.hadoop.mrunit.mapreduce.ReduceDriver)2 RyaStatement (org.apache.rya.api.domain.RyaStatement)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 StringReader (java.io.StringReader)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Key (org.apache.accumulo.core.data.Key)1 Value (org.apache.accumulo.core.data.Value)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 LongWritable (org.apache.hadoop.io.LongWritable)1 ReduceFeeder (org.apache.hadoop.mrunit.mapreduce.ReduceFeeder)1