com.ontology2.bakemono.primitiveTriples.PrimitiveTripleInputFormat Maven / Gradle / Ivy
package com.ontology2.bakemono.primitiveTriples;
import java.io.IOException;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import com.ontology2.bakemono.pse3.PSE3Mapper;
public class PrimitiveTripleInputFormat extends FileInputFormat {
private static org.apache.commons.logging.Log logger = LogFactory.getLog(PrimitiveTripleInputFormat.class);
final static PrimitiveTripleCodec ptc=new PrimitiveTripleCodec();
@Override
public RecordReader createRecordReader(
final InputSplit split, final TaskAttemptContext context) throws IOException,
InterruptedException {
return new LineProcessingRecordReader() {
@Override
PrimitiveTriple convert(Text line) {
return ptc.decode(line.toString());
}
};
}
}