@Override protected TripleWritable createInstance(Triple tuple) { return new TripleWritable(tuple); } }
@Override protected TripleWritable createInstance(Triple tuple) { return new TripleWritable(tuple); } }
@Override protected TripleWritable createInstance(Triple tuple) { return new TripleWritable(tuple); } }
/** * Creates a new instance from the given input * * @param input * Input * @return New instance * @throws IOException */ public static TripleWritable read(DataInput input) throws IOException { TripleWritable t = new TripleWritable(); t.readFields(input); return t; }
@Override public void write(TKey key, QuadWritable value) throws IOException, InterruptedException { this.writer.write(key, new TripleWritable(value.get().asTriple())); }
@Override protected TripleWritable createInvalidValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
@Override protected TripleWritable createValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
@Override protected TripleWritable createValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); } }
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)); } }
@Override protected TripleWritable createTuple(int i, String predicateUri) { return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI(predicateUri), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
@Override protected TripleWritable createValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
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)); } }
@Override protected TripleWritable createValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
@Override protected TripleWritable createValidValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
@Override protected TripleWritable createValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
@Override protected TripleWritable createInvalidValue(int i) { return new TripleWritable( new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI("http://predicate"), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
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(t.getSubject(), t); driver.addInput(new LongWritable(i), new TripleWritable(t)); driver.addOutput(new LongWritable(i), new QuadWritable(q)); } }
@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(); }
@Override protected TripleWritable createValidValue(int i) { String[] predicates = this.getPredicatePool(); if (predicates.length == 0) return this.createInvalidValue(i); return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI(predicates[i % predicates.length]), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }
@Override protected TripleWritable createValidValue(int i) { String[] predicates = this.getPredicatePool(); if (predicates.length == 0) return this.createInvalidValue(i); return new TripleWritable(new Triple(NodeFactory.createURI("http://subjects/" + i), NodeFactory.createURI(predicates[i % predicates.length]), NodeFactory.createLiteral(Integer.toString(i), XSDDatatype.XSDinteger))); }