List of usage examples for org.apache.hadoop.util StringUtils arrayToString
public static String arrayToString(String[] strs)
From source file:org.apache.hcatalog.templeton.tool.TempletonUtils.java
License:Apache License
public static String hadoopFsListAsString(String files, Configuration conf, String user) throws URISyntaxException, FileNotFoundException, IOException, InterruptedException { if (files == null || conf == null) { return null; }// w ww . ja v a2 s . c om return StringUtils.arrayToString(hadoopFsListAsArray(files, conf, user)); }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
/** * Gets a job for computing node counts on RDF triple inputs * //www. j av a 2 s . c o m * @param config * Configuration * @param inputPaths * Input paths * @param outputPath * Output path * @return Job * @throws IOException */ public static Job getTripleNodeCountJob(Configuration config, String[] inputPaths, String outputPath) throws IOException { Job job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Triples Node Usage Count"); // Map/Reduce classes job.setMapperClass(TripleNodeCountMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(LongWritable.class); job.setReducerClass(NodeCountReducer.class); // Input and Output job.setInputFormatClass(TriplesInputFormat.class); job.setOutputFormatClass(NTriplesNodeOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(outputPath)); return job; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
/** * Gets a job for computing node counts on RDF quad inputs * /* ww w .jav a 2 s.com*/ * @param config * Configuration * @param inputPaths * Input paths * @param outputPath * Output path * @return Job * @throws IOException */ public static Job getQuadNodeCountJob(Configuration config, String[] inputPaths, String outputPath) throws IOException { Job job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Quads Node Usage Count"); // Map/Reduce classes job.setMapperClass(QuadNodeCountMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(LongWritable.class); job.setReducerClass(NodeCountReducer.class); // Input and Output job.setInputFormatClass(QuadsInputFormat.class); job.setOutputFormatClass(NTriplesNodeOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(outputPath)); return job; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
/** * Gets a job for computing node counts on RDF triple and/or quad inputs * /* w w w . java 2 s . co m*/ * @param config * Configuration * @param inputPaths * Input paths * @param outputPath * Output path * @return Job * @throws IOException */ public static Job getNodeCountJob(Configuration config, String[] inputPaths, String outputPath) throws IOException { Job job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Node Usage Count"); // Map/Reduce classes job.setMapperClass(QuadNodeCountMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(LongWritable.class); job.setReducerClass(NodeCountReducer.class); // Input and Output job.setInputFormatClass(TriplesOrQuadsInputFormat.class); job.setOutputFormatClass(NTriplesNodeOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(outputPath)); return job; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
public static Job getTripleGraphSizesJob(Configuration config, String[] inputPaths, String outputPath) throws IOException { Job job = Job.getInstance(config);//from w ww .ja v a2 s. c o m job.setJarByClass(JobFactory.class); job.setJobName("RDF Triples Graph Sizes"); // Map/Reduce classes ChainMapper.addMapper(job, TriplesToQuadsConstantGraphMapper.class, LongWritable.class, TripleWritable.class, LongWritable.class, QuadWritable.class, config); ChainMapper.addMapper(job, QuadGraphCountMapper.class, LongWritable.class, QuadWritable.class, NodeWritable.class, LongWritable.class, config); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(LongWritable.class); job.setReducerClass(NodeCountReducer.class); // Input and Output job.setInputFormatClass(TriplesInputFormat.class); job.setOutputFormatClass(NTriplesNodeOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(outputPath)); return job; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
public static Job getQuadGraphSizesJob(Configuration config, String[] inputPaths, String outputPath) throws IOException { Job job = Job.getInstance(config);/* ww w. j a v a2 s. c o m*/ job.setJarByClass(JobFactory.class); job.setJobName("RDF Quads Graph Sizes"); // Map/Reduce classes job.setMapperClass(QuadGraphCountMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(LongWritable.class); job.setReducerClass(NodeCountReducer.class); // Input and Output job.setInputFormatClass(QuadsInputFormat.class); job.setOutputFormatClass(NTriplesNodeOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(outputPath)); return job; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
public static Job getGraphSizesJob(Configuration config, String[] inputPaths, String outputPath) throws IOException { Job job = Job.getInstance(config);/*from w w w. jav a 2 s .c om*/ job.setJarByClass(JobFactory.class); job.setJobName("RDF Graph Sizes"); // Map/Reduce classes job.setMapperClass(QuadGraphCountMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(LongWritable.class); job.setReducerClass(NodeCountReducer.class); // Input and Output job.setInputFormatClass(TriplesOrQuadsInputFormat.class); job.setOutputFormatClass(NTriplesNodeOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(outputPath)); return job; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
/** * Gets a sequence of jobs that can be used to compute characteristic sets * for RDF triples/* w ww. j a va 2 s .c om*/ * * @param config * Configuration * @param inputPaths * Input paths * @param intermediateOutputPath * Intermediate output path * @param outputPath * Final output path * @return Sequence of jobs * @throws IOException */ public static Job[] getTripleCharacteristicSetJobs(Configuration config, String[] inputPaths, String intermediateOutputPath, String outputPath) throws IOException { Job[] jobs = new Job[2]; Job job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Triples Characteristic Set (Generation)"); // Map/Reduce classes job.setMapperClass(TripleGroupBySubjectMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(TripleWritable.class); job.setReducerClass(TripleCharacteristicSetGeneratingReducer.class); job.setOutputKeyClass(CharacteristicSetWritable.class); job.setOutputValueClass(NullWritable.class); // Input and Output job.setInputFormatClass(TriplesInputFormat.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(intermediateOutputPath)); SequenceFileOutputFormat.setCompressOutput(job, true); FileOutputFormat.setOutputCompressorClass(job, BZip2Codec.class); SequenceFileOutputFormat.setOutputCompressionType(job, CompressionType.BLOCK); jobs[0] = job; job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Triples Characteristic Set (Reduction)"); // Map/Reduce classes job.setMapperClass(KeyMapper.class); job.setMapOutputKeyClass(CharacteristicSetWritable.class); job.setMapOutputValueClass(CharacteristicSetWritable.class); job.setReducerClass(CharacteristicSetReducer.class); job.setOutputKeyClass(CharacteristicSetWritable.class); job.setOutputValueClass(CharacteristicSetWritable.class); // Input and Output job.setInputFormatClass(SequenceFileInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, intermediateOutputPath); FileOutputFormat.setOutputPath(job, new Path(outputPath)); jobs[1] = job; return jobs; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
/** * Gets a sequence of jobs that can be used to compute characteristic sets * for RDF quads/*from ww w. jav a 2 s . c o m*/ * * @param config * Configuration * @param inputPaths * Input paths * @param intermediateOutputPath * Intermediate output path * @param outputPath * Final output path * @return Sequence of jobs * @throws IOException */ public static Job[] getQuadCharacteristicSetJobs(Configuration config, String[] inputPaths, String intermediateOutputPath, String outputPath) throws IOException { Job[] jobs = new Job[2]; Job job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Quads Characteristic Set (Generation)"); // Map/Reduce classes job.setMapperClass(QuadGroupBySubjectMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(QuadWritable.class); job.setReducerClass(QuadCharacteristicSetGeneratingReducer.class); job.setOutputKeyClass(CharacteristicSetWritable.class); job.setOutputValueClass(NullWritable.class); // Input and Output job.setInputFormatClass(QuadsInputFormat.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(intermediateOutputPath)); SequenceFileOutputFormat.setCompressOutput(job, true); FileOutputFormat.setOutputCompressorClass(job, BZip2Codec.class); SequenceFileOutputFormat.setOutputCompressionType(job, CompressionType.BLOCK); jobs[0] = job; job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Quads Characteristic Set (Reduction)"); // Map/Reduce classes job.setMapperClass(KeyMapper.class); job.setMapOutputKeyClass(CharacteristicSetWritable.class); job.setMapOutputValueClass(CharacteristicSetWritable.class); job.setReducerClass(CharacteristicSetReducer.class); job.setOutputKeyClass(CharacteristicSetWritable.class); job.setOutputValueClass(CharacteristicSetWritable.class); // Input and Output job.setInputFormatClass(SequenceFileInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, intermediateOutputPath); FileOutputFormat.setOutputPath(job, new Path(outputPath)); jobs[1] = job; return jobs; }
From source file:org.apache.jena.hadoop.rdf.stats.jobs.JobFactory.java
License:Apache License
/** * Gets a sequence of jobs that can be used to compute characteristic sets * for RDF triple and/or quad inputs//w ww.j a va 2 s .co m * * @param config * Configuration * @param inputPaths * Input paths * @param intermediateOutputPath * Intermediate output path * @param outputPath * Final output path * @return Sequence of jobs * @throws IOException */ public static Job[] getCharacteristicSetJobs(Configuration config, String[] inputPaths, String intermediateOutputPath, String outputPath) throws IOException { Job[] jobs = new Job[2]; Job job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Characteristic Set (Generation)"); // Map/Reduce classes job.setMapperClass(QuadGroupBySubjectMapper.class); job.setMapOutputKeyClass(NodeWritable.class); job.setMapOutputValueClass(QuadWritable.class); job.setReducerClass(QuadCharacteristicSetGeneratingReducer.class); job.setOutputKeyClass(CharacteristicSetWritable.class); job.setOutputValueClass(NullWritable.class); // Input and Output job.setInputFormatClass(TriplesOrQuadsInputFormat.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); FileInputFormat.setInputPaths(job, StringUtils.arrayToString(inputPaths)); FileOutputFormat.setOutputPath(job, new Path(intermediateOutputPath)); SequenceFileOutputFormat.setCompressOutput(job, true); FileOutputFormat.setOutputCompressorClass(job, BZip2Codec.class); SequenceFileOutputFormat.setOutputCompressionType(job, CompressionType.BLOCK); jobs[0] = job; job = Job.getInstance(config); job.setJarByClass(JobFactory.class); job.setJobName("RDF Characteristic Set (Reduction)"); // Map/Reduce classes job.setMapperClass(KeyMapper.class); job.setMapOutputKeyClass(CharacteristicSetWritable.class); job.setMapOutputValueClass(CharacteristicSetWritable.class); job.setReducerClass(CharacteristicSetReducer.class); job.setOutputKeyClass(CharacteristicSetWritable.class); job.setOutputValueClass(CharacteristicSetWritable.class); // Input and Output job.setInputFormatClass(SequenceFileInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, intermediateOutputPath); FileOutputFormat.setOutputPath(job, new Path(outputPath)); jobs[1] = job; return jobs; }