use of org.apache.jena.hadoop.rdf.types.TripleWritable in project jena by apache.
the class TriplesToQuadsConstantGraphMapperTest 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(Quad.defaultGraphNodeGenerated, 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.jena.hadoop.rdf.types.TripleWritable in project jena by apache.
the class TestDistinctTriples method distinct_triples_01.
@Test
public void distinct_triples_01() throws IOException {
MapReduceDriver<LongWritable, TripleWritable, TripleWritable, NullWritable, NullWritable, TripleWritable> driver = this.getMapReduceDriver();
Triple t = new Triple(NodeFactory.createURI("urn:s"), NodeFactory.createURI("urn:p"), NodeFactory.createLiteral("1"));
TripleWritable tw = new TripleWritable(t);
driver.addInput(new LongWritable(1), tw);
driver.addOutput(NullWritable.get(), tw);
driver.runTest();
}
use of org.apache.jena.hadoop.rdf.types.TripleWritable in project jena by apache.
the class QuadsToTriplesMapperTest method generateData.
protected void generateData(MapDriver<LongWritable, QuadWritable, LongWritable, TripleWritable> 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 QuadWritable(q));
driver.addOutput(new LongWritable(i), new TripleWritable(t));
}
}
Aggregations