Search in sources :

Example 6 with MapDriver

use of org.apache.hadoop.mrunit.mapreduce.MapDriver 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 7 with MapDriver

use of org.apache.hadoop.mrunit.mapreduce.MapDriver in project incubator-rya by apache.

the class DuplicateEliminationTest method testInconsistencyMapperOutput.

@Test
public void testInconsistencyMapperOutput() throws Exception {
    Fact empty = new Fact();
    empty.setDerivation(X_DISJOINT);
    new MapDriver<Derivation, NullWritable, Fact, Derivation>().withMapper(new DuplicateElimination.InconsistencyMapper()).withInput(X_DISJOINT, NullWritable.get()).withOutput(empty, X_DISJOINT).runTest();
}
Also used : MapDriver(org.apache.hadoop.mrunit.mapreduce.MapDriver) Fact(org.apache.rya.reasoning.Fact) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 8 with MapDriver

use of org.apache.hadoop.mrunit.mapreduce.MapDriver in project incubator-rya by apache.

the class JoinSelectStatisticsSumTest method testPartialTripleEntry.

@Test
public void testPartialTripleEntry() throws InterruptedException, IOException {
    TripleEntry te1 = new TripleEntry(new Text("urn:gem:etype#1234"), new Text(""), new Text("subject"), new Text(""), new Text("object"));
    CardList cl = new CardList(34, 52, 63, 0, 0, 0);
    new MapDriver<TripleEntry, CardList, TripleEntry, CardList>().withMapper(new JoinSelectStatisticsSum.CardinalityIdentityMapper()).withInput(te1, cl).withOutput(te1, cl).runTest();
}
Also used : CardList(org.apache.rya.joinselect.mr.utils.CardList) MapDriver(org.apache.hadoop.mrunit.mapreduce.MapDriver) TripleEntry(org.apache.rya.joinselect.mr.utils.TripleEntry) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Example 9 with MapDriver

use of org.apache.hadoop.mrunit.mapreduce.MapDriver in project incubator-rya by apache.

the class JoinSelectStatisticsSumTest method testFullTripleEntry.

@Test
public void testFullTripleEntry() throws InterruptedException, IOException {
    TripleEntry te1 = new TripleEntry(new Text("urn:gem:etype#1234"), new Text("urn:gem#pred"), new Text("subject"), new Text("predicate"), new Text("object"));
    CardList cl = new CardList(34, 52, 63, 0, 0, 0);
    TripleEntry te2 = new TripleEntry(new Text("urn:gem:etype#1234"), new Text(""), new Text("subject"), new Text(""), new Text("object"));
    TripleEntry te3 = new TripleEntry(new Text("urn:gem#pred"), new Text(""), new Text("predicate"), new Text(""), new Text("object"));
    new MapDriver<TripleEntry, CardList, TripleEntry, CardList>().withMapper(new JoinSelectStatisticsSum.CardinalityIdentityMapper()).withInput(te1, cl).withOutput(te2, cl).withOutput(te3, cl).withOutput(te1, cl).runTest();
}
Also used : CardList(org.apache.rya.joinselect.mr.utils.CardList) MapDriver(org.apache.hadoop.mrunit.mapreduce.MapDriver) TripleEntry(org.apache.rya.joinselect.mr.utils.TripleEntry) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Aggregations

MapDriver (org.apache.hadoop.mrunit.mapreduce.MapDriver)9 Test (org.junit.Test)9 Text (org.apache.hadoop.io.Text)5 Key (org.apache.accumulo.core.data.Key)4 Value (org.apache.accumulo.core.data.Value)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 RyaStatement (org.apache.rya.api.domain.RyaStatement)3 CompositeType (org.apache.rya.joinselect.mr.utils.CompositeType)3 TripleCard (org.apache.rya.joinselect.mr.utils.TripleCard)3 TripleEntry (org.apache.rya.joinselect.mr.utils.TripleEntry)3 TABLE_LAYOUT (org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT)2 TripleRow (org.apache.rya.api.resolver.triple.TripleRow)2 TripleRowResolver (org.apache.rya.api.resolver.triple.TripleRowResolver)2 WholeRowTripleResolver (org.apache.rya.api.resolver.triple.impl.WholeRowTripleResolver)2 CardList (org.apache.rya.joinselect.mr.utils.CardList)2 CardinalityType (org.apache.rya.joinselect.mr.utils.CardinalityType)2 Fact (org.apache.rya.reasoning.Fact)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 IntWritable (org.apache.hadoop.io.IntWritable)1