Search in sources :

Example 31 with TABLE_LAYOUT

use of org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT in project incubator-rya by apache.

the class DuplicateEliminationTest 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);
    new MapDriver<Key, Value, Fact, Derivation>().withMapper(new DuplicateElimination.DuplicateTableMapper()).withInput(key, val).withOutput(X_SUB_Y, X_SUB_Y.getDerivation()).runTest();
}
Also used : TABLE_LAYOUT(org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT) TripleRowResolver(org.apache.rya.api.resolver.triple.TripleRowResolver) TripleRow(org.apache.rya.api.resolver.triple.TripleRow) MapDriver(org.apache.hadoop.mrunit.mapreduce.MapDriver) WholeRowTripleResolver(org.apache.rya.api.resolver.triple.impl.WholeRowTripleResolver) Value(org.apache.accumulo.core.data.Value) RyaStatement(org.apache.rya.api.domain.RyaStatement) Key(org.apache.accumulo.core.data.Key) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 32 with TABLE_LAYOUT

use of org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT 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

TABLE_LAYOUT (org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT)32 TripleRow (org.apache.rya.api.resolver.triple.TripleRow)17 RyaStatement (org.apache.rya.api.domain.RyaStatement)14 RyaURI (org.apache.rya.api.domain.RyaURI)14 IOException (java.io.IOException)12 Map (java.util.Map)11 Range (org.apache.accumulo.core.data.Range)11 Text (org.apache.hadoop.io.Text)11 RyaType (org.apache.rya.api.domain.RyaType)11 ByteRange (org.apache.rya.api.query.strategy.ByteRange)11 HashMap (java.util.HashMap)10 Key (org.apache.accumulo.core.data.Key)9 Value (org.apache.accumulo.core.data.Value)9 Mutation (org.apache.accumulo.core.data.Mutation)8 Authorizations (org.apache.accumulo.core.security.Authorizations)8 Scanner (org.apache.accumulo.core.client.Scanner)7 Test (org.junit.Test)7 RyaRange (org.apache.rya.api.domain.RyaRange)6 IntWritable (org.apache.hadoop.io.IntWritable)5 RyaDAOException (org.apache.rya.api.persist.RyaDAOException)5