http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/HadoopRdfIORegistry.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/HadoopRdfIORegistry.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/HadoopRdfIORegistry.java deleted file mode 100644 index 7b04ef4..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/HadoopRdfIORegistry.java +++ /dev/null @@ -1,310 +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.io.registry; - -import java.io.IOException; -import java.io.Writer; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.ServiceLoader; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * A registry which is used by various classes to dynamically select record - * readers and writers based on a provided {@link Lang} - * <p> - * Readers and writers are dynamically discovered using the Java - * {@link ServiceLoader} mechanism. This will look for files under - * {@code META-INF/services} named - * {@code org.apache.jena.hadoop.rdf.io.registry.ReaderFactory} and - * {@code org.apache.jena.hadoop.rdf.io.registry.WriterFactory}. This follows - * the standard {@linkplain ServiceLoader} format of provided one class name per - * line which implements the relevant interface. - * </p> - * - */ -public class HadoopRdfIORegistry { - - private static Map<Lang, ReaderFactory> readerFactories = new HashMap<>(); - private static Map<Lang, WriterFactory> writerFactories = new HashMap<>(); - private static boolean init = false; - - static { - init(); - } - - private static synchronized void init() { - if (init) - return; - - // Dynamically load and register reader factories - ServiceLoader<ReaderFactory> readerFactoryLoader = ServiceLoader.load(ReaderFactory.class); - Iterator<ReaderFactory> readerFactoryIterator = readerFactoryLoader.iterator(); - while (readerFactoryIterator.hasNext()) { - ReaderFactory f = readerFactoryIterator.next(); - addReaderFactory(f); - } - - // Dynamically load and register writer factories - ServiceLoader<WriterFactory> writerFactoryLoader = ServiceLoader.load(WriterFactory.class); - Iterator<WriterFactory> writerFactoryIterator = writerFactoryLoader.iterator(); - while (writerFactoryIterator.hasNext()) { - WriterFactory f = writerFactoryIterator.next(); - addWriterFactory(f); - } - - init = true; - } - - /** - * Resets the registry to the default configuration - */ - public static synchronized void reset() { - if (!init) - return; - - init = false; - init(); - } - - /** - * Registers the reader factory for all the languages it declares itself as - * supporting - * - * @param f - * Reader factory - */ - public static void addReaderFactory(ReaderFactory f) { - if (f == null) - throw new NullPointerException("Factory cannot be null"); - - readerFactories.put(f.getPrimaryLanguage(), f); - for (Lang altLang : f.getAlternativeLanguages()) { - readerFactories.put(altLang, f); - } - } - - /** - * Registers the writer factory for all the languages it declares itself as - * supporting - * - * @param f - * Writer factory - */ - public static void addWriterFactory(WriterFactory f) { - if (f == null) - throw new NullPointerException("Factory cannot be null"); - - writerFactories.put(f.getPrimaryLanguage(), f); - for (Lang altLang : f.getAlternativeLanguages()) { - writerFactories.put(altLang, f); - } - } - - /** - * Gets whether there is a quad reader available for the given language - * - * @param lang - * Language - * @return True if available, false otherwise - */ - public static boolean hasQuadReader(Lang lang) { - if (lang == null) - return false; - - ReaderFactory f = readerFactories.get(lang); - if (f == null) - return false; - return f.canReadQuads(); - } - - /** - * Gets whether there is a triple reader available for the given language - * - * @param lang - * Language - * @return True if available, false otherwise - */ - public static boolean hasTriplesReader(Lang lang) { - if (lang == null) - return false; - - ReaderFactory f = readerFactories.get(lang); - if (f == null) - return false; - return f.canReadTriples(); - } - - /** - * Tries to create a quad reader for the given language - * - * @param lang - * Language - * @return Quad reader if one is available - * @throws IOException - * Thrown if a quad reader is not available or the given - * language does not support quads - */ - public static RecordReader<LongWritable, QuadWritable> createQuadReader(Lang lang) throws IOException { - if (lang == null) - throw new IOException("Cannot create a quad reader for an undefined language"); - - ReaderFactory f = readerFactories.get(lang); - if (f == null) - throw new IOException("No factory registered for language " + lang.getName()); - if (!f.canReadQuads()) - throw new IOException(lang.getName() + " does not support reading quads"); - - RecordReader<LongWritable, QuadWritable> reader = f.createQuadReader(); - if (reader == null) - throw new IOException("Registered factory for " + lang.getName() + " produced a null triples reader"); - return reader; - } - - /** - * Tries to create a triple reader for the given language - * - * @param lang - * Language - * @return Triple reader if one is available - * @throws IOException - * Thrown if a triple reader is not available or the given - * language does not support triple - */ - public static RecordReader<LongWritable, TripleWritable> createTripleReader(Lang lang) throws IOException { - if (lang == null) - throw new IOException("Cannot create a triple reader for an undefined language"); - - ReaderFactory f = readerFactories.get(lang); - if (f == null) - throw new IOException("No factory registered for language " + lang.getName()); - if (!f.canReadTriples()) - throw new IOException(lang.getName() + " does not support reading triples"); - - RecordReader<LongWritable, TripleWritable> reader = f.createTripleReader(); - if (reader == null) - throw new IOException("Registered factory for " + lang.getName() + " produced a null triples reader"); - return reader; - } - - /** - * Gets whether there is a quad writer available for the given language - * - * @param lang - * Language - * @return True if available, false otherwise - */ - public static boolean hasQuadWriter(Lang lang) { - if (lang == null) - return false; - - WriterFactory f = writerFactories.get(lang); - if (f == null) - return false; - return f.canWriteQuads(); - } - - /** - * Gets whether there is a triple writer available for the given language - * - * @param lang - * Language - * @return True if available, false otherwise - */ - public static boolean hasTriplesWriter(Lang lang) { - if (lang == null) - return false; - - WriterFactory f = writerFactories.get(lang); - if (f == null) - return false; - return f.canWriteTriples(); - } - - /** - * Tries to create a quad writer for the given language - * - * @param lang - * Language - * @param writer - * Writer - * @param config - * Configuration - * - * @return Quad writer if one is available - * @throws IOException - * Thrown if a quad writer is not available or the given - * language does not support quads - */ - public static <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Lang lang, Writer writer, - Configuration config) throws IOException { - if (lang == null) - throw new IOException("Cannot create a quad writer for an undefined language"); - - WriterFactory f = writerFactories.get(lang); - if (f == null) - throw new IOException("No factory registered for language " + lang.getName()); - if (!f.canWriteQuads()) - throw new IOException(lang.getName() + " does not support writeing quads"); - - RecordWriter<TKey, QuadWritable> rwriter = f.<TKey> createQuadWriter(writer, config); - if (rwriter == null) - throw new IOException("Registered factory for " + lang.getName() + " produced a null triples writer"); - return rwriter; - } - - /** - * Tries to create a triple writer for the given language - * - * @param lang - * Language - * @param writer - * Writer - * @param config - * Configuration - * @return Triple writer if one is available - * @throws IOException - * Thrown if a triple writer is not available or the given - * language does not support triple - */ - public static <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Lang lang, Writer writer, - Configuration config) throws IOException { - if (lang == null) - throw new IOException("Cannot create a triple writer for an undefined language"); - - WriterFactory f = writerFactories.get(lang); - if (f == null) - throw new IOException("No factory registered for language " + lang.getName()); - if (!f.canWriteTriples()) - throw new IOException(lang.getName() + " does not support writing triples"); - - RecordWriter<TKey, TripleWritable> rwriter = f.<TKey> createTripleWriter(writer, config); - if (rwriter == null) - throw new IOException("Registered factory for " + lang.getName() + " produced a null triples writer"); - return rwriter; - } -}
http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/ReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/ReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/ReaderFactory.java deleted file mode 100644 index e1c98c7..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/ReaderFactory.java +++ /dev/null @@ -1,83 +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.io.registry; - -import java.io.IOException; -import java.util.Collection; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Interface for reader factories - * - */ -public interface ReaderFactory { - - /** - * Gets the primary language this factory produces readers for - * - * @return Primary language - */ - public abstract Lang getPrimaryLanguage(); - - /** - * Gets the alternative languages this factory can produce readers for - * - * @return Alternative languages - */ - public abstract Collection<Lang> getAlternativeLanguages(); - - /** - * Gets whether this factory can produce readers that are capable of reading - * quads - * - * @return True if quads can be read, false if not - */ - public abstract boolean canReadQuads(); - - /** - * Gets whether this factory can produce readers that are capable of reading - * triples - * - * @return True if triples can be read, false if not - */ - public abstract boolean canReadTriples(); - - /** - * Creates a quad reader - * - * @return Quad reader - * @throws IOException - * May be thrown if a quad reader cannot be created - */ - public abstract RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException; - - /** - * Creates a triples reader - * - * @return Triples reader - * @throws IOException - * May be thrown if a triple reader cannot be created - */ - public abstract RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException; -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/WriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/WriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/WriterFactory.java deleted file mode 100644 index db5635f..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/WriterFactory.java +++ /dev/null @@ -1,96 +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.io.registry; - -import java.io.IOException; -import java.io.Writer; -import java.util.Collection; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Interface for writer factories - * - */ -public interface WriterFactory { - - /** - * Gets the primary language this factory produces writers for - * - * @return Primary language - */ - public abstract Lang getPrimaryLanguage(); - - /** - * Gets the alternative languages this factory can produce writers for - * - * @return Alternative languages - */ - public abstract Collection<Lang> getAlternativeLanguages(); - - /** - * Gets whether this factory can produce writers that are capable of reading - * quads - * - * @return True if quads can be read, false if not - */ - public abstract boolean canWriteQuads(); - - /** - * Gets whether this factory can produce writers that are capable of reading - * triples - * - * @return True if triples can be read, false if not - */ - public abstract boolean canWriteTriples(); - - /** - * Creates a quad writer - * - * @param writer - * Writer - * @param config - * Configuration - * - * @return Quad writer - * @throws IOException - * May be thrown if a quad writer cannot be created - */ - public abstract <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException; - - /** - * Creates a triples writer - * - * @param writer - * Writer - * @param config - * Configuration - * - * @return Triples writer - * @throws IOException - * May be thrown if a triple writer cannot be created - */ - public abstract <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException; -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractQuadsOnlyReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractQuadsOnlyReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractQuadsOnlyReaderFactory.java deleted file mode 100644 index 7fe15a9..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractQuadsOnlyReaderFactory.java +++ /dev/null @@ -1,83 +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.io.registry.readers; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.registry.ReaderFactory; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Abstract reader factory for languages that only support quads - */ -public abstract class AbstractQuadsOnlyReaderFactory implements ReaderFactory { - - private Lang lang; - private Collection<Lang> alternateLangs = Collections.unmodifiableList(Collections.<Lang>emptyList()); - - public AbstractQuadsOnlyReaderFactory(Lang lang) { - this(lang, (Collection<Lang>)null); - } - - public AbstractQuadsOnlyReaderFactory(Lang lang, Lang...altLangs) { - this(lang, Arrays.asList(altLangs)); - } - - public AbstractQuadsOnlyReaderFactory(Lang lang, Collection<Lang> altLangs) { - this.lang = lang; - if (altLangs != null) - this.alternateLangs = Collections.unmodifiableCollection(altLangs); - } - - @Override - public final Lang getPrimaryLanguage() { - return this.lang; - } - - @Override - public final Collection<Lang> getAlternativeLanguages() { - return this.alternateLangs; - } - - @Override - public final boolean canReadQuads() { - return true; - } - - @Override - public final boolean canReadTriples() { - return false; - } - - @Override - public abstract RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException; - - @Override - public final RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException { - throw new IOException(this.lang.getName() + " does not support reading triples"); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractReaderFactory.java deleted file mode 100644 index 60e45af..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractReaderFactory.java +++ /dev/null @@ -1,80 +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.io.registry.readers; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.registry.ReaderFactory; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Abstract reader factory for languages that support triples and quads - */ -public abstract class AbstractReaderFactory implements ReaderFactory { - - private Lang lang; - private Collection<Lang> alternateLangs = Collections.unmodifiableList(Collections.<Lang>emptyList()); - - public AbstractReaderFactory(Lang lang) { - this(lang, (Collection<Lang>)null); - } - - public AbstractReaderFactory(Lang lang, Lang...altLangs) { - this(lang, Arrays.asList(altLangs)); - } - - public AbstractReaderFactory(Lang lang, Collection<Lang> altLangs) { - this.lang = lang; - if (altLangs != null) - this.alternateLangs = Collections.unmodifiableCollection(altLangs); - } - - @Override - public final Lang getPrimaryLanguage() { - return this.lang; - } - - @Override - public final Collection<Lang> getAlternativeLanguages() { - return this.alternateLangs; - } - - @Override - public final boolean canReadQuads() { - return true; - } - - @Override - public final boolean canReadTriples() { - return true; - } - - @Override - public abstract RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException; - - @Override - public abstract RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException; - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractTriplesOnlyReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractTriplesOnlyReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractTriplesOnlyReaderFactory.java deleted file mode 100644 index 7fb8131..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/AbstractTriplesOnlyReaderFactory.java +++ /dev/null @@ -1,83 +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.io.registry.readers; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.registry.ReaderFactory; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Abstract reader factory for languages that only support triples - */ -public abstract class AbstractTriplesOnlyReaderFactory implements ReaderFactory { - - private Lang lang; - private Collection<Lang> alternateLangs = Collections.unmodifiableList(Collections.<Lang>emptyList()); - - public AbstractTriplesOnlyReaderFactory(Lang lang) { - this(lang, (Collection<Lang>)null); - } - - public AbstractTriplesOnlyReaderFactory(Lang lang, Lang...altLangs) { - this(lang, Arrays.asList(altLangs)); - } - - public AbstractTriplesOnlyReaderFactory(Lang lang, Collection<Lang> altLangs) { - this.lang = lang; - if (altLangs != null) - this.alternateLangs = Collections.unmodifiableCollection(altLangs); - } - - @Override - public final Lang getPrimaryLanguage() { - return this.lang; - } - - @Override - public final Collection<Lang> getAlternativeLanguages() { - return this.alternateLangs; - } - - @Override - public final boolean canReadQuads() { - return false; - } - - @Override - public final boolean canReadTriples() { - return true; - } - - @Override - public final RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException { - throw new IOException(this.lang.getName() + " does not support reading quads"); - } - - @Override - public abstract RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException; - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/JsonLDReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/JsonLDReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/JsonLDReaderFactory.java deleted file mode 100644 index 6b064a4..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/JsonLDReaderFactory.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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.jsonld.JsonLDQuadReader; -import org.apache.jena.hadoop.rdf.io.input.readers.jsonld.JsonLDTripleReader; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class JsonLDReaderFactory extends AbstractReaderFactory { - - public JsonLDReaderFactory() { - super(Lang.JSONLD); - } - - @Override - public RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException { - return new JsonLDQuadReader(); - } - - @Override - public RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException { - return new JsonLDTripleReader(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NQuadsReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NQuadsReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NQuadsReaderFactory.java deleted file mode 100644 index 2296296..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NQuadsReaderFactory.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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.nquads.WholeFileNQuadsReader; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class NQuadsReaderFactory extends AbstractQuadsOnlyReaderFactory { - - public NQuadsReaderFactory() { - super(Lang.NQUADS, Lang.NQ); - } - - @Override - public RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException { - return new WholeFileNQuadsReader(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NTriplesReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NTriplesReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NTriplesReaderFactory.java deleted file mode 100644 index a98a1ae..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/NTriplesReaderFactory.java +++ /dev/null @@ -1,38 +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.io.registry.readers; - -import java.io.IOException; -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.ntriples.WholeFileNTriplesReader; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -public class NTriplesReaderFactory extends AbstractTriplesOnlyReaderFactory { - - public NTriplesReaderFactory() { - super(Lang.NTRIPLES, Lang.NT); - } - - @Override - public RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException { - return new WholeFileNTriplesReader(); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfJsonReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfJsonReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfJsonReaderFactory.java deleted file mode 100644 index ccf5feb..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfJsonReaderFactory.java +++ /dev/null @@ -1,41 +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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.rdfjson.RdfJsonReader; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class RdfJsonReaderFactory extends AbstractTriplesOnlyReaderFactory { - - public RdfJsonReaderFactory() { - super(Lang.RDFJSON); - } - - @Override - public RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException { - return new RdfJsonReader(); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfXmlReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfXmlReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfXmlReaderFactory.java deleted file mode 100644 index 1aa88d7..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/RdfXmlReaderFactory.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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.rdfxml.RdfXmlReader; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -public class RdfXmlReaderFactory extends AbstractTriplesOnlyReaderFactory { - - public RdfXmlReaderFactory() { - super(Lang.RDFXML); - } - - @Override - public RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException { - return new RdfXmlReader(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/ThriftReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/ThriftReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/ThriftReaderFactory.java deleted file mode 100644 index 25e8234..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/ThriftReaderFactory.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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.thrift.ThriftQuadReader; -import org.apache.jena.hadoop.rdf.io.input.readers.thrift.ThriftTripleReader; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.RDFLanguages; - -/** - * - */ -public class ThriftReaderFactory extends AbstractReaderFactory { - - public ThriftReaderFactory() { - super(RDFLanguages.THRIFT); - } - - @Override - public RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException { - return new ThriftQuadReader(); - } - - @Override - public RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException { - return new ThriftTripleReader(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriGReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriGReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriGReaderFactory.java deleted file mode 100644 index 83ea818..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriGReaderFactory.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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.trig.TriGReader; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class TriGReaderFactory extends AbstractQuadsOnlyReaderFactory { - - public TriGReaderFactory() { - super(Lang.TRIG); - } - - @Override - public RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException { - return new TriGReader(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriXReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriXReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriXReaderFactory.java deleted file mode 100644 index cb8795c..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TriXReaderFactory.java +++ /dev/null @@ -1,41 +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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.trix.TriXReader; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class TriXReaderFactory extends AbstractQuadsOnlyReaderFactory { - - public TriXReaderFactory() { - super(Lang.TRIX); - } - - @Override - public RecordReader<LongWritable, QuadWritable> createQuadReader() throws IOException { - return new TriXReader(); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TurtleReaderFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TurtleReaderFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TurtleReaderFactory.java deleted file mode 100644 index 7800376..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/readers/TurtleReaderFactory.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.io.registry.readers; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.jena.hadoop.rdf.io.input.readers.turtle.TurtleReader; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -public class TurtleReaderFactory extends AbstractTriplesOnlyReaderFactory { - - public TurtleReaderFactory() { - super(Lang.TURTLE, Lang.TTL, Lang.N3); - } - - @Override - public RecordReader<LongWritable, TripleWritable> createTripleReader() throws IOException { - return new TurtleReader(); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractQuadsOnlyWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractQuadsOnlyWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractQuadsOnlyWriterFactory.java deleted file mode 100644 index 0cf137e..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractQuadsOnlyWriterFactory.java +++ /dev/null @@ -1,86 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.registry.WriterFactory; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Abstract writer factory for languages that only support quads - */ -public abstract class AbstractQuadsOnlyWriterFactory implements WriterFactory { - - private Lang lang; - private Collection<Lang> alternateLangs = Collections.unmodifiableList(Collections.<Lang> emptyList()); - - public AbstractQuadsOnlyWriterFactory(Lang lang) { - this(lang, (Collection<Lang>) null); - } - - public AbstractQuadsOnlyWriterFactory(Lang lang, Lang... altLangs) { - this(lang, Arrays.asList(altLangs)); - } - - public AbstractQuadsOnlyWriterFactory(Lang lang, Collection<Lang> altLangs) { - this.lang = lang; - if (altLangs != null) - this.alternateLangs = Collections.unmodifiableCollection(altLangs); - } - - @Override - public final Lang getPrimaryLanguage() { - return this.lang; - } - - @Override - public final Collection<Lang> getAlternativeLanguages() { - return this.alternateLangs; - } - - @Override - public final boolean canWriteQuads() { - return true; - } - - @Override - public final boolean canWriteTriples() { - return false; - } - - @Override - public abstract <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException; - - @Override - public final <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException { - throw new IOException(this.lang.getName() + " does not support writing triples"); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractTriplesOnlyWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractTriplesOnlyWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractTriplesOnlyWriterFactory.java deleted file mode 100644 index e45c3da..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractTriplesOnlyWriterFactory.java +++ /dev/null @@ -1,85 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.registry.WriterFactory; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Abstract writer factory for languages that only support triples - */ -public abstract class AbstractTriplesOnlyWriterFactory implements WriterFactory { - - private Lang lang; - private Collection<Lang> alternateLangs = Collections.unmodifiableList(Collections.<Lang> emptyList()); - - public AbstractTriplesOnlyWriterFactory(Lang lang) { - this(lang, (Collection<Lang>) null); - } - - public AbstractTriplesOnlyWriterFactory(Lang lang, Lang... altLangs) { - this(lang, Arrays.asList(altLangs)); - } - - public AbstractTriplesOnlyWriterFactory(Lang lang, Collection<Lang> altLangs) { - this.lang = lang; - if (altLangs != null) - this.alternateLangs = Collections.unmodifiableCollection(altLangs); - } - - @Override - public final Lang getPrimaryLanguage() { - return this.lang; - } - - @Override - public final Collection<Lang> getAlternativeLanguages() { - return this.alternateLangs; - } - - @Override - public final boolean canWriteQuads() { - return false; - } - - @Override - public final boolean canWriteTriples() { - return true; - } - - @Override - public final <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException { - throw new IOException(this.lang.getName() + " does not support writing quads"); - } - - @Override - public abstract <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException; - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractWriterFactory.java deleted file mode 100644 index 669b9c4..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/AbstractWriterFactory.java +++ /dev/null @@ -1,82 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.registry.WriterFactory; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * Abstract writer factory for languages that support triples and quads - */ -public abstract class AbstractWriterFactory implements WriterFactory { - - private Lang lang; - private Collection<Lang> alternateLangs = Collections.unmodifiableList(Collections.<Lang>emptyList()); - - public AbstractWriterFactory(Lang lang) { - this(lang, (Collection<Lang>)null); - } - - public AbstractWriterFactory(Lang lang, Lang...altLangs) { - this(lang, Arrays.asList(altLangs)); - } - - public AbstractWriterFactory(Lang lang, Collection<Lang> altLangs) { - this.lang = lang; - if (altLangs != null) - this.alternateLangs = Collections.unmodifiableCollection(altLangs); - } - - @Override - public final Lang getPrimaryLanguage() { - return this.lang; - } - - @Override - public final Collection<Lang> getAlternativeLanguages() { - return this.alternateLangs; - } - - @Override - public final boolean canWriteQuads() { - return true; - } - - @Override - public final boolean canWriteTriples() { - return true; - } - - @Override - public abstract <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) throws IOException; - - @Override - public abstract <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) throws IOException; - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/JsonLDWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/JsonLDWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/JsonLDWriterFactory.java deleted file mode 100644 index 89e93ed..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/JsonLDWriterFactory.java +++ /dev/null @@ -1,52 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.jsonld.JsonLDQuadWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.jsonld.JsonLDTripleWriter; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class JsonLDWriterFactory extends AbstractWriterFactory { - - public JsonLDWriterFactory() { - super(Lang.JSONLD); - } - - @Override - public <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException { - return new JsonLDQuadWriter<>(writer); - } - - @Override - public <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException { - return new JsonLDTripleWriter<>(writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NQuadsWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NQuadsWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NQuadsWriterFactory.java deleted file mode 100644 index abbbd0f..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NQuadsWriterFactory.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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.nquads.NQuadsWriter; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class NQuadsWriterFactory extends AbstractQuadsOnlyWriterFactory { - - public NQuadsWriterFactory() { - super(Lang.NQUADS, Lang.NQ); - } - - @Override - public <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException { - return new NQuadsWriter<TKey>(writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NTriplesWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NTriplesWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NTriplesWriterFactory.java deleted file mode 100644 index 88c9551..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/NTriplesWriterFactory.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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.ntriples.NTriplesWriter; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class NTriplesWriterFactory extends AbstractTriplesOnlyWriterFactory { - - public NTriplesWriterFactory() { - super(Lang.NTRIPLES, Lang.NT); - } - - @Override - public <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException { - return new NTriplesWriter<TKey>(writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfJsonWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfJsonWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfJsonWriterFactory.java deleted file mode 100644 index 8252422..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfJsonWriterFactory.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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.rdfjson.RdfJsonWriter; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class RdfJsonWriterFactory extends AbstractTriplesOnlyWriterFactory { - - public RdfJsonWriterFactory() { - super(Lang.RDFJSON); - } - - @Override - public <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException { - return new RdfJsonWriter<TKey>(writer); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfXmlWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfXmlWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfXmlWriterFactory.java deleted file mode 100644 index b4ac8e3..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/RdfXmlWriterFactory.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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.rdfxml.RdfXmlWriter; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; - -/** - * - */ -public class RdfXmlWriterFactory extends AbstractTriplesOnlyWriterFactory { - - public RdfXmlWriterFactory() { - super(Lang.RDFXML); - } - - @Override - public <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException { - return new RdfXmlWriter<TKey>(writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/ThriftWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/ThriftWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/ThriftWriterFactory.java deleted file mode 100644 index 757472c..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/ThriftWriterFactory.java +++ /dev/null @@ -1,57 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; -import java.nio.charset.Charset; - -import org.apache.commons.io.output.WriterOutputStream; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.StreamRdfQuadWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.StreamRdfTripleWriter; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.RDFLanguages; -import org.apache.jena.riot.thrift.StreamRDF2Thrift; - -/** - * - */ -public class ThriftWriterFactory extends AbstractWriterFactory { - - public ThriftWriterFactory() { - super(RDFLanguages.THRIFT); - } - - @Override - public <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException { - return new StreamRdfQuadWriter<TKey>(new StreamRDF2Thrift(new WriterOutputStream(writer, Charset.forName("utf-8")), - false), writer); - } - - @Override - public <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException { - return new StreamRdfTripleWriter<TKey>(new StreamRDF2Thrift(new WriterOutputStream(writer, Charset.forName("utf-8")), - false), writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriGWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriGWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriGWriterFactory.java deleted file mode 100644 index 6d8b08a..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriGWriterFactory.java +++ /dev/null @@ -1,45 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.StreamRdfQuadWriter; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.riot.Lang; -import org.apache.jena.riot.writer.WriterStreamRDFBlocks; - -/** - * - */ -public class TriGWriterFactory extends AbstractQuadsOnlyWriterFactory { - - public TriGWriterFactory() { - super(Lang.TRIG); - } - - @Override - public <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException { - return new StreamRdfQuadWriter<TKey>(new WriterStreamRDFBlocks(writer), writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriXWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriXWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriXWriterFactory.java deleted file mode 100644 index 0e1b7b2..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TriXWriterFactory.java +++ /dev/null @@ -1,47 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; -import java.nio.charset.Charset; - -import org.apache.commons.io.output.WriterOutputStream; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.StreamRdfQuadWriter; -import org.apache.jena.hadoop.rdf.types.QuadWritable; -import org.apache.jena.riot.Lang; -import org.apache.jena.riot.writer.StreamWriterTriX; - -/** - * - */ -public class TriXWriterFactory extends AbstractQuadsOnlyWriterFactory { - - public TriXWriterFactory() { - super(Lang.TRIX); - } - - @Override - public <TKey> RecordWriter<TKey, QuadWritable> createQuadWriter(Writer writer, Configuration config) - throws IOException { - return new StreamRdfQuadWriter<>(new StreamWriterTriX(new WriterOutputStream(writer, Charset.forName("utf-8"))), writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TurtleWriterFactory.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TurtleWriterFactory.java b/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TurtleWriterFactory.java deleted file mode 100644 index c837f12..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/registry/writers/TurtleWriterFactory.java +++ /dev/null @@ -1,45 +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.io.registry.writers; - -import java.io.IOException; -import java.io.Writer; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.jena.hadoop.rdf.io.output.writers.StreamRdfTripleWriter; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.jena.riot.Lang; -import org.apache.jena.riot.writer.WriterStreamRDFBlocks; - -/** - * - */ -public class TurtleWriterFactory extends AbstractTriplesOnlyWriterFactory { - - public TurtleWriterFactory() { - super(Lang.TURTLE, Lang.TTL, Lang.N3); - } - - @Override - public <TKey> RecordWriter<TKey, TripleWritable> createTripleWriter(Writer writer, Configuration config) - throws IOException { - return new StreamRdfTripleWriter<>(new WriterStreamRDFBlocks(writer), writer); - } - -} http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.ReaderFactory ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.ReaderFactory b/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.ReaderFactory deleted file mode 100644 index ec0e48a..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.ReaderFactory +++ /dev/null @@ -1,10 +0,0 @@ -# Default Reader Factory implementations -org.apache.jena.hadoop.rdf.io.registry.readers.JsonLDReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.NQuadsReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.NTriplesReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.RdfJsonReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.RdfXmlReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.ThriftReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.TriGReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.TriXReaderFactory -org.apache.jena.hadoop.rdf.io.registry.readers.TurtleReaderFactory \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.WriterFactory ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.WriterFactory b/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.WriterFactory deleted file mode 100644 index 164880d..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/main/resources/META-INF/services/org.apache.jena.hadoop.rdf.io.registry.WriterFactory +++ /dev/null @@ -1,10 +0,0 @@ -# Default Writer Factory implementations -org.apache.jena.hadoop.rdf.io.registry.writers.JsonLDWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.NQuadsWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.NTriplesWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.RdfJsonWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.RdfXmlWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.ThriftWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.TriGWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.TriXWriterFactory -org.apache.jena.hadoop.rdf.io.registry.writers.TurtleWriterFactory \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/49c4cffe/jena-hadoop-rdf/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java ---------------------------------------------------------------------- diff --git a/jena-hadoop-rdf/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java b/jena-hadoop-rdf/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java deleted file mode 100644 index 5762fb7..0000000 --- a/jena-hadoop-rdf/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java +++ /dev/null @@ -1,47 +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.io; - -import java.io.IOException; - -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.io.NullWritable; -import org.apache.hadoop.mapreduce.Mapper; -import org.apache.jena.hadoop.rdf.types.TripleWritable; -import org.apache.log4j.Logger; - - -/** - * A test mapper which takes in line based RDF triple input and just produces triples - * - * - */ -public class RdfTriplesInputTestMapper extends Mapper<LongWritable, TripleWritable, NullWritable, TripleWritable> { - - private static final Logger LOG = Logger.getLogger(RdfTriplesInputTestMapper.class); - - @Override - protected void map(LongWritable key, TripleWritable value, Context context) - throws IOException, InterruptedException { - LOG.info("Line " + key.toString() + " => " + value.toString()); - context.write(NullWritable.get(), value); - } - - -}
