private static PipelineOp convertQueryBase(PipelineOp left,final QueryBase query,final Set<IVariable<?>> doneSet,final AST2BOpContext ctx){
  final ProjectionNode projection=query.getProjection();
  final IVariable<?>[] projectedVars=projection == null || projection.isEmpty() ? null : projection.getProjectionVars();
  final List<IVariable<?>> projectedVarList=projectedVars == null ? new LinkedList<IVariable<?>>() : Arrays.asList(projectedVars);
  final Set<IVariable<?>> tmp=new LinkedHashSet<IVariable<?>>();
  tmp.addAll(doneSet);
  tmp.retainAll(projectedVarList);
  left=convertQueryBaseWithScopedVars(left,query,tmp,false,ctx);
  tmp.retainAll(projectedVarList);
  doneSet.addAll(tmp);
  if (left != null) {
    left=(PipelineOp)left.setProperty(BOp.Annotations.NAMESPACE,ctx.getNamespace());
  }
  return left;
}

private static PipelineOp convertQueryBase ( PipelineOp left , final QueryBase query , final Set < IVariable < ? > > doneSet , final AST2BOpContext ctx ) { final ProjectionNode projection = query . getProjection ( ) ; final IVariable < ? > [ ] projectedVars = projection == null || projection . isEmpty ( ) ? null : projection . getProjectionVars ( ) ; final List < IVariable < ? > > projectedVarList = projectedVars == null ? new LinkedList < IVariable < ? > > ( ) : Arrays . asList ( projectedVars ) ; final Set < IVariable < ? > > tmp = new LinkedHashSet < IVariable < ? > > ( ) ; tmp . addAll ( doneSet ) ; tmp . retainAll ( projectedVarList ) ; left = convertQueryBaseWithScopedVars ( left , query , tmp , false , ctx ) ; tmp . retainAll ( projectedVarList ) ; doneSet . addAll ( tmp ) ; if ( left != null ) { left = ( PipelineOp ) left . setProperty ( BOp . Annotations . NAMESPACE , ctx . getNamespace ( ) ) ; } return left ; }
convert a query ( or subquery ) into a query plan ( pipeline ) . < p > note : only the variables in the parent which are projected by the subquery are visible within the named subquery . therefore , we have to create a temporary set of the known materialized variables , and remove anything which is not projected by the subquery on entry . on exit from the subquery , we need to add into the parents set of known materialized variables any variables which the subquery projects and which are known to have been materialized by the subquery .
