use of org.apache.hadoop.io.LongWritable in project jena by apache.
the class TriplesToQuadsBySubjectMapperTest method triples_to_quads_mapper_01.
/**
* Tests quads to triples conversion
*
* @throws IOException
*/
@Test
public void triples_to_quads_mapper_01() throws IOException {
MapDriver<LongWritable, TripleWritable, LongWritable, QuadWritable> driver = this.getMapDriver();
Triple t = new Triple(NodeFactory.createURI("http://s"), NodeFactory.createURI("http://p"), NodeFactory.createLiteral("test"));
Quad q = new Quad(t.getSubject(), t);
driver.withInput(new Pair<LongWritable, TripleWritable>(new LongWritable(1), new TripleWritable(t))).withOutput(new Pair<LongWritable, QuadWritable>(new LongWritable(1), new QuadWritable(q)));
driver.runTest();
}
use of org.apache.hadoop.io.LongWritable in project jena by apache.
the class TriplesToQuadsConstantGraphMapperTest method generateData.
protected void generateData(MapDriver<LongWritable, TripleWritable, LongWritable, QuadWritable> driver, int num) {
for (int i = 0; i < num; i++) {
Triple t = new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger));
Quad q = new Quad(Quad.defaultGraphNodeGenerated, t);
driver.addInput(new LongWritable(i), new TripleWritable(t));
driver.addOutput(new LongWritable(i), new QuadWritable(q));
}
}
use of org.apache.hadoop.io.LongWritable in project jena by apache.
the class AbstractNodeTupleFilterTests method generateData.
protected final void generateData(MapDriver<LongWritable, T, LongWritable, T> driver, int num) {
for (int i = 0; i < num; i++) {
LongWritable key = new LongWritable(i);
if (i % 2 == 0 && !this.noValidInputs()) {
T value = this.createValidValue(i);
driver.addInput(key, value);
if (!this.isInverted())
driver.addOutput(key, value);
} else {
T value = this.createInvalidValue(i);
driver.addInput(key, value);
if (this.isInverted())
driver.addOutput(key, value);
}
}
}
use of org.apache.hadoop.io.LongWritable in project jena by apache.
the class AbstractNodeTupleGroupingTests method generateData.
/**
* Generates data for use in tests
*
* @param driver
* Driver
* @param num
* Number of tuples to generate
*/
protected void generateData(MapDriver<LongWritable, T, NodeWritable, T> driver, int num) {
for (int i = 0; i < num; i++) {
LongWritable inputKey = new LongWritable(i);
T value = this.createValue(i);
NodeWritable outputKey = this.getOutputKey(value);
driver.addInput(inputKey, value);
driver.addOutput(outputKey, value);
}
}
use of org.apache.hadoop.io.LongWritable in project jena by apache.
the class AbstractNodeTupleSplitToNodesTests method generateData.
/**
* Generates data for use in tests
*
* @param driver
* Driver
* @param num
* Number of tuples to generate
*/
protected void generateData(MapDriver<LongWritable, T, LongWritable, NodeWritable> driver, int num) {
for (int i = 0; i < num; i++) {
LongWritable key = new LongWritable(i);
T value = this.createValue(i);
NodeWritable[] nodes = this.getNodes(value);
driver.addInput(key, value);
for (NodeWritable n : nodes) {
driver.addOutput(key, n);
}
}
}
Aggregations