code: protected IntermediateQueryBuilder convertToBuilderAndTransform(IntermediateQuery originalQuery,
                                                                    HomogeneousQueryNodeTransformer nodeTransformer,
                                                                    DistinctVariableOnlyDataAtom transformedProjectionAtom) {
          IntermediateQueryBuilder queryBuilder = originalQuery.newBuilder();
  
          // Clone the original root node and apply the transformer if available.
          QueryNode originalRootNode = originalQuery.getRootNode();
          QueryNode newRootNode;
          newRootNode = originalRootNode.acceptNodeTransformer(nodeTransformer);
          queryBuilder.init(transformedProjectionAtom, newRootNode);
          return copyChildrenNodesToBuilder(originalQuery, queryBuilder, originalRootNode, newRootNode, nodeTransformer);
      }
docs: TODO: explain
  <p>
  TODO: avoid the use of a recursive method. Use a stack instead.