http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-elephas/pom.xml ---------------------------------------------------------------------- diff --git a/jena-elephas/pom.xml b/jena-elephas/pom.xml new file mode 100644 index 0000000..0246c2e --- /dev/null +++ b/jena-elephas/pom.xml @@ -0,0 +1,97 @@ +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + You under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>jena-elephas</artifactId> + <version>0.9.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <parent> + <groupId>org.apache.jena</groupId> + <artifactId>jena-parent</artifactId> + <version>12-SNAPSHOT</version> + <relativePath>../jena-parent</relativePath> + </parent> + + <name>Apache Jena - Elephas</name> + <description>A collection of tools for working with RDF on the Hadoop platform</description> + + <modules> + <module>jena-elephas-io</module> + <module>jena-elephas-common</module> + <module>jena-elephas-mapreduce</module> + <module>jena-elephas-stats</module> + </modules> + + <!-- Properties common across all profiles --> + <properties> + <plugin.compiler.version>2.5.1</plugin.compiler.version> + <arq.version>2.12.2-SNAPSHOT</arq.version> + <junit.version>4.11</junit.version> + <mrunit.version>1.0.0</mrunit.version> + </properties> + + <!-- Profiles to allow building for different Hadoop versions --> + <profiles> + <!-- Hadoop 2.x Latest --> + <profile> + <id>hadoop_2x</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <hadoop.version>2.6.0</hadoop.version> + </properties> + </profile> + </profiles> + + <dependencyManagement> + <dependencies> + <!-- Hadoop Dependencies --> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-common</artifactId> + <version>${hadoop.version}</version> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-mapreduce-client-common</artifactId> + <version>${hadoop.version}</version> + </dependency> + + <!-- Jena Dependencies --> + <dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-arq</artifactId> + <version>${arq.version}</version> + </dependency> + + <!-- Test Dependencies --> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-minicluster</artifactId> + <version>${hadoop.version}</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + </dependency> + <dependency> + <groupId>org.apache.mrunit</groupId> + <artifactId>mrunit</artifactId> + <version>${mrunit.version}</version> + <classifier>hadoop2</classifier> + </dependency> + </dependencies> + </dependencyManagement> +</project>
http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/LICENSE ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/LICENSE b/jena-hadoop-rdf/LICENSE deleted file mode 100644 index 68c771a..0000000 --- a/jena-hadoop-rdf/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/NOTICE ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/NOTICE b/jena-hadoop-rdf/NOTICE deleted file mode 100644 index f87b36f..0000000 --- a/jena-hadoop-rdf/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Jena -Copyright 2011-2014 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/pom.xml ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/pom.xml b/jena-hadoop-rdf/hadoop-rdf-mapreduce/pom.xml deleted file mode 100644 index b907850..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.jena</groupId> - <artifactId>jena-hadoop-rdf</artifactId> - <version>0.9.0-SNAPSHOT</version> - </parent> - <artifactId>jena-hadoop-rdf-mapreduce</artifactId> - <name>Apache Jena - RDF Tools for Hadoop - Map/Reduce</name> - <description>Contains some basic Map/Reduce implementations for working with RDF on Hadoop</description> - - <dependencies> - <!-- Internal Project Dependencies --> - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-hadoop-rdf-common</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- Hadoop Dependencies --> - <!-- Note these will be provided on the Hadoop cluster hence the provided - scope --> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-common</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-mapreduce-client-common</artifactId> - <scope>provided</scope> - </dependency> - - <!-- Jena dependencies --> - <dependency> - <groupId>org.apache.jena</groupId> - <artifactId>jena-arq</artifactId> - </dependency> - - <!-- Test Dependencies --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.mrunit</groupId> - <artifactId>mrunit</artifactId> - <scope>test</scope> - <classifier>hadoop2</classifier> - </dependency> - </dependencies> - - <build> - <plugins> - <!-- JAR plugin to ensure tests jar is built --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyMapper.java deleted file mode 100644 index 306a697..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyMapper.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.mapreduce.Mapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A mapper which discards the value replacing it with the key - * - * - * @param <TKey> Key type - * @param <TValue> Value type - */ -public class KeyMapper<TKey, TValue> extends Mapper<TKey, TValue, TKey, TKey> { - private static final Logger LOG = LoggerFactory.getLogger(KeyMapper.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void map(TKey key, TValue value, Context context) throws IOException, - InterruptedException { - if (this.tracing) { - LOG.trace("Key = {}", key); - } - context.write(key, key); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyPlusNullMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyPlusNullMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyPlusNullMapper.java deleted file mode 100644 index a6e9a6a..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyPlusNullMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A mapper which discards the value replacing it with a null - * - * - * @param <TKey> Key type - * @param <TValue> Value type - */ -public class KeyPlusNullMapper<TKey, TValue> extends Mapper<TKey, TValue, TKey, NullWritable> { - private static final Logger LOG = LoggerFactory.getLogger(KeyPlusNullMapper.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void map(TKey key, TValue value, Context context) throws IOException, - InterruptedException { - if (this.tracing) { - LOG.trace("Key = {}", key); - } - context.write(key, NullWritable.get()); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyReducer.java deleted file mode 100644 index 7805f16..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/KeyReducer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.mapreduce.Reducer; - -/** - * A reducer that outputs a single pair consists of the key as both fields ignoring the values - * @author rvesse - * - * @param <TKey> Key - * @param <TValue> Value - */ -public class KeyReducer<TKey, TValue> extends Reducer<TKey, TValue, TKey, TKey> { - - @Override - protected void reduce(TKey key, Iterable<TValue> values, Context context) - throws IOException, InterruptedException { - context.write(key, key); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyMapper.java deleted file mode 100644 index 7a48c1d..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A mapper which discards the value, moves the key to the value position and uses a null key - * - * - * @param <TKey> Key type - * @param <TValue> Value type - */ -public class NullPlusKeyMapper<TKey, TValue> extends Mapper<TKey, TValue, NullWritable, TKey> { - private static final Logger LOG = LoggerFactory.getLogger(NullPlusKeyMapper.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void map(TKey key, TValue value, Context context) throws IOException, - InterruptedException { - if (this.tracing) { - LOG.trace("Key = {}", key); - } - context.write(NullWritable.get(), key); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyReducer.java deleted file mode 100644 index dfc6ec1..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusKeyReducer.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Reducer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A reducer that outputs a single pair consists of a null as the key and the key as the value - * @author rvesse - * - * @param <TKey> Key - * @param <TValue> Value - */ -public class NullPlusKeyReducer<TKey, TValue> extends Reducer<TKey, TValue, NullWritable, TKey> { - - private static final Logger LOGGER = LoggerFactory.getLogger(NullPlusKeyReducer.class); - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOGGER.isTraceEnabled(); - } - - @Override - protected void reduce(TKey key, Iterable<TValue> values, Context context) - throws IOException, InterruptedException { - if (this.tracing) { - LOGGER.trace("Input Key = {}", key); - Iterator<TValue> iter = values.iterator(); - while (iter.hasNext()) { - LOGGER.trace("Input Value = {}", iter.next()); - } - } - context.write(NullWritable.get(), key); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueMapper.java deleted file mode 100644 index a5ac199..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A mapper which discards the key replacing it with a null leaving the value as is - * - * - * @param <TKey> Key type - * @param <TValue> Value type - */ -public class NullPlusValueMapper<TKey, TValue> extends Mapper<TKey, TValue, NullWritable, TValue> { - private static final Logger LOG = LoggerFactory.getLogger(NullPlusValueMapper.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void map(TKey key, TValue value, Context context) throws IOException, - InterruptedException { - if (this.tracing) { - LOG.trace("Value = {}", value); - } - context.write(NullWritable.get(), value); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueReducer.java deleted file mode 100644 index c6b270f..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/NullPlusValueReducer.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Reducer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A reducer that outputs a pair for each value consisting of a null key and the - * value - * - * @author rvesse - * - * @param <TKey> - * Key - * @param <TValue> - * Value - */ -public class NullPlusValueReducer<TKey, TValue> extends Reducer<TKey, TValue, NullWritable, TValue> { - private static final Logger LOGGER = LoggerFactory.getLogger(NullPlusValueReducer.class); - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOGGER.isTraceEnabled(); - } - - @Override - protected void reduce(TKey key, Iterable<TValue> values, Context context) throws IOException, InterruptedException { - if (this.tracing) { - LOGGER.trace("Input Key = {}", key); - } - Iterator<TValue> iter = values.iterator(); - while (iter.hasNext()) { - TValue value = iter.next(); - if (tracing) { - LOGGER.trace("Input Value = {}", value); - } - context.write(NullWritable.get(), value); - } - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/RdfMapReduceConstants.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/RdfMapReduceConstants.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/RdfMapReduceConstants.java deleted file mode 100644 index 6a8cf18..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/RdfMapReduceConstants.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -/** - * RDF Map/Reduce related constants - * - * - * - */ -public class RdfMapReduceConstants { - - /** - * Private constructor prevents instantiation - */ - private RdfMapReduceConstants() { - - } - - /** - * Configuration key used to set whether the behaviour of the filter mappers - * is inverted. When enabled the filter mappers will invert their selection - * i.e. tuples that would normally be accepted will be rejected and vice - * versa. - */ - public static final String FILTER_INVERT = "rdf.mapreduce.filter.invert"; - - /** - * Configuration key used to set a command separated list of predicate URIs - * to filter upon - */ - public static final String FILTER_PREDICATE_URIS = "rdf.mapreduce.filter.predicate.uris"; - - /** - * Configuration key used to set a command separated list of subject URIs to - * filter upon - */ - public static final String FILTER_SUBJECT_URIS = "rdf.mapreduce.filter.subject.uris"; - - /** - * Configuration key used to set a command separated list of object URIs to - * filter upon - */ - public static final String FILTER_OBJECT_URIS = "rdf.mapreduce.filter.object.uris"; - - /** - * Configuration key used to set a command separated list of graph URIs to - * filter upon - */ - public static final String FILTER_GRAPH_URIS = "rdf.mapreduce.filter.graph.uris"; -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapMapper.java deleted file mode 100644 index ef518a9..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.mapreduce.Mapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A mapper which swaps the key and value around - * - * - * @param <TKey> Key type - * @param <TValue> Value type - */ -public class SwapMapper<TKey, TValue> extends Mapper<TKey, TValue, TValue, TKey> { - private static final Logger LOG = LoggerFactory.getLogger(SwapMapper.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void map(TKey key, TValue value, Context context) throws IOException, - InterruptedException { - if (this.tracing) { - LOG.trace("Key = {}", key); - LOG.trace("Value = {}", value); - } - context.write(value, key); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapReducer.java deleted file mode 100644 index e7e42a0..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/SwapReducer.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.hadoop.mapreduce.Reducer; - -/** - * A reducer that swaps the key and value - * @author rvesse - * - * @param <TKey> Key - * @param <TValue> Value - */ -public class SwapReducer<TKey, TValue> extends Reducer<TKey, TValue, TValue, TKey> { - - @Override - protected void reduce(TKey key, Iterable<TValue> values, Context context) - throws IOException, InterruptedException { - Iterator<TValue> iter = values.iterator(); - while (iter.hasNext()) { - context.write(iter.next(), key); - } - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/TextCountReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/TextCountReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/TextCountReducer.java deleted file mode 100644 index 04b9283..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/TextCountReducer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.io.Text; -import org.apache.hadoop.mapreduce.Reducer; - -/** - * A reducer which takes text keys with a sequence of longs representing counts - * as the values and sums the counts together into pairs consisting of a node - * key and a count value. - * - * - * - */ -public class TextCountReducer extends Reducer<Text, LongWritable, Text, LongWritable> { - - @Override - protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, - InterruptedException { - long count = 0; - Iterator<LongWritable> iter = values.iterator(); - while (iter.hasNext()) { - count += iter.next().get(); - } - context.write(key, new LongWritable(count)); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueMapper.java deleted file mode 100644 index 23ae5f0..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueMapper.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.mapreduce.Mapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A mapper which discards the key replacing it with the value - * - * - * @param <TKey> Key type - * @param <TValue> Value type - */ -public class ValueMapper<TKey, TValue> extends Mapper<TKey, TValue, TValue, TValue> { - private static final Logger LOG = LoggerFactory.getLogger(ValueMapper.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void map(TKey key, TValue value, Context context) throws IOException, - InterruptedException { - if (this.tracing) { - LOG.trace("Value = {}", value); - } - context.write(value, value); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValuePlusNullMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValuePlusNullMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValuePlusNullMapper.java deleted file mode 100644 index 094fb2d..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValuePlusNullMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A mapper which discards the key replacing it with the value and nulls out the value - * - * - * @param <TKey> Key type - * @param <TValue> Value type - */ -public class ValuePlusNullMapper<TKey, TValue> extends Mapper<TKey, TValue, TValue, NullWritable> { - private static final Logger LOG = LoggerFactory.getLogger(ValuePlusNullMapper.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void map(TKey key, TValue value, Context context) throws IOException, - InterruptedException { - if (this.tracing) { - LOG.trace("Value = {}", value); - } - context.write(value, NullWritable.get()); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueReducer.java deleted file mode 100644 index 7d25799..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/ValueReducer.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.hadoop.mapreduce.Reducer; - -/** - * A reducer that outputs a pair for each value consisting of the value as both the key and value - * @author rvesse - * - * @param <TKey> Key - * @param <TValue> Value - */ -public class ValueReducer<TKey, TValue> extends Reducer<TKey, TValue, TValue, TValue> { - - @Override - protected void reduce(TKey key, Iterable<TValue> values, Context context) - throws IOException, InterruptedException { - Iterator<TValue> iter = values.iterator(); - while (iter.hasNext()) { - TValue value = iter.next(); - context.write(value, value); - } - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/AbstractCharacteristicSetGeneratingReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/AbstractCharacteristicSetGeneratingReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/AbstractCharacteristicSetGeneratingReducer.java deleted file mode 100644 index daf61d4..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/AbstractCharacteristicSetGeneratingReducer.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.characteristics; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Reducer; -import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; -import org.apache.jena.hadoop.rdf.types.CharacteristicSetWritable; -import org.apache.jena.hadoop.rdf.types.CharacteristicWritable; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Abstract reducer which takes in tuples grouped by some node and generating - * initial characteristic sets. - * <p> - * This produces the characteristic sets as both the key and value so that in a - * subsequent job the characteristic steps may be further combined together to - * total up the usage counts appropriately. - * </p> - * <p> - * It is important to note that the output from this mapper can be very large - * and since it typically needs to be written to HDFS before being processed by - * further jobs it is strongly recommended that you use appropriate output - * compression - * </p> - * - * - * - * @param <TValue> - * Tuple type - * @param <T> - * Writable tuple type - */ -public abstract class AbstractCharacteristicSetGeneratingReducer<TValue, T extends AbstractNodeTupleWritable<TValue>> extends - Reducer<NodeWritable, T, CharacteristicSetWritable, NullWritable> { - - private static final Logger LOG = LoggerFactory.getLogger(AbstractCharacteristicSetGeneratingReducer.class); - - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void reduce(NodeWritable key, Iterable<T> values, Context context) throws IOException, InterruptedException { - Map<NodeWritable, CharacteristicWritable> characteristics = new TreeMap<NodeWritable, CharacteristicWritable>(); - - // Firstly need to find individual characteristics - Iterator<T> iter = values.iterator(); - while (iter.hasNext()) { - T tuple = iter.next(); - NodeWritable predicate = this.getPredicate(tuple); - - if (characteristics.containsKey(predicate)) { - characteristics.get(predicate).increment(); - } else { - characteristics.put(predicate, new CharacteristicWritable(predicate.get())); - } - } - - // Then we need to produce all the possible characteristic sets based on - // this information - List<CharacteristicWritable> cs = new ArrayList<CharacteristicWritable>(characteristics.values()); - if (cs.size() == 0) - return; - for (int i = 1; i <= cs.size(); i++) { - this.outputSets(cs, i, context); - } - } - - /** - * Output all sets of a given size - * - * @param cs - * Characteristics - * @param perSet - * Set size - * @param context - * Context to output sets to - * @throws IOException - * @throws InterruptedException - */ - protected void outputSets(List<CharacteristicWritable> cs, int perSet, Context context) throws IOException, - InterruptedException { - if (perSet == 1) { - for (CharacteristicWritable c : cs) { - CharacteristicSetWritable set = new CharacteristicSetWritable(c); - context.write(set, NullWritable.get()); - if (this.tracing) { - LOG.trace("Key = {}", set); - } - } - } else if (perSet == cs.size()) { - CharacteristicSetWritable set = new CharacteristicSetWritable(); - for (CharacteristicWritable c : cs) { - set.add(c); - } - context.write(set, NullWritable.get()); - if (this.tracing) { - LOG.trace("Key = {}", set); - } - } else { - CharacteristicWritable[] members = new CharacteristicWritable[perSet]; - this.combinations(cs, perSet, 0, members, context); - } - } - - /** - * Calculate all available combinations of N elements from the given - * characteristics - * - * @param cs - * Characteristics - * @param len - * Desired number of elements - * @param startPosition - * Start position - * @param result - * Result array to fill - * @param context - * Context to write completed combinations to - * @throws IOException - * @throws InterruptedException - */ - protected final void combinations(List<CharacteristicWritable> cs, int len, int startPosition, - CharacteristicWritable[] result, Context context) throws IOException, InterruptedException { - if (len == 0) { - CharacteristicSetWritable set = new CharacteristicSetWritable(result); - context.write(set, NullWritable.get()); - if (this.tracing) { - LOG.trace("Key = {}", set); - } - return; - } - for (int i = startPosition; i <= cs.size() - len; i++) { - result[result.length - len] = cs.get(i); - combinations(cs, len - 1, i + 1, result, context); - } - } - - /** - * Gets the predicate for the tuple - * - * @param tuple - * Tuple - * @return - */ - protected abstract NodeWritable getPredicate(T tuple); - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/CharacteristicSetReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/CharacteristicSetReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/CharacteristicSetReducer.java deleted file mode 100644 index e70698a..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/CharacteristicSetReducer.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.characteristics; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Reducer; -import org.apache.jena.hadoop.rdf.types.CharacteristicSetWritable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Reducer which takes in characteristic sets and sums up all their usage counts - * - * - */ -public class CharacteristicSetReducer extends - Reducer<CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable, NullWritable> { - - private static final Logger LOG = LoggerFactory.getLogger(CharacteristicSetReducer.class); - private boolean tracing = false; - - @Override - protected void setup(Context context) throws IOException, InterruptedException { - super.setup(context); - this.tracing = LOG.isTraceEnabled(); - } - - @Override - protected void reduce(CharacteristicSetWritable key, Iterable<CharacteristicSetWritable> values, Context context) - throws IOException, InterruptedException { - Iterator<CharacteristicSetWritable> iter = values.iterator(); - CharacteristicSetWritable output = new CharacteristicSetWritable(0); - - if (this.tracing) { - LOG.trace("Key = {}", key); - } - - while (iter.hasNext()) { - CharacteristicSetWritable set = iter.next(); - if (this.tracing) { - LOG.trace("Value = {}", set); - } - output.add(set); - } - - context.write(output, NullWritable.get()); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/QuadCharacteristicSetGeneratingReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/QuadCharacteristicSetGeneratingReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/QuadCharacteristicSetGeneratingReducer.java deleted file mode 100644 index d11cd56..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/QuadCharacteristicSetGeneratingReducer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.characteristics; - -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - -import com.hp.hpl.jena.sparql.core.Quad; - -/** - * A reducer which converts quads grouped by some node into characteristic sets - * - * - * - */ -public class QuadCharacteristicSetGeneratingReducer extends AbstractCharacteristicSetGeneratingReducer<Quad, QuadWritable> { - - @Override - protected NodeWritable getPredicate(QuadWritable tuple) { - return new NodeWritable(tuple.get().getPredicate()); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/TripleCharacteristicSetGeneratingReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/TripleCharacteristicSetGeneratingReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/TripleCharacteristicSetGeneratingReducer.java deleted file mode 100644 index 6515c91..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/characteristics/TripleCharacteristicSetGeneratingReducer.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.characteristics; - -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.graph.Triple; - -/** - * A reducer which converts triples grouped by some node into characteristic - * sets - * - * - * - */ -public class TripleCharacteristicSetGeneratingReducer extends AbstractCharacteristicSetGeneratingReducer<Triple, TripleWritable> { - - @Override - protected NodeWritable getPredicate(TripleWritable tuple) { - return new NodeWritable(tuple.get().getPredicate()); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/AbstractNodeTupleNodeCountMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/AbstractNodeTupleNodeCountMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/AbstractNodeTupleNodeCountMapper.java deleted file mode 100644 index 7c56d1c..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/AbstractNodeTupleNodeCountMapper.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.count; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; -import org.apache.jena.hadoop.rdf.types.NodeWritable; - - -/** - * Abstract mapper class for mappers which split node tuple values into pairs of - * node keys with a long value of 1. Can be used in conjunction with a - * {@link NodeCountReducer} to count the usages of each unique node. - * - * - * - * @param <TKey> - * Key type - * @param <TValue> - * Tuple type - * @param <T> - * Writable tuple type - */ -public abstract class AbstractNodeTupleNodeCountMapper<TKey, TValue, T extends AbstractNodeTupleWritable<TValue>> extends - Mapper<TKey, T, NodeWritable, LongWritable> { - - private LongWritable initialCount = new LongWritable(1); - - @Override - protected void map(TKey key, T value, Context context) throws IOException, - InterruptedException { - NodeWritable[] ns = this.getNodes(value); - for (NodeWritable n : ns) { - context.write(n, this.initialCount); - } - } - - /** - * Gets the nodes of the tuple which are to be counted - * - * @param tuple - * Tuple - * @return Nodes - */ - protected abstract NodeWritable[] getNodes(T tuple); - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/NodeCountReducer.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/NodeCountReducer.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/NodeCountReducer.java deleted file mode 100644 index a5460f6..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/NodeCountReducer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.count; - -import java.io.IOException; -import java.util.Iterator; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.Reducer; -import org.apache.jena.hadoop.rdf.types.NodeWritable; - - -/** - * A reducer which takes node keys with a sequence of longs representing counts - * as the values and sums the counts together into pairs consisting of a node - * key and a count value. - * - * - * - */ -public class NodeCountReducer extends Reducer<NodeWritable, LongWritable, NodeWritable, LongWritable> { - - @Override - protected void reduce(NodeWritable key, Iterable<LongWritable> values, Context context) throws IOException, - InterruptedException { - long count = 0; - Iterator<LongWritable> iter = values.iterator(); - while (iter.hasNext()) { - count += iter.next().get(); - } - context.write(key, new LongWritable(count)); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/QuadNodeCountMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/QuadNodeCountMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/QuadNodeCountMapper.java deleted file mode 100644 index 5c2485b..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/QuadNodeCountMapper.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.count; - -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - -import com.hp.hpl.jena.sparql.core.Quad; - -/** - * A mapper for counting node usages within quads designed primarily for use in - * conjunction with {@link NodeCountReducer} - * - * - * - * @param <TKey> - * Key type - */ -public class QuadNodeCountMapper<TKey> extends AbstractNodeTupleNodeCountMapper<TKey, Quad, QuadWritable> { - - @Override - protected NodeWritable[] getNodes(QuadWritable tuple) { - Quad q = tuple.get(); - return new NodeWritable[] { new NodeWritable(q.getGraph()), new NodeWritable(q.getSubject()), - new NodeWritable(q.getPredicate()), new NodeWritable(q.getObject()) }; - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/TripleNodeCountMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/TripleNodeCountMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/TripleNodeCountMapper.java deleted file mode 100644 index 4108841..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/TripleNodeCountMapper.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.count; - -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.graph.Triple; - -/** - * A mapper for counting node usages within triples designed primarily for use - * in conjunction with {@link NodeCountReducer} - * - * - * - * @param <TKey> Key type - */ -public class TripleNodeCountMapper<TKey> extends AbstractNodeTupleNodeCountMapper<TKey, Triple, TripleWritable> { - - @Override - protected NodeWritable[] getNodes(TripleWritable tuple) { - Triple t = tuple.get(); - return new NodeWritable[] { new NodeWritable(t.getSubject()), new NodeWritable(t.getPredicate()), - new NodeWritable(t.getObject()) }; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/QuadDataTypeCountMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/QuadDataTypeCountMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/QuadDataTypeCountMapper.java deleted file mode 100644 index 7ea7ead..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/QuadDataTypeCountMapper.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.count.datatypes; - -import org.apache.jena.hadoop.rdf.mapreduce.count.NodeCountReducer; -import org.apache.jena.hadoop.rdf.mapreduce.count.QuadNodeCountMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.QuadWritable; - -import com.hp.hpl.jena.graph.Node; -import com.hp.hpl.jena.graph.NodeFactory; - -/** - * A mapper for counting data type usages within quads designed primarily for - * use in conjunction with {@link NodeCountReducer} - * <p> - * This mapper extracts the data types for typed literal objects and converts - * them into nodes so they can be counted - * </p> - * - * - * - * @param <TKey> - * Key type - */ -public class QuadDataTypeCountMapper<TKey> extends QuadNodeCountMapper<TKey> { - - private static final NodeWritable[] EMPTY = new NodeWritable[0]; - - @Override - protected NodeWritable[] getNodes(QuadWritable tuple) { - Node object = tuple.get().getObject(); - if (!object.isLiteral()) - return EMPTY; - String dtUri = object.getLiteralDatatypeURI(); - if (dtUri == null) - return EMPTY; - return new NodeWritable[] { new NodeWritable(NodeFactory.createURI(dtUri)) }; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/TripleDataTypeCountMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/TripleDataTypeCountMapper.java b/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/TripleDataTypeCountMapper.java deleted file mode 100644 index 2c294be..0000000 --- a/jena-hadoop-rdf/hadoop-rdf-mapreduce/src/main/java/org/apache/jena/hadoop/rdf/mapreduce/count/datatypes/TripleDataTypeCountMapper.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.hadoop.rdf.mapreduce.count.datatypes; - -import org.apache.jena.hadoop.rdf.mapreduce.count.NodeCountReducer; -import org.apache.jena.hadoop.rdf.mapreduce.count.TripleNodeCountMapper; -import org.apache.jena.hadoop.rdf.types.NodeWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; - -import com.hp.hpl.jena.graph.Node; -import com.hp.hpl.jena.graph.NodeFactory; - -/** - * A mapper for counting data type usages within triples designed primarily for - * use in conjunction with {@link NodeCountReducer} - * <p> - * This mapper extracts the data types for typed literal objects and converts - * them into nodes so they can be counted - * </p> - * - * - * - * @param <TKey> - * Key type - */ -public class TripleDataTypeCountMapper<TKey> extends TripleNodeCountMapper<TKey> { - - private static final NodeWritable[] EMPTY = new NodeWritable[0]; - - @Override - protected NodeWritable[] getNodes(TripleWritable tuple) { - Node object = tuple.get().getObject(); - if (!object.isLiteral()) - return EMPTY; - String dtUri = object.getLiteralDatatypeURI(); - if (dtUri == null) - return EMPTY; - return new NodeWritable[] { new NodeWritable(NodeFactory.createURI(dtUri)) }; - } -}
