You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/04/23 21:56:48 UTC

[32/51] [partial] jena git commit: Rename com.hp.hpl.jena.* as org.apache.jena.*

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterFilterExpr.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterFilterExpr.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterFilterExpr.java
deleted file mode 100644
index c15dce7..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterFilterExpr.java
+++ /dev/null
@@ -1,73 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-import org.apache.jena.atlas.logging.Log ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.expr.Expr ;
-import com.hp.hpl.jena.sparql.expr.ExprException ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.ExprUtils ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/** 
- *  Filter a stream of bindings by a constraint. */
-
-public class QueryIterFilterExpr extends QueryIterProcessBinding
-{
-    private final Expr expr ;
-    
-    public QueryIterFilterExpr(QueryIterator input, Expr expr, ExecutionContext context)
-    {
-        super(input, context) ;
-        this.expr = expr ;
-    }
-    
-    @Override
-    public Binding accept(Binding binding)
-    {
-        try {
-            if ( expr.isSatisfied(binding, super.getExecContext()) )
-                return binding ;
-            return null ;
-        } catch (ExprException ex)
-        { // Some evaluation exception
-            Log.warn(this, "Expression Exception in "+expr, ex) ;
-            return null ;
-        }
-        catch (Exception ex)
-        {
-            Log.warn(this, "General exception in "+expr, ex) ;
-            return null ;
-        }
-    }
-
-    @Override
-    protected void details(IndentedWriter out, SerializationContext cxt)
-    { 
-        out.print(Utils.className(this)) ;
-        out.print(" ") ;
-        ExprUtils.fmtSPARQL(out, expr, cxt) ;
-    }
-       
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterGroup.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterGroup.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterGroup.java
deleted file mode 100644
index 6043b89..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterGroup.java
+++ /dev/null
@@ -1,204 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.ArrayList ;
-import java.util.Collection ;
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.IteratorDelayedInitialization ;
-import org.apache.jena.atlas.lib.MultiMap ;
-import org.apache.jena.atlas.lib.Pair ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.core.VarExprList ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingMap ;
-import com.hp.hpl.jena.sparql.expr.ExprAggregator ;
-import com.hp.hpl.jena.sparql.expr.NodeValue ;
-import com.hp.hpl.jena.sparql.expr.aggregate.Accumulator ;
-
-public class QueryIterGroup extends QueryIterPlainWrapper
-{
-	private final QueryIterator embeddedIterator;
-
-	public QueryIterGroup(QueryIterator qIter, 
-                          VarExprList groupVars,
-                          List<ExprAggregator> aggregators,
-                          ExecutionContext execCxt)
-    {
-        super(null, execCxt) ;
-        this.embeddedIterator = qIter;
-        Iterator<Binding> iter = calc(qIter, groupVars, aggregators, execCxt) ;
-        setIterator(iter) ;
-    }
-
-	@Override
-	public void requestCancel()
-	{
-	    this.embeddedIterator.cancel();
-	    super.requestCancel() ;
-	}
-	
-    // Phase 1 : Consume the input iterator, assigning groups (keys) 
-    //           and push rows through the aggregator function. 
-    
-    // Phase 2 : Go over the group bindings and assign the value of each aggregation.
-	
-	private static Pair<Var, Accumulator> placeholder = Pair.create((Var)null, (Accumulator)null) ; 
-	
-    
-    private static Iterator<Binding> calc(final QueryIterator iter, 
-                                          final VarExprList groupVarExpr, final List<ExprAggregator> aggregators,
-                                          final ExecutionContext execCxt)
-    {
-        return new IteratorDelayedInitialization<Binding>() {
-            @Override
-            protected Iterator<Binding> initializeIterator() {
-
-                boolean noAggregators =  ( aggregators == null || aggregators.size() == 0 ) ;
-                
-                // Phase 1 : assign bindings to buckets by key and pump through the aggregrators.
-                MultiMap<Binding, Pair<Var, Accumulator>> accumulators = MultiMap.createMapList() ;
-
-                for ( ; iter.hasNext() ; )
-                {
-                    Binding b = iter.nextBinding() ;
-                    Binding key = genKey(groupVarExpr, b, execCxt) ;
-
-                    if ( noAggregators )
-                    {
-                        // Put in a dummy to remember the input.
-                        accumulators.put(key, placeholder ) ;
-                        continue ;
-                    }
-
-                    Collection<Pair<Var, Accumulator>> accs = accumulators.get(key) ;
-                    // Create if does not exist.
-                    if ( accs == null )
-                    {
-                        for ( ExprAggregator agg : aggregators )
-                        {
-                            Accumulator x = agg.getAggregator().createAccumulator() ;
-                            Var v = agg.getVar() ;
-                            accumulators.put(key, Pair.create(v, x)) ;
-                        }
-                        accs = accumulators.get(key) ;
-                    }
-
-                    // Do the per-accumulator calculation.
-                    for ( Pair<Var, Accumulator> pair : accs )
-                        pair.getRight().accumulate(b, execCxt) ;
-                }
-
-                // Phase 2 : Empty input
-                // has as iter.hasNext false at start.
-
-                // If there are no binding from the input stage, two things can happen.
-                //   If there are no aggregators, there are no groups.
-                //   If there are aggregators, then they may have a default value. 
-
-                if ( accumulators.isEmpty() )
-                {
-                    if ( noAggregators )
-                    {
-                        // No rows to group, no aggregators.
-                        // ==> No result rows.
-                        return Iter.nullIterator() ;
-                    }
-                    
-                    BindingMap binding = BindingFactory.create() ;
-
-                    for ( ExprAggregator agg : aggregators )
-                    {
-                        Var v = agg.getVar();
-                        Node value = agg.getAggregator().getValueEmpty();
-                        if ( value != null )
-                        {
-                            binding.add( v, value );
-                        }
-                    }
-                        
-                    if ( binding == null )
-                        // This does not happen if there are any aggregators. 
-                        return Iter.nullIterator() ;
-                    // cast to get the static type inference to work.
-                    return Iter.singletonIter((Binding)binding) ;
-                }
-
-                // Phase 2 : There was input and so there are some groups.
-                // For each bucket, get binding, add aggregator values to the binding.
-                // We used AccNull so there are always accumulators. 
-                
-                if ( noAggregators )
-                    // We used placeholder so there are always the key. 
-                    return accumulators.keys().iterator() ;
-                
-                List<Binding> results = new ArrayList<>() ;
-
-                for ( Binding k : accumulators.keys() )
-                {
-                    Collection<Pair<Var, Accumulator>> accs = accumulators.get(k) ;
-                    BindingMap b = BindingFactory.create(k) ;
-                    
-                    for ( Pair<Var, Accumulator> pair : accs )
-                    {
-                        Var v = pair.getLeft() ;
-                        NodeValue value = pair.getRight().getValue() ;
-                        Node n = (value==null) ? null : value.asNode() ;
-                        if ( v == null || n == null )
-                        {} 
-                        else
-                            b.add(v, n) ;
-                    }
-                    results.add(b) ;
-                }
-                return results.iterator() ;
-            }
-        };
-    }
-    
-    static private Binding genKey(VarExprList vars, Binding binding, ExecutionContext execCxt) 
-    {
-        return copyProject(vars, binding, execCxt) ;
-    }
-    
-    static private Binding copyProject(VarExprList vars, Binding binding, ExecutionContext execCxt)
-    {
-        // No group vars (implicit or explicit) => working on whole result set. 
-        // Still need a BindingMap to assign to later.
-        BindingMap x = BindingFactory.create() ;
-        for ( Var var : vars.getVars() )
-        {
-            Node node = vars.get( var, binding, execCxt );
-            // Null returned for unbound and error.
-            if ( node != null )
-            {
-                x.add( var, node );
-            }
-        }
-        return x ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterMinus.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterMinus.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterMinus.java
deleted file mode 100644
index 4cd5aee..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterMinus.java
+++ /dev/null
@@ -1,89 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.Map;
-import java.util.Set ;
-
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.index.IndexFactory ;
-import com.hp.hpl.jena.sparql.engine.index.IndexTable ;
-
-/** Minus by materializing the RHS - this is not streamed on the right */
-public class QueryIterMinus extends QueryIter2
-{
-	private IndexTable tableRight;
-	private Map<Var, Integer> varColumns ;
-	private Set<Node[]> rightTable;
-    Binding slot = null ;
-
-	public QueryIterMinus(QueryIterator left, QueryIterator right, Set<Var> commonVars, ExecutionContext qCxt)
-    {
-        super(left, right, qCxt) ;
-        tableRight = IndexFactory.createIndex(commonVars, right) ;
-    }
-
-    protected Binding getNextSlot(Binding bindingLeft)
-    {
-        if ( tableRight.containsCompatibleWithSharedDomain(bindingLeft) )
-        	return null ;
-        
-        return bindingLeft;
-    }
-
-    @Override
-    protected final void closeSubIterator() { }
-    
-    @Override
-    protected void requestSubCancel() { }
-   
-    @Override
-    protected final boolean hasNextBinding()
-    {
-        if ( slot != null )
-            return true ;
-        
-        while ( getLeft().hasNext() )
-        {
-            Binding bindingLeft = getLeft().nextBinding() ;
-            slot = getNextSlot(bindingLeft) ;
-            if ( slot != null )
-            {
-                slot = bindingLeft ; 
-                return true ;
-            }
-        }
-        getLeft().close() ;
-        return false ;
-    }
-
-    @Override
-    protected final Binding moveToNextBinding()
-    {
-        if ( ! hasNextBinding() )
-            return null ;
-        Binding x = slot ;
-        slot = null ;
-        return x ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterNullIterator.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterNullIterator.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterNullIterator.java
deleted file mode 100644
index 5064886..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterNullIterator.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.NoSuchElementException ;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/** Closeable empty query iterator */
-
-public class QueryIterNullIterator extends QueryIter
-{
-    public static QueryIterator create(ExecutionContext qCxt) { return new QueryIterNullIterator(qCxt) ; }
-    
-    // Or QueryIterYieldN with N = 0 ;
-    // but sometimes it clearer just to w-r-i-t-e the code.
-    
-    public QueryIterNullIterator(ExecutionContext qCxt) { super(qCxt) ; }
-
-    @Override
-    protected boolean hasNextBinding()
-    { return false ; }
-
-    @Override
-    protected Binding moveToNextBinding()
-    { throw new NoSuchElementException(Utils.className(this)) ; }
-
-    @Override
-    protected void closeIterator() {}
-    
-    @Override
-    protected void requestCancel() { }
-
-    @Override
-    public void output(IndentedWriter out, SerializationContext sCxt)
-    { out.println(Utils.className(this)) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPath.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPath.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPath.java
deleted file mode 100644
index ec29060..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPath.java
+++ /dev/null
@@ -1,61 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.sparql.core.TriplePath ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.path.PathLib ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-public class QueryIterPath extends QueryIterRepeatApply
-{
-    private TriplePath triplePath ;
-    private Var varSubject = null ;
-    private Var varObject = null ;
-    
-
-    public QueryIterPath(TriplePath triplePath, QueryIterator input, ExecutionContext context)
-    {
-        super(input, context) ;
-        this.triplePath = triplePath ;
-    }
-
-    @Override
-    protected QueryIterator nextStage(Binding binding)
-    {
-        QueryIterator qIter = PathLib.execTriplePath(binding, triplePath, getExecContext()) ;
-        return qIter ; 
-    }
-    
-    @Override
-    protected void details(IndentedWriter out, SerializationContext sCxt)
-    {
-        out.print(Utils.className(this)) ;
-        out.println() ;
-        out.incIndent() ;
-        out.print(triplePath.toString()) ; 
-        out.decIndent() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPeek.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPeek.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPeek.java
deleted file mode 100644
index bce51b1..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPeek.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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import com.hp.hpl.jena.sparql.ARQInternalErrorException ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-
-public class QueryIterPeek extends QueryIter1
-{
-    private Binding binding = null ; 
-    private boolean closed = false ;
-    
-    public static QueryIterPeek create(QueryIterator iterator, ExecutionContext cxt)
-    {
-        if ( iterator instanceof QueryIterPeek)
-            return (QueryIterPeek)iterator ;
-        return new QueryIterPeek(iterator, cxt) ;
-    }
-    
-    private QueryIterPeek(QueryIterator iterator, ExecutionContext cxt)
-    {
-        super(iterator, cxt) ;
-    }
-
-    /** Returns the next binding without moving on.  Returns "null" for no such element. */
-    public Binding peek() 
-    {
-        if ( closed ) return null ;
-        if ( ! hasNextBinding() )
-            return null ;
-        return binding ;
-    }
-
-    @Override
-    protected boolean hasNextBinding()
-    {
-        if ( binding != null )
-            return true ;
-        if ( ! getInput().hasNext() )
-            return false ;
-        binding = getInput().nextBinding() ;
-        return true ;
-    }
-
-    @Override
-    protected Binding moveToNextBinding()
-    {
-        if ( ! hasNextBinding() )
-            throw new ARQInternalErrorException("No next binding") ;
-        Binding b = binding ;
-        binding = null ;
-        return b ;
-    }
-
-    @Override
-    protected void closeSubIterator()
-    { closed = true ; }
-    
-    @Override
-    protected void requestSubCancel()
-    { }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPlainWrapper.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPlainWrapper.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPlainWrapper.java
deleted file mode 100644
index b6ea77e..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterPlainWrapper.java
+++ /dev/null
@@ -1,78 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.Iterator ;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-import org.apache.jena.atlas.iterator.Iter ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-import com.hp.hpl.jena.util.iterator.NiceIterator ;
-
-/** Turn an normal java.util.Iterator (of Bindings) into a QueryIterator */
-
-public class QueryIterPlainWrapper extends QueryIter
-{
-    Iterator<Binding> iterator = null ;
-    
-    public QueryIterPlainWrapper(Iterator<Binding> iter)
-    { this(iter, null) ; }
-    
-    public QueryIterPlainWrapper(Iterator<Binding> iter, ExecutionContext context)
-    {
-        super(context) ;
-        iterator = iter ;
-    }
-
-    /** Preferrable to use a constructor - but sometimes that is inconvenient 
-     *  so pass null in the constructor and then call this before the iterator is
-     *  used.   
-     */
-    public void setIterator(Iterator<Binding> iterator) { this.iterator = iterator ; }
-    
-    @Override
-    protected boolean hasNextBinding() { return iterator.hasNext() ; } 
-    
-    @Override
-    protected Binding moveToNextBinding() { return iterator.next() ; }
-
-    @Override
-    protected void closeIterator()
-    {
-        if ( iterator != null )
-        {
-            NiceIterator.close(iterator) ;
-            // In case we wrapped, for example, another QueryIterator.
-            Iter.close(iterator) ;
-            iterator = null ;
-        }
-    }
-    
-    @Override
-    protected void requestCancel()
-    { }
-    
-    @Override
-    public void output(IndentedWriter out, SerializationContext sCxt)
-    { out.print(Utils.className(this)) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcedure.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcedure.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcedure.java
deleted file mode 100644
index 40e425c..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcedure.java
+++ /dev/null
@@ -1,91 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.procedure.Procedure ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/** QueryIterator for a procedure.  Delays first touch until first call because
- *  first touch may cause work to be done.
- *  
- *  Assumes .build already called. */
-
-public class QueryIterProcedure extends QueryIter1
-{
-    private Procedure proc ;
-    private boolean initialized = false ;
-    private QueryIterator procIter = null ;
-    
-    public QueryIterProcedure(QueryIterator input, Procedure proc, ExecutionContext execCxt)
-    {
-        super(input, execCxt) ;
-        this.proc = proc ;
-    }
-
-    private void init()
-    {
-        if ( ! initialized )
-        {
-            procIter = proc.proc(getInput(), getExecContext()) ;
-            initialized = true ;
-        }
-    }
-
-    @Override
-    protected void closeSubIterator()
-    { 
-        init() ;    // Ensure initialized even if immediately closed.
-        procIter.close(); 
-    }
-
-    @Override
-    protected void requestSubCancel()
-    { 
-       if (procIter != null) 
-    	   procIter.cancel(); 
-    }
-    
-    @Override
-    protected boolean hasNextBinding()
-    {
-        init() ;
-        return procIter.hasNext() ;
-    }
-
-    @Override
-    protected Binding moveToNextBinding()
-    {
-        init( ) ;
-        return procIter.nextBinding() ;
-    }
-    
-    @Override
-    protected void details(IndentedWriter out, SerializationContext sCxt)
-    {
-        out.print(Utils.className(this)) ;
-        out.print(" ") ;
-        proc.output(out, sCxt) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcessBinding.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcessBinding.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcessBinding.java
deleted file mode 100644
index 264c0be..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProcessBinding.java
+++ /dev/null
@@ -1,99 +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 com.hp.hpl.jena.sparql.engine.iterator ;
-
-import java.util.NoSuchElementException ;
-
-import com.hp.hpl.jena.sparql.ARQInternalErrorException ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/**
- * An iterator that applies a condition. The condition may return a different
- * binding.
- */
-
-public abstract class QueryIterProcessBinding extends QueryIter1 {
-    /** Process the binding - return null for "not accept".
-     * Subclasses may return a different Binding to the argument and
-     * the result is the returned Binding.  
-     */
-    abstract public Binding accept(Binding binding) ;
-
-    private Binding nextBinding ;
-
-    public QueryIterProcessBinding(QueryIterator qIter, ExecutionContext context) {
-        super(qIter, context) ;
-        nextBinding = null ;
-    }
-
-    /**
-     * Are there any more acceptable objects.
-     * 
-     * @return true if there is another acceptable object.
-     */
-    @Override
-    protected boolean hasNextBinding() {
-        // Needs to be idempotent.?
-        if ( isFinished() )
-            return false ;
-
-        if ( nextBinding != null )
-            return true ;
-
-        // Null iterator.
-        if ( getInput() == null )
-            throw new ARQInternalErrorException(Utils.className(this) + ": Null iterator") ;
-
-        while (getInput().hasNext()) {
-            // Skip forward until a binding to return is found.
-            Binding input = getInput().nextBinding() ;
-            Binding output = accept(input) ;
-            if ( output != null ) {
-                nextBinding = output ;
-                return true ;
-            }
-        }
-        nextBinding = null ;
-        return false ;
-    }
-
-    /**
-     * The next acceptable object in the iterator.
-     * 
-     * @return The next acceptable object.
-     */
-    @Override
-    public Binding moveToNextBinding() {
-        if ( hasNext() ) {
-            Binding r = nextBinding ;
-            nextBinding = null ;
-            return r ;
-        }
-        throw new NoSuchElementException() ;
-    }
-
-    @Override
-    protected void closeSubIterator() {}
-
-    @Override
-    protected void requestSubCancel() {}
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProject.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProject.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProject.java
deleted file mode 100644
index bddb7bf..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProject.java
+++ /dev/null
@@ -1,76 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.List ;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-import org.apache.jena.atlas.lib.ListUtils ;
-
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingProject ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-
-public class QueryIterProject extends QueryIterConvert
-{
-    List<Var> projectionVars ;
-
-    public QueryIterProject(QueryIterator input, List<Var> vars, ExecutionContext qCxt)
-    {
-        super(input, project(vars, qCxt), qCxt) ;
-        projectionVars = vars ;
-    }
-
-    static QueryIterConvert.Converter project(List<Var> vars, ExecutionContext qCxt)
-    {
-        return new Projection(vars, qCxt) ;
-    }
-    
-    public List<Var> getProjectionVars()   { return projectionVars ; }
-
-    @Override
-    protected void details(IndentedWriter out, SerializationContext sCxt)
-    {
-        out.print(Utils.className(this)) ;
-        out.print(" ") ;
-        ListUtils.print(out, projectionVars) ;
-    }
-    
-    static
-    class Projection implements QueryIterConvert.Converter
-    {
-        List<Var> projectionVars ;
-
-        Projection(List<Var> vars, ExecutionContext qCxt)
-        { 
-            this.projectionVars = vars ;
-        }
-
-        @Override
-        public Binding convert(Binding bind)
-        {
-            return new BindingProject(projectionVars, bind) ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProjectMerge.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProjectMerge.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProjectMerge.java
deleted file mode 100644
index 4465081..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterProjectMerge.java
+++ /dev/null
@@ -1,105 +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 com.hp.hpl.jena.sparql.engine.iterator ;
-
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.atlas.logging.Log ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.algebra.op.OpProject ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.* ;
-import com.hp.hpl.jena.sparql.engine.main.OpExecutor ;
-
-/**
- * Execute a projection in the middle of an execution. This requires the outcome
- * of each stage of execution (substitution evaluation assumed) to be merged with
- * the input binding. Bindings should already be compatible, otherwise this code
- * should not be used.
- */
-public class QueryIterProjectMerge extends QueryIterRepeatApply {
-    private final OpProject  opProject ;
-    private final OpExecutor engine ;
-
-    public QueryIterProjectMerge(OpProject opProject, QueryIterator input, OpExecutor engine, ExecutionContext execCxt) {
-        super(input, execCxt) ;
-        this.opProject = opProject ;
-        this.engine = engine ;
-    }
-
-    @Override
-    protected QueryIterator nextStage(Binding binding) {
-        QueryIterator qIter = engine.executeOp(opProject.getSubOp(),
-                                               QueryIterSingleton.create(binding, getExecContext())) ;
-        qIter = new QueryIterConvert(qIter,
-                                     new ProjectEnsureBindingConverter(binding, opProject.getVars()),
-                                     getExecContext()) ;
-        return qIter ;
-    }
-
-    /** Ensure binding from outer binding are present when projecting */  
-    static class ProjectEnsureBindingConverter implements QueryIterConvert.Converter {
-
-        private final Binding   outerBinding ;
-        private final List<Var> projectionVars ;
-
-        public ProjectEnsureBindingConverter(Binding outerBinding, List<Var> vars) {
-            this.outerBinding = outerBinding ;
-            this.projectionVars = vars ;
-        }
-
-        @Override
-        public Binding convert(Binding bind) {
-            return ensure(projectionVars, outerBinding, bind) ;
-            // Effectively, this is:
-            //bind = new BindingProject(projectionVars, bind) ;
-            // return BindingUtils.merge(outerBinding, bind) ;
-        }
-        
-        /** Merge two bindings, the outer and inner, projecting the inner with the give variables.
-         *  This is what happens in substitutIon execution, with a inner select-project.  
-         */
-        private static Binding ensure(List<Var> vars, Binding outer, Binding inner) {
-            // A specialised BindingUtils.merge that does project as well.
-            // Reduce small object churn.
-            BindingMap b2 = BindingFactory.create(outer) ;
-            Iterator<Var> vIter = (vars != null) ? vars.iterator() : inner.vars() ;
-            // Add any variables from the RHS
-            for ( ; vIter.hasNext() ; ) {
-                Var v = vIter.next() ;
-                Node n2 = inner.get(v) ;
-                if ( n2 == null )
-                    continue ;
-                if ( ! b2.contains(v) )
-                    b2.add(v, inner.get(v)) ;
-                else {
-                    // Checking!
-                    Node n1 = outer.get(v) ;
-                    if ( ! n1.equals(n2) )
-                        Log.warn(BindingUtils.class,  "merge: Mismatch : "+n1+" != "+n2);
-                }
-            }
-            return b2 ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterReduced.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterReduced.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterReduced.java
deleted file mode 100644
index 3104cc4..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterReduced.java
+++ /dev/null
@@ -1,53 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.ArrayList ;
-import java.util.List ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-
-public class QueryIterReduced extends QueryIterDistinctReduced
-{
-    List<Binding> window = new ArrayList<>() ;
-    int N = 1 ;
-    
-    public QueryIterReduced(QueryIterator iter, ExecutionContext context)
-    { super(iter, context)  ; }
-
-    @Override
-    protected void closeSubIterator()
-    {
-        window = null ;
-        super.closeSubIterator() ;
-    }
-
-    @Override
-    protected boolean isFreshSighting(Binding b)
-    {
-        if ( window.contains(b) )
-            return false ;
-        if ( window.size() >= N )
-            window.remove(window.size()-1) ;
-        window.add(0, b) ;
-        return true ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRepeatApply.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRepeatApply.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRepeatApply.java
deleted file mode 100644
index d8a893d..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRepeatApply.java
+++ /dev/null
@@ -1,128 +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 com.hp.hpl.jena.sparql.engine.iterator;
-import java.util.NoSuchElementException ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-
-import org.apache.jena.atlas.logging.Log ;
-
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/** Repeatedly execute the subclass operation for each Binding in the input iterator. */
- 
-public abstract class QueryIterRepeatApply extends QueryIter1
-{
-    int count = 0 ; 
-    private QueryIterator currentStage ; 
-    private volatile boolean cancelRequested = false;   // [CANCEL] needed? super.cancelRequest?
-    
-    public QueryIterRepeatApply( QueryIterator input ,
-                                 ExecutionContext context)
-    {
-        super(input, context) ;
-        this.currentStage = null ;
-        
-        if ( input == null )
-        {
-            Log.fatal(this, "[QueryIterRepeatApply] Repeated application to null input iterator") ;
-            return ;
-        }
-    }
-       
-    protected QueryIterator getCurrentStage()
-    {
-        return currentStage ;
-    }
-    
-    protected abstract QueryIterator nextStage(Binding binding) ;
-
-    @Override
-    protected boolean hasNextBinding()
-    {
-        if ( isFinished() )
-            return false ;
-        
-        for ( ;; )
-        {
-            if ( currentStage == null  )
-                currentStage = makeNextStage() ;
-            
-            if ( currentStage == null  )
-                return false ;
-            
-            if ( cancelRequested )
-                // Pass on the cancelRequest to the active stage.
-                performRequestCancel(currentStage);
-            
-            if ( currentStage.hasNext() )
-                return true ;
-            
-            // finish this step
-            currentStage.close() ;
-            currentStage = null ;
-            // loop
-        }
-        // Unreachable
-    }
-
-    @Override
-    protected Binding moveToNextBinding()
-    {
-        if ( ! hasNextBinding() )
-            throw new NoSuchElementException(Utils.className(this)+".next()/finished") ;
-        return currentStage.nextBinding() ;
-        
-    }
-    
-    private QueryIterator makeNextStage()
-    {
-        count++ ;
-
-        if ( getInput() == null )
-            return null ;
-
-        if ( !getInput().hasNext() )
-        {
-            getInput().close() ;
-            return null ; 
-        }
-        
-        Binding binding = getInput().next() ;
-        QueryIterator iter = nextStage(binding) ;
-        return iter ;
-    }
-   
-    @Override
-    protected void closeSubIterator()
-    {
-        if ( currentStage != null )
-            currentStage.close() ;
-    }
-    
-    @Override
-    protected void requestSubCancel()
-    {
-        if ( currentStage != null )
-            currentStage.cancel() ; // [CANCEL]
-        cancelRequested = true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRoot.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRoot.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRoot.java
deleted file mode 100644
index 119cc4e..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterRoot.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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingRoot ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-
-public class QueryIterRoot extends QueryIterSingleton
-{
-    public static QueryIterRoot create(ExecutionContext execCxt)
-    { return new QueryIterRoot(BindingRoot.create(), execCxt) ; }
-    
-    public static QueryIterRoot create(Binding binding, ExecutionContext execCxt)
-    { return new QueryIterRoot(binding, execCxt) ; }
-
-    private QueryIterRoot(Binding binding, ExecutionContext execCxt)
-    {
-        super(binding, execCxt) ;
-    }
-
-    @Override
-    public void output(IndentedWriter out, SerializationContext sCxt)
-    {
-        if ( binding instanceof BindingRoot )
-            out.print("QueryIterRoot");
-        else
-            out.print("QueryIterRoot: "+binding);
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSingleton.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSingleton.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSingleton.java
deleted file mode 100644
index 91b2d2f..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSingleton.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.hp.hpl.jena.sparql.engine.iterator;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-
-/** A singleton iterator */
-
-public class QueryIterSingleton extends QueryIterYieldN
-{
-    // A common usage?
-    public static QueryIterSingleton create(Binding parent, Var var, Node value, ExecutionContext execCxt)
-    {
-        Binding b = BindingFactory.binding(parent, var, value) ;
-        return QueryIterSingleton.create(b, execCxt) ;
-    }
-    
-    public static QueryIterSingleton create(Binding binding, ExecutionContext execCxt)
-    {
-        return new QueryIterSingleton(binding, execCxt) ;
-    }
-
-    private QueryIterSingleton(Binding binding) // Not needed
-    {
-        this(binding, null) ;
-    }
-    
-    protected QueryIterSingleton(Binding binding, ExecutionContext context)
-    {
-        super(1, binding, context) ;
-    }
-    
-    @Override
-    public void output(IndentedWriter out, SerializationContext sCxt)
-    {
-        out.print("QueryIterSingleton "+binding);
-    }
-    
-//    @Override
-//    public void closeIterator() { super.closeIterator() ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSlice.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSlice.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSlice.java
deleted file mode 100644
index 0681a8e..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSlice.java
+++ /dev/null
@@ -1,97 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryExecException ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-
-/** Iterator until a limit is reached. */
-
-public class QueryIterSlice extends QueryIter1
-{
-    long count = 0 ;
-    long limit ;
-    long offset ;
-    
-    /** Create an iterator that limits the number of returns of
-     * another CloseableIterator.
-     * 
-     * @param cIter            The closable iterator to throttle 
-     * @param startPosition    Offset of start after - 0 is the no-op.
-     * @param numItems         Maximium number of items to yield.  
-     */
-    
-    public QueryIterSlice(QueryIterator cIter, long startPosition, long numItems, ExecutionContext context)
-    {
-        super(cIter, context) ;
-        
-        offset = startPosition ;
-        if ( offset == Query.NOLIMIT )
-            offset = 0 ;
-        
-        limit = numItems ;
-        if ( limit == Query.NOLIMIT )
-            limit = Long.MAX_VALUE ;
-
-        if ( limit < 0 )
-            throw new QueryExecException("Negative LIMIT: "+limit) ;
-        if ( offset < 0 )
-            throw new QueryExecException("Negative OFFSET: "+offset) ;
-        
-        count = 0 ;
-        // Offset counts from 0 (the no op).
-        for ( int i = 0 ; i < offset ; i++ )
-        {
-            // Not subtle
-            if ( !cIter.hasNext() ) { close() ; break ; }
-            cIter.next() ;
-        }
-    }
-    
-    @Override
-    protected boolean hasNextBinding()
-    {
-        if ( isFinished() )
-            return false;
-        
-        if ( ! getInput().hasNext() )
-            return false ;
-        
-        if ( count >= limit )
-            return false ;
-
-        return true ;
-    }
-
-    @Override
-    protected Binding moveToNextBinding()
-    {
-        count ++ ;
-        return getInput().nextBinding() ;
-    }
-
-    @Override
-    protected void closeSubIterator() {}
-    
-    @Override
-    protected void requestSubCancel() {}
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java
deleted file mode 100644
index 9a79b0a..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java
+++ /dev/null
@@ -1,109 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.Comparator ;
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.atlas.data.BagFactory ;
-import org.apache.jena.atlas.data.SortedDataBag ;
-import org.apache.jena.atlas.data.ThresholdPolicy ;
-import org.apache.jena.atlas.data.ThresholdPolicyFactory ;
-import org.apache.jena.atlas.iterator.IteratorDelayedInitialization ;
-import org.apache.jena.atlas.lib.Closeable ;
-import org.apache.jena.riot.system.SerializationFactoryFinder ;
-
-import com.hp.hpl.jena.query.QueryCancelledException ;
-import com.hp.hpl.jena.query.SortCondition ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingComparator ;
-
-/** 
- * Sort a query iterator.  The sort will happen in-memory unless the size of the
- * iterator exceeds a configurable threshold. In that case, a disk sort is used.
- * 
- * @see SortedDataBag
- */
-
-public class QueryIterSort extends QueryIterPlainWrapper
-{
-	private final QueryIterator embeddedIterator;      // Keep a record of the underlying source for .cancel.
-	final SortedDataBag<Binding> db;
-	
-    public QueryIterSort(QueryIterator qIter, List<SortCondition> conditions, ExecutionContext context)
-    {
-        this(qIter, new BindingComparator(conditions, context), context) ;
-    }
-
-    public QueryIterSort(final QueryIterator qIter, final Comparator<Binding> comparator, final ExecutionContext context)
-    {
-        super(null, context) ;
-        this.embeddedIterator = qIter ;
-        
-        ThresholdPolicy<Binding> policy = ThresholdPolicyFactory.policyFromContext(context.getContext());
-        this.db = BagFactory.newSortedBag(policy, SerializationFactoryFinder.bindingSerializationFactory(), comparator);
-        
-        this.setIterator(new SortedBindingIterator(qIter));
-    }
-
-    @Override
-    public void requestCancel()
-    {
-        this.embeddedIterator.cancel() ;
-        super.requestCancel() ;
-    }
-
-    private class SortedBindingIterator extends IteratorDelayedInitialization<Binding> implements Closeable
-    {
-        private final QueryIterator qIter;
-        
-        public SortedBindingIterator(final QueryIterator qIter)
-        {
-            this.qIter = qIter;
-        }
-        
-        @Override
-        protected Iterator<Binding> initializeIterator()
-        {
-            try
-            {
-                db.addAll(qIter);
-            }
-            // Should we catch other exceptions too?  Theoretically the user should be using this
-            // iterator in a try/finally block, and thus will call close() themselves. 
-            catch (QueryCancelledException e)
-            {
-                close();
-                throw e;
-            }
-            
-            return db.iterator();
-        }
-
-        @Override
-        public void close()
-        {
-            db.close();
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSub.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSub.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSub.java
deleted file mode 100644
index 69af0f2..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSub.java
+++ /dev/null
@@ -1,60 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-
-/**
- * This class supports a QueryIter that uses a single sub iterator.
- * Unlike QueryIter1, it's assumes the subiterator will be reset and manipulated.
- */
-public abstract class QueryIterSub extends QueryIter
-{
-    protected QueryIterator iter ; 
-    
-    public QueryIterSub(QueryIterator input, ExecutionContext execCxt)
-    { 
-        super(execCxt) ;
-        this.iter = input ;
-    }
-    
-    @Override
-    protected final
-    void closeIterator()
-    {
-        closeSubIterator() ;
-        performClose(iter) ;
-        iter = null ;
-    }
-    
-    @Override
-    protected final
-    void requestCancel()
-    {
-        requestSubCancel() ;
-        performRequestCancel(iter) ;
-    }
-    
-    /** Cancellation of the query execution is happening */
-    protected abstract void requestSubCancel() ;
-    
-    /** Pass on the close method - no need to close the QueryIterator passed to the QueryIter1 constructor */
-    protected abstract void closeSubIterator() ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTopN.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTopN.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTopN.java
deleted file mode 100644
index bc0ec8b..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTopN.java
+++ /dev/null
@@ -1,119 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.Arrays ;
-import java.util.Comparator ;
-import java.util.Iterator ;
-import java.util.List ;
-import java.util.PriorityQueue ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.IteratorArray ;
-import org.apache.jena.atlas.iterator.IteratorDelayedInitialization ;
-import org.apache.jena.atlas.lib.ReverseComparator ;
-
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryExecException ;
-import com.hp.hpl.jena.query.SortCondition ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingComparator ;
-
-public class QueryIterTopN extends QueryIterPlainWrapper
-{
-    /* We want to keep the N least elements (overall return is an ascending sequence so limit+ascending = least).   
-     * To do that we keep a priority heap of upto N eleemnts, ordered descending.
-     * To keep another element, it must be less than the max so far.
-     * This leaves the least N in the heap.    
-     */
-	private final QueryIterator embeddedIterator;      // Keep a record of the underlying source for .cancel.
-    private PriorityQueue<Binding> heap ;
-    private long limit ;
-    private final boolean distinct ;
-	
-    public QueryIterTopN(QueryIterator qIter, List<SortCondition> conditions, long numItems, boolean distinct, ExecutionContext context) {
-        this(qIter, new BindingComparator(conditions, context), numItems, distinct, context) ;
-    }
-
-    public QueryIterTopN(QueryIterator qIter, Comparator<Binding> comparator, long numItems, boolean distinct, ExecutionContext context) {
-        super(null, context) ;
-        this.embeddedIterator = qIter ;
-        this.distinct = distinct ;
-
-        limit = numItems ;
-        if ( limit == Query.NOLIMIT )
-            limit = Long.MAX_VALUE ;
-
-        if ( limit < 0 )
-            throw new QueryExecException("Negative LIMIT: " + limit) ;
-
-        if ( limit == 0 ) {
-            // Keep Java happy.
-            Iterator<Binding> iter0 = Iter.nullIterator() ;
-            setIterator(iter0) ;
-            qIter.close() ;
-            return ;
-        }
-
-        // Keep heap with maximum accessible.
-        this.heap = new PriorityQueue<Binding>((int)numItems, new ReverseComparator<Binding>(comparator)) ;
-        this.setIterator(sortTopN(qIter, comparator)) ;
-    }
-
-    @Override
-    public void requestCancel() {
-        this.embeddedIterator.cancel() ;
-        super.requestCancel() ;
-    }
-
-    private Iterator<Binding> sortTopN(final QueryIterator qIter, final Comparator<Binding> comparator) {
-        return new IteratorDelayedInitialization<Binding>() {
-            @Override
-            protected Iterator<Binding> initializeIterator() {
-                for (; qIter.hasNext();) {
-                    Binding binding = qIter.next() ;
-                    if ( heap.size() < limit )
-                        add(binding) ;
-                    else {
-                        Binding currentMaxLeastN = heap.peek() ;
-                        if ( comparator.compare(binding, currentMaxLeastN) < 0 )
-                            add(binding) ;
-                    }
-                }
-                qIter.close() ;
-                Binding[] y = heap.toArray(new Binding[]{}) ;
-                heap = null ;
-                Arrays.sort(y, comparator) ;
-                IteratorArray<Binding> iter = IteratorArray.create(y) ;
-                return iter ;
-            }
-        } ;
-    }
-
-    private void add(Binding binding) {
-        if ( distinct && heap.contains(binding) )
-            return ;
-        if ( heap.size() >= limit )
-            heap.poll() ;  // Remove front element.
-        heap.add(binding) ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTracked.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTracked.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTracked.java
deleted file mode 100644
index ae06d0b..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTracked.java
+++ /dev/null
@@ -1,63 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.util.iterator.NiceIterator ;
-
-/** Track a QueryIterator */
-
-public class QueryIterTracked extends QueryIter
-{
-    QueryIterator iterator = null ;
-    
-    /** Use QueryIter.makeTracked */
-    QueryIterTracked(QueryIterator iter, ExecutionContext execCxt)
-    {
-        super(execCxt) ;
-        iterator = iter ;
-    }
-
-    @Override
-    protected boolean hasNextBinding() { return iterator.hasNext() ; } 
-    
-    @Override
-    protected Binding moveToNextBinding() { return iterator.next() ; }
-
-    @Override
-    protected void closeIterator()
-    {
-        if ( iterator != null )
-        {
-            NiceIterator.close(iterator) ;
-            iterator = null ;
-        }
-    }
-    
-    @Override
-    protected void requestCancel()
-    {
-        if ( iterator != null )
-        {
-        	iterator.cancel();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTriplePattern.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTriplePattern.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTriplePattern.java
deleted file mode 100644
index 6087d2c..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterTriplePattern.java
+++ /dev/null
@@ -1,186 +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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.List ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.ARQInternalErrorException ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
-import com.hp.hpl.jena.sparql.engine.binding.BindingMap ;
-import com.hp.hpl.jena.util.iterator.ClosableIterator ;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
-import com.hp.hpl.jena.util.iterator.NiceIterator ;
-import com.hp.hpl.jena.util.iterator.WrappedIterator ;
-
-public class QueryIterTriplePattern extends QueryIterRepeatApply
-{
-    private final Triple pattern ;
-    
-    public QueryIterTriplePattern( QueryIterator input,
-                                   Triple pattern , 
-                                   ExecutionContext cxt)
-    {
-        super(input, cxt) ;
-        this.pattern = pattern ;
-    }
-
-    @Override
-    protected QueryIterator nextStage(Binding binding)
-    {
-        return new TripleMapper(binding, pattern, getExecContext()) ;
-    }
-    
-    static int countMapper = 0 ; 
-    static class TripleMapper extends QueryIter
-    {
-        private Node s ;
-        private Node p ;
-        private Node o ;
-        private Binding binding ;
-        private ClosableIterator<Triple> graphIter ;
-        private Binding slot = null ;
-        private boolean finished = false ;
-        private volatile boolean cancelled = false ;
-
-        TripleMapper(Binding binding, Triple pattern, ExecutionContext cxt)
-        {
-            super(cxt) ;
-            this.s = substitute(pattern.getSubject(), binding) ;
-            this.p = substitute(pattern.getPredicate(), binding) ;
-            this.o = substitute(pattern.getObject(), binding) ;
-            this.binding = binding ;
-            Node s2 = tripleNode(s) ;
-            Node p2 = tripleNode(p) ;
-            Node o2 = tripleNode(o) ;
-            Graph graph = cxt.getActiveGraph() ;
-            
-            ExtendedIterator<Triple> iter = graph.find(s2, p2, o2) ;
-            
-            if ( false )
-            {
-                // Materialize the results now. Debugging only.
-                List<Triple> x = iter.toList() ;
-                this.graphIter = WrappedIterator.create(x.iterator()) ;
-                iter.close();
-            }
-            else
-                // Stream.
-                this.graphIter = iter ;
-        }
-
-        private static Node tripleNode(Node node)
-        {
-            if ( node.isVariable() )
-                return Node.ANY ;
-            return node ;
-        }
-
-        private static Node substitute(Node node, Binding binding)
-        {
-            if ( Var.isVar(node) )
-            {
-                Node x = binding.get(Var.alloc(node)) ;
-                if ( x != null )
-                    return x ;
-            }
-            return node ;
-        }
-
-        private Binding mapper(Triple r)
-        {
-            BindingMap results = BindingFactory.create(binding) ;
-
-            if ( ! insert(s, r.getSubject(), results) )
-                return null ; 
-            if ( ! insert(p, r.getPredicate(), results) )
-                return null ;
-            if ( ! insert(o, r.getObject(), results) )
-                return null ;
-            return results ;
-        }
-
-        private static boolean insert(Node inputNode, Node outputNode, BindingMap results)
-        {
-            if ( ! Var.isVar(inputNode) )
-                return true ;
-            
-            Var v = Var.alloc(inputNode) ;
-            Node x = results.get(v) ;
-            if ( x != null )
-                return outputNode.equals(x) ;
-            
-            results.add(v, outputNode) ;
-            return true ;
-        }
-        
-        @Override
-        protected boolean hasNextBinding()
-        {
-            if ( finished ) return false ;
-            if ( slot != null ) return true ;
-            if ( cancelled )
-            {
-                graphIter.close() ;
-                finished = true ;
-                return false ;
-            }
-
-            while(graphIter.hasNext() && slot == null )
-            {
-                Triple t = graphIter.next() ;
-                slot = mapper(t) ;
-            }
-            if ( slot == null )
-                finished = true ;
-            return slot != null ;
-        }
-
-        @Override
-        protected Binding moveToNextBinding()
-        {
-            if ( ! hasNextBinding() ) 
-                throw new ARQInternalErrorException() ;
-            Binding r = slot ;
-            slot = null ;
-            return r ;
-        }
-
-        @Override
-        protected void closeIterator()
-        {
-            if ( graphIter != null )
-                NiceIterator.close(graphIter) ;
-            graphIter = null ;
-        }
-        
-        @Override
-        protected void requestCancel()
-        {
-            // The QueryIteratorBase machinary will do the real work.
-            cancelled = true ;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterYieldN.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterYieldN.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterYieldN.java
deleted file mode 100644
index 7faf481..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/iterator/QueryIterYieldN.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 com.hp.hpl.jena.sparql.engine.iterator;
-
-import java.util.NoSuchElementException ;
-
-import org.apache.jena.atlas.io.IndentedWriter ;
-
-import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.sparql.serializer.SerializationContext ;
-import com.hp.hpl.jena.sparql.util.Utils ;
-
-/** A query iterator that yields the same thing N times. */
-
-public class QueryIterYieldN extends QueryIter
-{
-    protected int limitYielded ;
-    protected int countYielded = 0 ;
-    protected Binding binding ;
-    
-    public QueryIterYieldN(int num, Binding b)
-    {
-        this(num, b, null) ;
-    }
-    
-    public QueryIterYieldN(int num, Binding b, ExecutionContext context)
-    {
-        super(context) ;
-        binding = b ;
-        limitYielded = num ;
-    }
-    
-    public Binding getBinding() { return binding ; }
-    
-    @Override
-    protected boolean hasNextBinding()
-    {
-        return countYielded < limitYielded ;
-    }
-    
-    @Override
-    protected Binding moveToNextBinding()
-    {
-        if ( ! hasNextBinding() )
-            // Try to get the class name as specific as possible for subclasses
-            throw new NoSuchElementException(Utils.className(this)) ;
-        countYielded++ ;
-        return binding ;
-    }
-
-    @Override
-    protected void closeIterator()
-    {
-        //binding = null ;
-    }
-    
-    @Override
-    protected void requestCancel()
-    {
-    }
-    
-    @Override
-    public void output(IndentedWriter out, SerializationContext sCxt)
-    {
-        out.print("QueryIterYieldN: "+limitYielded+" of "+binding);
-    }
-
-}