use of org.apache.jena.hadoop.rdf.types.CharacteristicSetWritable in project jena by apache.
the class AbstractCharacteristicSetGeneratingReducerTests method characteristic_set_generating_reducer_04.
/**
* Test basic characteristic set computation
*
* @throws IOException
*/
@Test
public void characteristic_set_generating_reducer_04() throws IOException {
MapReduceDriver<LongWritable, T, NodeWritable, T, CharacteristicSetWritable, NullWritable> driver = this.getMapReduceDriver();
T tuple = this.createTuple(1, "http://predicate");
driver.addInput(new LongWritable(1), tuple);
tuple = this.createTuple(1, "http://other");
driver.addInput(new LongWritable(1), tuple);
// Single entry sets
this.createSet(driver, 1, "http://predicate");
this.createSet(driver, 1, "http://other");
// Two entry sets
this.createSet(driver, 1, "http://predicate", "http://other");
driver.runTest(false);
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicSetWritable in project jena by apache.
the class AbstractCharacteristicSetGeneratingReducerTests method characteristic_set_generating_reducer_03.
/**
* Test basic characteristic set computation
*
* @throws IOException
*/
@Test
public void characteristic_set_generating_reducer_03() throws IOException {
MapReduceDriver<LongWritable, T, NodeWritable, T, CharacteristicSetWritable, NullWritable> driver = this.getMapReduceDriver();
T tuple = this.createTuple(1, "http://predicate");
driver.addInput(new LongWritable(1), tuple);
tuple = this.createTuple(2, "http://predicate");
driver.addInput(new LongWritable(2), tuple);
this.createSet(driver, 2, "http://predicate");
driver.runTest(false);
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicSetWritable in project jena by apache.
the class AbstractCharacteristicSetGeneratingReducerTests method characteristic_set_generating_reducer_02.
/**
* Test basic characteristic set computation
*
* @throws IOException
*/
@Test
public void characteristic_set_generating_reducer_02() throws IOException {
MapReduceDriver<LongWritable, T, NodeWritable, T, CharacteristicSetWritable, NullWritable> driver = this.getMapReduceDriver();
T tuple = this.createTuple(1, "http://predicate");
driver.addInput(new LongWritable(1), tuple);
driver.addInput(new LongWritable(1), tuple);
this.createSet(driver, 1, "http://predicate");
driver.runTest(false);
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicSetWritable in project jena by apache.
the class AbstractCharacteristicSetGeneratingReducerTests method characteristic_set_generating_reducer_05.
/**
* Test basic characteristic set computation
*
* @throws IOException
*/
@Test
public void characteristic_set_generating_reducer_05() throws IOException {
MapReduceDriver<LongWritable, T, NodeWritable, T, CharacteristicSetWritable, NullWritable> driver = this.getMapReduceDriver();
T tuple = this.createTuple(1, "http://predicate");
driver.addInput(new LongWritable(1), tuple);
tuple = this.createTuple(1, "http://other");
driver.addInput(new LongWritable(2), tuple);
tuple = this.createTuple(1, "http://third");
driver.addInput(new LongWritable(3), tuple);
// Single entry sets
this.createSet(driver, 1, "http://predicate");
this.createSet(driver, 1, "http://other");
this.createSet(driver, 1, "http://third");
// Two entry sets
this.createSet(driver, 1, "http://predicate", "http://other");
this.createSet(driver, 1, "http://predicate", "http://third");
this.createSet(driver, 1, "http://other", "http://third");
// Three entry sets
this.createSet(driver, 1, "http://predicate", "http://other", "http://third");
driver.runTest(false);
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicSetWritable in project jena by apache.
the class CharacteristicSetReducerTest method characteristic_set_reducer_06.
/**
* Test characteristic set reduction
*
* @throws IOException
*/
@Test
public void characteristic_set_reducer_06() throws IOException {
MapReduceDriver<CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable, NullWritable> driver = this.getMapReduceDriver();
this.createSet(driver, 2, 1, "http://predicate", "http://other");
this.createSet(driver, 1, 1, "http://other");
driver.runTest(false);
driver = getMapReduceDriver();
createSet(driver, 2, 1, "http://predicate", "http://other");
createSet(driver, 1, 1, "http://other");
List<Pair<CharacteristicSetWritable, NullWritable>> results = driver.run();
for (Pair<CharacteristicSetWritable, NullWritable> pair : results) {
CharacteristicSetWritable cw = pair.getFirst();
boolean expectTwo = cw.hasCharacteristic("http://predicate");
Assert.assertEquals(expectTwo ? 2 : 1, cw.getCount().get());
}
}
Aggregations