protected QueryIterator execute(BasicPattern pattern, ReorderTransformation reorder, StageGenerator execution,
QueryIterator input, ExecutionContext execCxt)
{
Explain.explain(pattern, execCxt.getContext()) ;
if ( ! input.hasNext() )
return input ;
if ( reorder != null && pattern.size() >= 2 ) {
BasicPattern bgp2 = pattern ;
if ( ! input.isJoinIdentity() ) {
QueryIterPeek peek = QueryIterPeek.create(input, execCxt) ;
input = peek ;
Binding b = peek.peek() ;
bgp2 = Substitute.substitute(pattern, b) ;
}
ReorderProc reorderProc = reorder.reorderIndexes(bgp2) ;
pattern = reorderProc.reorder(pattern) ;
}
Explain.explain("Reorder/generic", pattern, execCxt.getContext()) ;
return QueryIterBlockTriples.create(input, pattern, execCxt) ;
}
}