http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractBatchedTripleWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractBatchedTripleWriter.java index 01d5977,01d5977..322921c --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractBatchedTripleWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractBatchedTripleWriter.java @@@ -1,31 -1,31 +1,31 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers; import java.io.Writer; -- --import org.apache.jena.graph.Graph ; --import org.apache.jena.graph.Triple ; --import org.apache.jena.hadoop.rdf.types.TripleWritable; ++ ++import org.apache.jena.graph.Graph ; ++import org.apache.jena.graph.Triple ; ++import org.apache.jena.hadoop.rdf.types.TripleWritable; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; --import org.apache.jena.sparql.graph.GraphFactory ; ++import org.apache.jena.sparql.graph.GraphFactory ; /** * Abstract batched record writer for triple formats
http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedNodeTupleWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedNodeTupleWriter.java index 1df0e62,1df0e62..ae82036 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedNodeTupleWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedNodeTupleWriter.java @@@ -1,31 -1,31 +1,31 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers; import java.io.Writer; -- ++ import org.apache.hadoop.mapreduce.RecordWriter; import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.apache.jena.atlas.io.AWriter; import org.apache.jena.atlas.io.Writer2; --import org.apache.jena.graph.Node ; --import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; ++import org.apache.jena.graph.Node ; ++import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; import org.apache.jena.riot.out.NodeFormatter; import org.apache.jena.riot.out.NodeFormatterNT; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedQuadWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedQuadWriter.java index 9eaa7a4,9eaa7a4..d0c9971 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedQuadWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedQuadWriter.java @@@ -1,30 -1,30 +1,30 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers; import java.io.Writer; -- --import org.apache.jena.graph.Node ; --import org.apache.jena.hadoop.rdf.types.QuadWritable; ++ ++import org.apache.jena.graph.Node ; ++import org.apache.jena.hadoop.rdf.types.QuadWritable; import org.apache.jena.riot.out.NodeFormatter; import org.apache.jena.riot.out.NodeFormatterNT; --import org.apache.jena.sparql.core.Quad ; ++import org.apache.jena.sparql.core.Quad ; /** * An abstract writer for line based quad formats http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedTripleWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedTripleWriter.java index add7358,add7358..9be5faa --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedTripleWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractLineBasedTripleWriter.java @@@ -1,67 -1,67 +1,67 @@@ --/* -- * 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.output.writers; -- --import java.io.Writer; -- --import org.apache.jena.graph.Node ; --import org.apache.jena.graph.Triple ; --import org.apache.jena.hadoop.rdf.types.TripleWritable; --import org.apache.jena.riot.out.NodeFormatter; --import org.apache.jena.riot.out.NodeFormatterNT; -- --/** -- * An abstract writer for line based triple formats -- * -- * @param <TKey> -- * Key type -- * -- */ --public abstract class AbstractLineBasedTripleWriter<TKey> extends -- AbstractLineBasedNodeTupleWriter<TKey, Triple, TripleWritable> { -- -- /** -- * Creates a new writer using the default NTriples node formatter -- * -- * @param writer -- * Writer -- */ -- public AbstractLineBasedTripleWriter(Writer writer) { -- this(writer, new NodeFormatterNT()); -- } -- -- /** -- * Creates a new writer using the specified node formatter -- * -- * @param writer -- * Writer -- * @param formatter -- * Node formatter -- */ -- public AbstractLineBasedTripleWriter(Writer writer, NodeFormatter formatter) { -- super(writer, formatter); -- } -- -- @Override -- protected Node[] getNodes(TripleWritable tuple) { -- Triple t = tuple.get(); -- return new Node[] { t.getSubject(), t.getPredicate(), t.getObject() }; -- } -- --} ++/* ++ * 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.output.writers; ++ ++import java.io.Writer; ++ ++import org.apache.jena.graph.Node ; ++import org.apache.jena.graph.Triple ; ++import org.apache.jena.hadoop.rdf.types.TripleWritable; ++import org.apache.jena.riot.out.NodeFormatter; ++import org.apache.jena.riot.out.NodeFormatterNT; ++ ++/** ++ * An abstract writer for line based triple formats ++ * ++ * @param <TKey> ++ * Key type ++ * ++ */ ++public abstract class AbstractLineBasedTripleWriter<TKey> extends ++ AbstractLineBasedNodeTupleWriter<TKey, Triple, TripleWritable> { ++ ++ /** ++ * Creates a new writer using the default NTriples node formatter ++ * ++ * @param writer ++ * Writer ++ */ ++ public AbstractLineBasedTripleWriter(Writer writer) { ++ this(writer, new NodeFormatterNT()); ++ } ++ ++ /** ++ * Creates a new writer using the specified node formatter ++ * ++ * @param writer ++ * Writer ++ * @param formatter ++ * Node formatter ++ */ ++ public AbstractLineBasedTripleWriter(Writer writer, NodeFormatter formatter) { ++ super(writer, formatter); ++ } ++ ++ @Override ++ protected Node[] getNodes(TripleWritable tuple) { ++ Triple t = tuple.get(); ++ return new Node[] { t.getSubject(), t.getPredicate(), t.getObject() }; ++ } ++ ++} http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractNodeWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractNodeWriter.java index e46b3e1,e46b3e1..a627e1e --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractNodeWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractNodeWriter.java @@@ -1,192 -1,192 +1,192 @@@ --/* -- * 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.output.writers; -- --import java.io.Writer; -- --import org.apache.hadoop.io.NullWritable; --import org.apache.hadoop.mapreduce.RecordWriter; --import org.apache.hadoop.mapreduce.TaskAttemptContext; --import org.apache.jena.atlas.io.AWriter; --import org.apache.jena.atlas.io.Writer2; --import org.apache.jena.atlas.lib.tuple.Tuple ; --import org.apache.jena.graph.Node ; --import org.apache.jena.graph.Triple ; --import org.apache.jena.hadoop.rdf.types.NodeTupleWritable; --import org.apache.jena.hadoop.rdf.types.NodeWritable; --import org.apache.jena.hadoop.rdf.types.QuadWritable; --import org.apache.jena.hadoop.rdf.types.TripleWritable; --import org.apache.jena.riot.out.NodeFormatter; --import org.apache.jena.riot.out.NodeFormatterNT; --import org.apache.jena.sparql.core.Quad ; --import org.slf4j.Logger; --import org.slf4j.LoggerFactory; -- --/** -- * Abstract implementation of a record writer which writes pairs of nodes and -- * arbitrary values to text based files -- * -- * -- * -- * @param <TValue> -- */ --public abstract class AbstractNodeWriter<TValue> extends RecordWriter<NodeWritable, TValue> { -- -- /** -- * Default separator written between nodes and their associated values -- */ -- public static final String DEFAULT_SEPARATOR = "\t"; -- -- private static final Logger log = LoggerFactory.getLogger(AbstractNodeWriter.class); -- -- protected AWriter writer; -- private NodeFormatter formatter; -- -- /** -- * Creates a new tuple writer using the default NTriples node formatter -- * -- * @param writer -- * Writer -- */ -- public AbstractNodeWriter(Writer writer) { -- this(writer, new NodeFormatterNT()); -- } -- -- /** -- * Creates a new tuple writer -- * -- * @param writer -- * Writer -- * @param formatter -- * Node formatter -- */ -- public AbstractNodeWriter(Writer writer, NodeFormatter formatter) { -- if (writer == null) -- throw new NullPointerException("writer cannot be null"); -- if (formatter == null) -- throw new NullPointerException("formatter cannot be null"); -- this.formatter = formatter; -- this.writer = Writer2.wrap(writer); -- } -- -- @Override -- public final void write(NodeWritable key, TValue value) { -- this.writeKey(key); -- this.writer.write(this.getSeparator()); -- this.writeValue(value); -- this.writer.write('\n'); -- } -- -- /** -- * Writes the given key -- * -- * @param key -- * Key -- */ -- protected void writeKey(NodeWritable key) { -- writeNode(key.get()); -- } -- -- /** -- * Writes a Node -- * -- * @param n -- * Node -- */ -- protected void writeNode(Node n) { -- this.getNodeFormatter().format(this.writer, n); -- } -- -- /** -- * Writes a sequence of nodes -- * -- * @param ns -- * Nodes -- */ -- protected void writeNodes(Node... ns) { -- String sep = this.getSeparator(); -- for (int i = 0; i < ns.length; i++) { -- writeNode(ns[i]); -- if (i < ns.length - 1) -- this.writer.write(sep); -- } -- } -- -- /** -- * Writes the given value -- * <p> -- * If the value is one of the RDF primitives - {@link NodeWritable}, -- * {@link TripleWritable}, {@link QuadWritable} and -- * {@link NodeTupleWritable} - then it is formatted as a series of nodes -- * separated by the separator. Otherwise it is formatted by simply calling -- * {@code toString()} on it. -- * </p> -- * -- * @param value -- * Values -- */ -- protected void writeValue(TValue value) { -- // Handle null specially -- if (value instanceof NullWritable || value == null) -- return; -- -- // Handle RDF primitives specially and format them as proper nodes -- if (value instanceof NodeWritable) { -- this.writeKey((NodeWritable) value); -- } else if (value instanceof TripleWritable) { -- Triple t = ((TripleWritable) value).get(); -- this.writeNodes(t.getSubject(), t.getPredicate(), t.getObject()); -- } else if (value instanceof QuadWritable) { -- Quad q = ((QuadWritable) value).get(); -- this.writeNodes(q.getGraph(), q.getSubject(), q.getPredicate(), q.getObject()); -- } else if (value instanceof NodeTupleWritable) { -- Tuple<Node> tuple = ((NodeTupleWritable) value).get(); -- Node[] n = new Node[tuple.len()] ; -- tuple.copyInto(n); -- this.writeNodes(n); -- } else { -- // For arbitrary values just toString() them -- this.writer.write(value.toString()); -- } -- } -- -- @Override -- public void close(TaskAttemptContext context) { -- log.debug("close({})", context); -- writer.close(); -- } -- -- /** -- * Gets the node formatter to use for formatting nodes -- * -- * @return Node formatter -- */ -- protected NodeFormatter getNodeFormatter() { -- return this.formatter; -- } -- -- /** -- * Gets the separator that is written between nodes -- * -- * @return Separator -- */ -- protected String getSeparator() { -- return DEFAULT_SEPARATOR; -- } --} ++/* ++ * 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.output.writers; ++ ++import java.io.Writer; ++ ++import org.apache.hadoop.io.NullWritable; ++import org.apache.hadoop.mapreduce.RecordWriter; ++import org.apache.hadoop.mapreduce.TaskAttemptContext; ++import org.apache.jena.atlas.io.AWriter; ++import org.apache.jena.atlas.io.Writer2; ++import org.apache.jena.atlas.lib.tuple.Tuple ; ++import org.apache.jena.graph.Node ; ++import org.apache.jena.graph.Triple ; ++import org.apache.jena.hadoop.rdf.types.NodeTupleWritable; ++import org.apache.jena.hadoop.rdf.types.NodeWritable; ++import org.apache.jena.hadoop.rdf.types.QuadWritable; ++import org.apache.jena.hadoop.rdf.types.TripleWritable; ++import org.apache.jena.riot.out.NodeFormatter; ++import org.apache.jena.riot.out.NodeFormatterNT; ++import org.apache.jena.sparql.core.Quad ; ++import org.slf4j.Logger; ++import org.slf4j.LoggerFactory; ++ ++/** ++ * Abstract implementation of a record writer which writes pairs of nodes and ++ * arbitrary values to text based files ++ * ++ * ++ * ++ * @param <TValue> ++ */ ++public abstract class AbstractNodeWriter<TValue> extends RecordWriter<NodeWritable, TValue> { ++ ++ /** ++ * Default separator written between nodes and their associated values ++ */ ++ public static final String DEFAULT_SEPARATOR = "\t"; ++ ++ private static final Logger log = LoggerFactory.getLogger(AbstractNodeWriter.class); ++ ++ protected AWriter writer; ++ private NodeFormatter formatter; ++ ++ /** ++ * Creates a new tuple writer using the default NTriples node formatter ++ * ++ * @param writer ++ * Writer ++ */ ++ public AbstractNodeWriter(Writer writer) { ++ this(writer, new NodeFormatterNT()); ++ } ++ ++ /** ++ * Creates a new tuple writer ++ * ++ * @param writer ++ * Writer ++ * @param formatter ++ * Node formatter ++ */ ++ public AbstractNodeWriter(Writer writer, NodeFormatter formatter) { ++ if (writer == null) ++ throw new NullPointerException("writer cannot be null"); ++ if (formatter == null) ++ throw new NullPointerException("formatter cannot be null"); ++ this.formatter = formatter; ++ this.writer = Writer2.wrap(writer); ++ } ++ ++ @Override ++ public final void write(NodeWritable key, TValue value) { ++ this.writeKey(key); ++ this.writer.write(this.getSeparator()); ++ this.writeValue(value); ++ this.writer.write('\n'); ++ } ++ ++ /** ++ * Writes the given key ++ * ++ * @param key ++ * Key ++ */ ++ protected void writeKey(NodeWritable key) { ++ writeNode(key.get()); ++ } ++ ++ /** ++ * Writes a Node ++ * ++ * @param n ++ * Node ++ */ ++ protected void writeNode(Node n) { ++ this.getNodeFormatter().format(this.writer, n); ++ } ++ ++ /** ++ * Writes a sequence of nodes ++ * ++ * @param ns ++ * Nodes ++ */ ++ protected void writeNodes(Node... ns) { ++ String sep = this.getSeparator(); ++ for (int i = 0; i < ns.length; i++) { ++ writeNode(ns[i]); ++ if (i < ns.length - 1) ++ this.writer.write(sep); ++ } ++ } ++ ++ /** ++ * Writes the given value ++ * <p> ++ * If the value is one of the RDF primitives - {@link NodeWritable}, ++ * {@link TripleWritable}, {@link QuadWritable} and ++ * {@link NodeTupleWritable} - then it is formatted as a series of nodes ++ * separated by the separator. Otherwise it is formatted by simply calling ++ * {@code toString()} on it. ++ * </p> ++ * ++ * @param value ++ * Values ++ */ ++ protected void writeValue(TValue value) { ++ // Handle null specially ++ if (value instanceof NullWritable || value == null) ++ return; ++ ++ // Handle RDF primitives specially and format them as proper nodes ++ if (value instanceof NodeWritable) { ++ this.writeKey((NodeWritable) value); ++ } else if (value instanceof TripleWritable) { ++ Triple t = ((TripleWritable) value).get(); ++ this.writeNodes(t.getSubject(), t.getPredicate(), t.getObject()); ++ } else if (value instanceof QuadWritable) { ++ Quad q = ((QuadWritable) value).get(); ++ this.writeNodes(q.getGraph(), q.getSubject(), q.getPredicate(), q.getObject()); ++ } else if (value instanceof NodeTupleWritable) { ++ Tuple<Node> tuple = ((NodeTupleWritable) value).get(); ++ Node[] n = new Node[tuple.len()] ; ++ tuple.copyInto(n); ++ this.writeNodes(n); ++ } else { ++ // For arbitrary values just toString() them ++ this.writer.write(value.toString()); ++ } ++ } ++ ++ @Override ++ public void close(TaskAttemptContext context) { ++ log.debug("close({})", context); ++ writer.close(); ++ } ++ ++ /** ++ * Gets the node formatter to use for formatting nodes ++ * ++ * @return Node formatter ++ */ ++ protected NodeFormatter getNodeFormatter() { ++ return this.formatter; ++ } ++ ++ /** ++ * Gets the separator that is written between nodes ++ * ++ * @return Separator ++ */ ++ protected String getSeparator() { ++ return DEFAULT_SEPARATOR; ++ } ++} http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileNodeTupleWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileNodeTupleWriter.java index 10ed68b,10ed68b..d5643b1 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileNodeTupleWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileNodeTupleWriter.java @@@ -1,21 -1,21 +1,21 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers; import java.io.IOException; @@@ -23,7 -23,7 +23,7 @@@ import java.io.Writer import org.apache.hadoop.mapreduce.RecordWriter; import org.apache.hadoop.mapreduce.TaskAttemptContext; --import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; ++import org.apache.jena.hadoop.rdf.types.AbstractNodeTupleWritable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileQuadWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileQuadWriter.java index 01ddb9d,01ddb9d..aa33b91 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileQuadWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileQuadWriter.java @@@ -1,32 -1,32 +1,32 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers; import java.io.Writer; -- --import org.apache.jena.hadoop.rdf.types.QuadWritable; ++ ++import org.apache.jena.hadoop.rdf.types.QuadWritable; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; import org.apache.jena.riot.RDFWriterRegistry; --import org.apache.jena.sparql.core.DatasetGraph ; --import org.apache.jena.sparql.core.DatasetGraphFactory ; --import org.apache.jena.sparql.core.Quad ; ++import org.apache.jena.sparql.core.DatasetGraph ; ++import org.apache.jena.sparql.core.DatasetGraphFactory ; ++import org.apache.jena.sparql.core.Quad ; /** * An abstract record writer for whole file triple formats http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileTripleWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileTripleWriter.java index 80ed370,80ed370..719ab95 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileTripleWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/AbstractWholeFileTripleWriter.java @@@ -1,31 -1,31 +1,31 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers; import java.io.Writer; -- --import org.apache.jena.graph.Graph ; --import org.apache.jena.graph.Triple ; --import org.apache.jena.hadoop.rdf.types.TripleWritable; ++ ++import org.apache.jena.graph.Graph ; ++import org.apache.jena.graph.Triple ; ++import org.apache.jena.hadoop.rdf.types.TripleWritable; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; --import org.apache.jena.sparql.graph.GraphFactory ; ++import org.apache.jena.sparql.graph.GraphFactory ; /** * An abstract record writer for whole file triple formats http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/nquads/NQuadsWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/nquads/NQuadsWriter.java index 0b7de7c,0b7de7c..8b0b9ef --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/nquads/NQuadsWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/nquads/NQuadsWriter.java @@@ -1,27 -1,27 +1,27 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers.nquads; --import java.io.Writer; -- --import org.apache.jena.atlas.lib.CharSpace ; --import org.apache.jena.hadoop.rdf.io.output.writers.AbstractLineBasedQuadWriter; ++import java.io.Writer; ++ ++import org.apache.jena.atlas.lib.CharSpace ; ++import org.apache.jena.hadoop.rdf.io.output.writers.AbstractLineBasedQuadWriter; import org.apache.jena.riot.out.NodeFormatterNT; /** http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesNodeWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesNodeWriter.java index ec6c312,ec6c312..3340802 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesNodeWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesNodeWriter.java @@@ -1,27 -1,27 +1,27 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers.ntriples; --import java.io.Writer; -- --import org.apache.jena.atlas.lib.CharSpace ; --import org.apache.jena.hadoop.rdf.io.output.writers.AbstractNodeWriter; ++import java.io.Writer; ++ ++import org.apache.jena.atlas.lib.CharSpace ; ++import org.apache.jena.hadoop.rdf.io.output.writers.AbstractNodeWriter; import org.apache.jena.riot.out.NodeFormatterNT; /** http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesWriter.java index 110f1d7,110f1d7..a01a351 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/ntriples/NTriplesWriter.java @@@ -1,27 -1,27 +1,27 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers.ntriples; --import java.io.Writer; -- --import org.apache.jena.atlas.lib.CharSpace ; --import org.apache.jena.hadoop.rdf.io.output.writers.AbstractLineBasedTripleWriter; ++import java.io.Writer; ++ ++import org.apache.jena.atlas.lib.CharSpace ; ++import org.apache.jena.hadoop.rdf.io.output.writers.AbstractLineBasedTripleWriter; import org.apache.jena.riot.out.NodeFormatterNT; /** http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfjson/RdfJsonWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfjson/RdfJsonWriter.java index 30bd4fa,30bd4fa..da7d1bd --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfjson/RdfJsonWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfjson/RdfJsonWriter.java @@@ -1,26 -1,26 +1,26 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers.rdfjson; import java.io.Writer; --import org.apache.jena.hadoop.rdf.io.output.writers.AbstractWholeFileTripleWriter; ++import org.apache.jena.hadoop.rdf.io.output.writers.AbstractWholeFileTripleWriter; import org.apache.jena.riot.Lang; /** http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfxml/RdfXmlWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfxml/RdfXmlWriter.java index f202914,f202914..8dbef01 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfxml/RdfXmlWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/rdfxml/RdfXmlWriter.java @@@ -1,26 -1,26 +1,26 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.output.writers.rdfxml; import java.io.Writer; --import org.apache.jena.hadoop.rdf.io.output.writers.AbstractWholeFileTripleWriter; ++import org.apache.jena.hadoop.rdf.io.output.writers.AbstractWholeFileTripleWriter; import org.apache.jena.riot.Lang; /** http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/trig/BatchedTriGWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/trig/BatchedTriGWriter.java index 4c0c75f,4c0c75f..e946c13 --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/trig/BatchedTriGWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/trig/BatchedTriGWriter.java @@@ -1,52 -1,52 +1,52 @@@ --/* -- * 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.output.writers.trig; -- --import java.io.Writer; -- --import org.apache.jena.hadoop.rdf.io.output.writers.AbstractBatchedQuadWriter; --import org.apache.jena.riot.Lang; -- --/** -- * A record writer for TriG that uses the batched approach, note that this -- * approach will produce invalid data when blank nodes span batches -- * -- * @param <TKey> -- * Key type -- */ --public class BatchedTriGWriter<TKey> extends AbstractBatchedQuadWriter<TKey> { -- -- /** -- * Creates a new record writer -- * -- * @param writer -- * Writer -- * @param batchSize -- * Batch size -- */ -- public BatchedTriGWriter(Writer writer, long batchSize) { -- super(writer, batchSize); -- } -- -- @Override -- protected Lang getRdfLanguage() { -- return Lang.TRIG; -- } -- --} ++/* ++ * 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.output.writers.trig; ++ ++import java.io.Writer; ++ ++import org.apache.jena.hadoop.rdf.io.output.writers.AbstractBatchedQuadWriter; ++import org.apache.jena.riot.Lang; ++ ++/** ++ * A record writer for TriG that uses the batched approach, note that this ++ * approach will produce invalid data when blank nodes span batches ++ * ++ * @param <TKey> ++ * Key type ++ */ ++public class BatchedTriGWriter<TKey> extends AbstractBatchedQuadWriter<TKey> { ++ ++ /** ++ * Creates a new record writer ++ * ++ * @param writer ++ * Writer ++ * @param batchSize ++ * Batch size ++ */ ++ public BatchedTriGWriter(Writer writer, long batchSize) { ++ super(writer, batchSize); ++ } ++ ++ @Override ++ protected Lang getRdfLanguage() { ++ return Lang.TRIG; ++ } ++ ++} http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/turtle/BatchedTurtleWriter.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/turtle/BatchedTurtleWriter.java index 86ab2f9,86ab2f9..3702c6e --- a/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/turtle/BatchedTurtleWriter.java +++ b/jena-elephas/jena-elephas-io/src/main/java/org/apache/jena/hadoop/rdf/io/output/writers/turtle/BatchedTurtleWriter.java @@@ -1,54 -1,54 +1,54 @@@ --/* -- * 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.output.writers.turtle; -- --import java.io.Writer; -- --import org.apache.jena.hadoop.rdf.io.output.writers.AbstractBatchedTripleWriter; --import org.apache.jena.riot.Lang; -- --/** -- * A record writer for Turtle that uses the batched approach, note that this -- * approach will produce invalid data when blank nodes span batches -- * -- * -- * -- * @param <TKey> -- */ --public class BatchedTurtleWriter<TKey> extends -- AbstractBatchedTripleWriter<TKey> { -- -- /** -- * Creates a new record writer -- * -- * @param writer -- * Writer -- * @param batchSize -- * Batch size -- */ -- public BatchedTurtleWriter(Writer writer, long batchSize) { -- super(writer, batchSize); -- } -- -- @Override -- protected Lang getRdfLanguage() { -- return Lang.TURTLE; -- } -- --} ++/* ++ * 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.output.writers.turtle; ++ ++import java.io.Writer; ++ ++import org.apache.jena.hadoop.rdf.io.output.writers.AbstractBatchedTripleWriter; ++import org.apache.jena.riot.Lang; ++ ++/** ++ * A record writer for Turtle that uses the batched approach, note that this ++ * approach will produce invalid data when blank nodes span batches ++ * ++ * ++ * ++ * @param <TKey> ++ */ ++public class BatchedTurtleWriter<TKey> extends ++ AbstractBatchedTripleWriter<TKey> { ++ ++ /** ++ * Creates a new record writer ++ * ++ * @param writer ++ * Writer ++ * @param batchSize ++ * Batch size ++ */ ++ public BatchedTurtleWriter(Writer writer, long batchSize) { ++ super(writer, batchSize); ++ } ++ ++ @Override ++ protected Lang getRdfLanguage() { ++ return Lang.TURTLE; ++ } ++ ++} http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java index 5762fb7,5762fb7..3707db3 --- a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java +++ b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/RdfTriplesInputTestMapper.java @@@ -1,21 -1,21 +1,21 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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; @@@ -23,7 -23,7 +23,7 @@@ 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.jena.hadoop.rdf.types.TripleWritable; import org.apache.log4j.Logger; http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedQuadInputFormatTests.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedQuadInputFormatTests.java index 1cda0bd,1cda0bd..0c59db8 --- a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedQuadInputFormatTests.java +++ b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedQuadInputFormatTests.java @@@ -1,21 -1,21 +1,21 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.input; /** http://git-wip-us.apache.org/repos/asf/jena/blob/4b5cd267/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedTripleInputFormatTests.java ---------------------------------------------------------------------- diff --cc jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedTripleInputFormatTests.java index 2e1e865,2e1e865..793f5a6 --- a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedTripleInputFormatTests.java +++ b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractBlockedTripleInputFormatTests.java @@@ -1,21 -1,21 +1,21 @@@ --/* -- * 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. -- */ -- ++/* ++ * 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.input; /**
