use of org.apache.hadoop.mrunit.mapreduce.ReduceDriver in project incubator-rya by apache.
the class JoinReducerTest method testSingleConstCard.
@Test
public void testSingleConstCard() throws InterruptedException, IOException {
CompositeType ct = new CompositeType("urn:gem:etype#1234", 1);
TripleEntry te = new TripleEntry("urn:gem#pred", "urn:gem:etype#4567", "predicate", "object", "subject");
CardinalityType c5 = new CardinalityType(45, "object", 0);
CardinalityType c1 = new CardinalityType(25, "subject", 2);
CardinalityType c2 = new CardinalityType(27, "predicate", 2);
CardinalityType c3 = new CardinalityType(29, "object", 2);
CardinalityType c4 = new CardinalityType(31, "predicate", 1);
List<TripleCard> list = new ArrayList<TripleCard>();
list.add(new TripleCard(c1));
list.add(new TripleCard(c2));
list.add(new TripleCard(c3));
list.add(new TripleCard(c4));
list.add(new TripleCard(c5));
list.add(new TripleCard(te));
System.out.println("List is " + list);
new ReduceDriver<CompositeType, TripleCard, TripleEntry, CardList>().withReducer(new JoinSelectAggregate.JoinReducer()).withInput(ct, list).withOutput(te, new CardList(25, 31, 45, 0, 0, 0)).runTest();
}
use of org.apache.hadoop.mrunit.mapreduce.ReduceDriver in project incubator-rya by apache.
the class DuplicateEliminationTest method testRetainSimplest.
@Test
public void testRetainSimplest() throws Exception {
List<Derivation> facts = new LinkedList<>();
facts.add(Y_SUPER_X_INV.getDerivation());
facts.add(Y_SUPER_X.getDerivation());
Fact unset = Y_SUPER_X.clone();
unset.unsetDerivation();
ReduceDriver<Fact, Derivation, Fact, NullWritable> driver = new ReduceDriver<>();
driver.getConfiguration().setInt(MRReasoningUtils.STEP_PROP, 1);
driver.withReducer(new DuplicateElimination.DuplicateEliminationReducer()).withInput(unset, facts).withMultiOutput(MRReasoningUtils.INTERMEDIATE_OUT, Y_SUPER_X, NullWritable.get()).runTest();
}
Aggregations