Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

citation count

  • Loading branch information...
commit a5ae5886e57b06291a7e8c99fdbb6ab6d17c0481 1 parent d82324a
Charles Feduke authored
182  .classpath
... ...
@@ -1,91 +1,95 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <classpath>
3  
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
4  
-  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
5  
-  <classpathentry kind="output" path="target/classes"/>
6  
-  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
7  
-  <classpathentry kind="var" path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/>
8  
-  <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.2.2/jaxb-api-2.2.2.jar"/>
9  
-  <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar"/>
10  
-  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
11  
-  <classpathentry kind="var" path="M2_REPO/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar"/>
12  
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
13  
-  <classpathentry kind="var" path="M2_REPO/com/google/guava/guava/13.0.1/guava-13.0.1.jar"/>
14  
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
15  
-  <classpathentry kind="var" path="M2_REPO/org/apache/hadoop/hadoop-core/0.20.2-cdh3u5/hadoop-core-0.20.2-cdh3u5.jar"/>
16  
-  <classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.2/commons-cli-1.2.jar">
17  
-    <attributes>
18  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2-javadoc.jar!/" name="javadoc_location"/>
19  
-    </attributes>
20  
-  </classpathentry>
21  
-  <classpathentry kind="var" path="M2_REPO/xmlenc/xmlenc/0.52/xmlenc-0.52.jar"/>
22  
-  <classpathentry kind="var" path="M2_REPO/org/apache/hadoop/thirdparty/guava/guava/r09-jarjar/guava-r09-jarjar.jar"/>
23  
-  <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar"/>
24  
-  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar">
25  
-    <attributes>
26  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar!/" name="javadoc_location"/>
27  
-    </attributes>
28  
-  </classpathentry>
29  
-  <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar">
30  
-    <attributes>
31  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4-javadoc.jar!/" name="javadoc_location"/>
32  
-    </attributes>
33  
-  </classpathentry>
34  
-  <classpathentry kind="var" path="M2_REPO/commons-net/commons-net/1.4.1/commons-net-1.4.1.jar">
35  
-    <attributes>
36  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/commons-net/commons-net/1.4.1/commons-net-1.4.1-javadoc.jar!/" name="javadoc_location"/>
37  
-    </attributes>
38  
-  </classpathentry>
39  
-  <classpathentry kind="var" path="M2_REPO/oro/oro/2.0.8/oro-2.0.8.jar"/>
40  
-  <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/2.1/commons-io-2.1.jar">
41  
-    <attributes>
42  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1-javadoc.jar!/" name="javadoc_location"/>
43  
-    </attributes>
44  
-  </classpathentry>
45  
-  <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26.jar">
46  
-    <attributes>
47  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26-javadoc.jar!/" name="javadoc_location"/>
48  
-    </attributes>
49  
-  </classpathentry>
50  
-  <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26.jar">
51  
-    <attributes>
52  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26-javadoc.jar!/" name="javadoc_location"/>
53  
-    </attributes>
54  
-  </classpathentry>
55  
-  <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211.jar">
56  
-    <attributes>
57  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211-javadoc.jar!/" name="javadoc_location"/>
58  
-    </attributes>
59  
-  </classpathentry>
60  
-  <classpathentry kind="var" path="M2_REPO/tomcat/jasper-runtime/5.5.23/jasper-runtime-5.5.23.jar"/>
61  
-  <classpathentry kind="var" path="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0.jar">
62  
-    <attributes>
63  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/commons-el/commons-el/1.0/commons-el-1.0-javadoc.jar!/" name="javadoc_location"/>
64  
-    </attributes>
65  
-  </classpathentry>
66  
-  <classpathentry kind="var" path="M2_REPO/tomcat/jasper-compiler/5.5.23/jasper-compiler-5.5.23.jar"/>
67  
-  <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar"/>
68  
-  <classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.5.2/jackson-core-asl-1.5.2.jar"/>
69  
-  <classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.5.2/jackson-mapper-asl-1.5.2.jar"/>
70  
-  <classpathentry kind="var" path="M2_REPO/asm/asm/3.2/asm-3.2.jar"/>
71  
-  <classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-core/1.8/jersey-core-1.8.jar"/>
72  
-  <classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-json/1.8/jersey-json-1.8.jar"/>
73  
-  <classpathentry kind="var" path="M2_REPO/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar">
74  
-    <attributes>
75  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/org/codehaus/jettison/jettison/1.1/jettison-1.1-javadoc.jar!/" name="javadoc_location"/>
76  
-    </attributes>
77  
-  </classpathentry>
78  
-  <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
79  
-  <classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar"/>
80  
-  <classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-jaxrs/1.7.1/jackson-jaxrs-1.7.1.jar"/>
81  
-  <classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-xc/1.7.1/jackson-xc-1.7.1.jar"/>
82  
-  <classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.jar"/>
83  
-  <classpathentry kind="var" path="M2_REPO/net/java/dev/jets3t/jets3t/0.6.1/jets3t-0.6.1.jar">
84  
-    <attributes>
85  
-      <attribute value="jar:file:/Users/cfeduke/.m2/repository/net/java/dev/jets3t/jets3t/0.6.1/jets3t-0.6.1-javadoc.jar!/" name="javadoc_location"/>
86  
-    </attributes>
87  
-  </classpathentry>
88  
-  <classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar"/>
89  
-  <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.1.1/core-3.1.1.jar"/>
90  
-  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.15/log4j-1.2.15.jar"/>
91  
-</classpath>
  3
+	<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
  4
+	<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
  5
+	<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
  6
+	<classpathentry kind="var" path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/>
  7
+	<classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.2.2/jaxb-api-2.2.2.jar"/>
  8
+	<classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar"/>
  9
+	<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
  10
+	<classpathentry kind="var" path="M2_REPO/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar"/>
  11
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  12
+	<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/13.0.1/guava-13.0.1.jar"/>
  13
+	<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
  14
+	<classpathentry kind="var" path="M2_REPO/org/apache/hadoop/hadoop-core/0.20.2-cdh3u5/hadoop-core-0.20.2-cdh3u5.jar" sourcepath="/HADOOP_CORE_SRC">
  15
+		<attributes>
  16
+			<attribute name="javadoc_location" value="http://hadoop.apache.org/common/docs/r0.20.2/api/"/>
  17
+		</attributes>
  18
+	</classpathentry>
  19
+	<classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.2/commons-cli-1.2.jar">
  20
+		<attributes>
  21
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2-javadoc.jar!/"/>
  22
+		</attributes>
  23
+	</classpathentry>
  24
+	<classpathentry kind="var" path="M2_REPO/xmlenc/xmlenc/0.52/xmlenc-0.52.jar"/>
  25
+	<classpathentry kind="var" path="M2_REPO/org/apache/hadoop/thirdparty/guava/guava/r09-jarjar/guava-r09-jarjar.jar"/>
  26
+	<classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar"/>
  27
+	<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar">
  28
+		<attributes>
  29
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-javadoc.jar!/"/>
  30
+		</attributes>
  31
+	</classpathentry>
  32
+	<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar">
  33
+		<attributes>
  34
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4-javadoc.jar!/"/>
  35
+		</attributes>
  36
+	</classpathentry>
  37
+	<classpathentry kind="var" path="M2_REPO/commons-net/commons-net/1.4.1/commons-net-1.4.1.jar">
  38
+		<attributes>
  39
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/commons-net/commons-net/1.4.1/commons-net-1.4.1-javadoc.jar!/"/>
  40
+		</attributes>
  41
+	</classpathentry>
  42
+	<classpathentry kind="var" path="M2_REPO/oro/oro/2.0.8/oro-2.0.8.jar"/>
  43
+	<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/2.1/commons-io-2.1.jar">
  44
+		<attributes>
  45
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1-javadoc.jar!/"/>
  46
+		</attributes>
  47
+	</classpathentry>
  48
+	<classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26.jar">
  49
+		<attributes>
  50
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26-javadoc.jar!/"/>
  51
+		</attributes>
  52
+	</classpathentry>
  53
+	<classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26.jar">
  54
+		<attributes>
  55
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26-javadoc.jar!/"/>
  56
+		</attributes>
  57
+	</classpathentry>
  58
+	<classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211.jar">
  59
+		<attributes>
  60
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211-javadoc.jar!/"/>
  61
+		</attributes>
  62
+	</classpathentry>
  63
+	<classpathentry kind="var" path="M2_REPO/tomcat/jasper-runtime/5.5.23/jasper-runtime-5.5.23.jar"/>
  64
+	<classpathentry kind="var" path="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0.jar">
  65
+		<attributes>
  66
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/commons-el/commons-el/1.0/commons-el-1.0-javadoc.jar!/"/>
  67
+		</attributes>
  68
+	</classpathentry>
  69
+	<classpathentry kind="var" path="M2_REPO/tomcat/jasper-compiler/5.5.23/jasper-compiler-5.5.23.jar"/>
  70
+	<classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar"/>
  71
+	<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.5.2/jackson-core-asl-1.5.2.jar"/>
  72
+	<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.5.2/jackson-mapper-asl-1.5.2.jar"/>
  73
+	<classpathentry kind="var" path="M2_REPO/asm/asm/3.2/asm-3.2.jar"/>
  74
+	<classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-core/1.8/jersey-core-1.8.jar"/>
  75
+	<classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-json/1.8/jersey-json-1.8.jar"/>
  76
+	<classpathentry kind="var" path="M2_REPO/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar">
  77
+		<attributes>
  78
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/org/codehaus/jettison/jettison/1.1/jettison-1.1-javadoc.jar!/"/>
  79
+		</attributes>
  80
+	</classpathentry>
  81
+	<classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
  82
+	<classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar"/>
  83
+	<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-jaxrs/1.7.1/jackson-jaxrs-1.7.1.jar"/>
  84
+	<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-xc/1.7.1/jackson-xc-1.7.1.jar"/>
  85
+	<classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.jar"/>
  86
+	<classpathentry kind="var" path="M2_REPO/net/java/dev/jets3t/jets3t/0.6.1/jets3t-0.6.1.jar">
  87
+		<attributes>
  88
+			<attribute name="javadoc_location" value="jar:file:/Users/cfeduke/.m2/repository/net/java/dev/jets3t/jets3t/0.6.1/jets3t-0.6.1-javadoc.jar!/"/>
  89
+		</attributes>
  90
+	</classpathentry>
  91
+	<classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar"/>
  92
+	<classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.1.1/core-3.1.1.jar"/>
  93
+	<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.15/log4j-1.2.15.jar"/>
  94
+	<classpathentry kind="output" path="target/classes"/>
  95
+</classpath>
84  src/main/java/com/deploymentzone/hadoop/CitedCount.java
... ...
@@ -0,0 +1,84 @@
  1
+package com.deploymentzone.hadoop;
  2
+
  3
+import java.io.IOException;
  4
+import java.util.Iterator;
  5
+
  6
+import org.apache.hadoop.conf.*;
  7
+
  8
+import org.apache.hadoop.fs.Path;
  9
+import org.apache.hadoop.io.*;
  10
+
  11
+import org.apache.hadoop.mapreduce.Job;
  12
+import org.apache.hadoop.mapreduce.Mapper;
  13
+import org.apache.hadoop.mapreduce.Reducer;
  14
+import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
  15
+import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
  16
+import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
  17
+import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
  18
+
  19
+import org.apache.hadoop.thirdparty.guava.common.base.Splitter;
  20
+import org.apache.hadoop.thirdparty.guava.common.collect.Iterables;
  21
+import org.apache.hadoop.util.Tool;
  22
+import org.apache.hadoop.util.ToolRunner;
  23
+import org.apache.hadoop.util.GenericOptionsParser;
  24
+
  25
+public class CitedCount extends Configured implements Tool {
  26
+
  27
+	public static class Map extends Mapper<LongWritable,Text,Text,IntWritable> {
  28
+		private final static IntWritable one = new IntWritable(1);
  29
+
  30
+		@Override
  31
+		public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
  32
+			Iterable<String> split = Splitter.on(',').limit(2).split(value.toString());
  33
+
  34
+			context.write(new Text(Iterables.getLast(split)), one);
  35
+		}
  36
+
  37
+	}
  38
+
  39
+	public static class Reduce extends Reducer<Text,IntWritable,Text,IntWritable> {
  40
+		@Override
  41
+		protected void reduce(Text key, Iterable<IntWritable> values, Context context)
  42
+				throws IOException, InterruptedException {
  43
+			int count = 0;
  44
+			Iterator<IntWritable> iter = values.iterator();
  45
+			while (iter.hasNext()) {
  46
+				iter.next();
  47
+				count++;
  48
+			}
  49
+			context.write(key, new IntWritable(count));
  50
+		}
  51
+
  52
+	}
  53
+
  54
+	@Override
  55
+	public int run(String[] args) throws Exception {
  56
+		Job job = new Job();
  57
+
  58
+		job.setInputFormatClass(TextInputFormat.class);
  59
+		job.setOutputFormatClass(TextOutputFormat.class);
  60
+
  61
+		job.setOutputKeyClass(Text.class);
  62
+		job.setOutputValueClass(IntWritable.class);
  63
+
  64
+		job.setMapperClass(Map.class);
  65
+		job.setReducerClass(Reduce.class);
  66
+
  67
+		Path in = new Path(args[0]);
  68
+		Path out = new Path(args[1]);
  69
+		FileInputFormat.setInputPaths(job, in);
  70
+		FileOutputFormat.setOutputPath(job, out);
  71
+
  72
+		job.waitForCompletion(true);
  73
+
  74
+		return 0;
  75
+	}
  76
+
  77
+	public static void main(String[] args) throws Exception {
  78
+	    Configuration conf = new Configuration();
  79
+	    String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
  80
+	    int result = ToolRunner.run(new CitedCount(), otherArgs);
  81
+	    System.exit(result);
  82
+	 }
  83
+
  84
+}

0 notes on commit a5ae588

Please sign in to comment.
Something went wrong with that request. Please try again.