@@ -0,0 +1,2441 @@
+/**%0A *  Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *  you may not use this file except in compliance with the License.%0A *  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *  Unless required by applicable law or agreed to in writing, software%0A *  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *  See the License for the specific language governing permissions and%0A *  limitations under the License.%0A *%0A *  See the NOTICE file distributed with this work for additional%0A *  information regarding copyright ownership.%0A */%0A%0Apackage lz_dev;%0A%0Aimport java.util.ArrayList ;%0Aimport java.util.HashMap ;%0Aimport java.util.List ;%0Aimport java.util.Map ;%0A%0Aimport org.apache.jena.graph.Node ;%0Aimport org.apache.jena.graph.Triple ;%0Aimport org.apache.jena.riot.other.BatchedStreamRDF ;%0Aimport org.apache.jena.riot.system.StreamRDF ;%0Aimport org.apache.jena.sparql.core.Quad ;%0Aimport org.seaborne.tdb2.store.NodeId ;%0A%0A/**%0A * %0A * %0A * @see BatchedStreamRDF BatchedStreamRDF, which batches by subject%0A */%0Apublic class StreamRDFBatchSplit implements StreamRDF %7B%0A    private static NodeId placeholder = NodeId.NodeIdAny ;%0A    private final List%3CTriple%3E triples ;%0A    private final Map%3CNode, NodeId%3E mapping ;%0A    %0A    private final int batchSize ;%0A    %0A    StreamRDFBatchSplit(int batchSize) %7B%0A        this.batchSize = batchSize ;%0A        triples = new ArrayList%3C%3E(batchSize) ;%0A        mapping = new HashMap%3C%3E(2*batchSize) ;%0A    %7D%0A        %0A    @Override%0A    public void start() %7B%7D%0A%0A    @Override%0A    public void triple(Triple triple) %7B%0A        //Find nodes.%0A        processNode(triple.getSubject()) ;%0A        processNode(triple.getPredicate()) ;%0A        processNode(triple.getObject()) ;%0A        triples.add(triple) ;%0A        if ( triples.size() %3E= batchSize ) %7B%0A            processBatch() ;%0A            triples.clear();%0A            mapping.clear();%0A        %7D%0A    %7D%0A%0A    private void processBatch() %7B%0A        //getNodeIds() ;%0A        //translate triples ;%0A        //updates ;%0A    %7D%0A   %0A%0A    private void processNode(Node node) %7B%0A        mapping.put(node, placeholder) ;%0A    %7D%0A    %0A    @Override%0A    public void quad(Quad quad) %7B%7D%0A%0A    @Override%0A    public void base(String base) %7B%7D%0A%0A    @Override%0A    public void prefix(String prefix, String iri) %7B%7D%0A%0A    @Override%0A    public void finish() %7B%7D%0A%0A%7D%0A%0A

Split input triples into groups.