// Path: driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/executor/OGremlinResultSet.java
// public class OGremlinResultSet implements Iterable<OGremlinResult>, AutoCloseable {
// 
//   private OrientGraph graph;
//   private OResultSet inner;
// 
//   public OGremlinResultSet(OrientGraph graph, OResultSet inner) {
//     this.graph = graph;
//     this.inner = inner;
//   }
// 
//   @Override
//   public void close() {
//     inner.close();
//   }
// 
//   @Override
//   public Iterator<OGremlinResult> iterator() {
//     return new Iterator<OGremlinResult>() {
//       @Override
//       public boolean hasNext() {
//         return inner.hasNext();
//       }
// 
//       @Override
//       public OGremlinResult next() {
//         OResult next = inner.next();
//         return new OGremlinResult(graph, next);
//       }
//     };
//   }
// 
//   public Stream<OGremlinResult> stream() {
//     return inner.stream().map((result) -> new OGremlinResult(graph, result));
//   }
// 
//   public OResultSet getRawResultSet() {
//     return inner;
//   }
// }


import com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep;
import com.orientechnologies.orient.core.sql.executor.GlobalLetQueryStep;
import com.orientechnologies.orient.core.sql.executor.OExecutionPlan;
import java.util.Map;
import java.util.Optional;
import org.apache.tinkerpop.gremlin.orientdb.executor.OGremlinResultSet;
package org.apache.tinkerpop.gremlin.orientdb;


public class OrientGraphQuery implements OrientGraphBaseQuery {

  protected final Map<String, Object> params;
  protected final String query;
  private final Integer target;

  public OrientGraphQuery(String query, Map<String, Object> params, Integer target) {
    this.query = query;
    this.params = params;
    this.target = target;
  }

  public String getQuery() {
    return query;
  }

  public Map<String, Object> getParams() {
    return params;
  }

// Path: driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/executor/OGremlinResultSet.java
// public class OGremlinResultSet implements Iterable<OGremlinResult>, AutoCloseable {
// 
//   private OrientGraph graph;
//   private OResultSet inner;
// 
//   public OGremlinResultSet(OrientGraph graph, OResultSet inner) {
//     this.graph = graph;
//     this.inner = inner;
//   }
// 
//   @Override
//   public void close() {
//     inner.close();
//   }
// 
//   @Override
//   public Iterator<OGremlinResult> iterator() {
//     return new Iterator<OGremlinResult>() {
//       @Override
//       public boolean hasNext() {
//         return inner.hasNext();
//       }
// 
//       @Override
//       public OGremlinResult next() {
//         OResult next = inner.next();
//         return new OGremlinResult(graph, next);
//       }
//     };
//   }
// 
//   public Stream<OGremlinResult> stream() {
//     return inner.stream().map((result) -> new OGremlinResult(graph, result));
//   }
// 
//   public OResultSet getRawResultSet() {
//     return inner;
//   }
// }


// Path: driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/OrientGraphQuery.java
import com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep;
import com.orientechnologies.orient.core.sql.executor.GlobalLetQueryStep;
import com.orientechnologies.orient.core.sql.executor.OExecutionPlan;
import java.util.Map;
import java.util.Optional;
import org.apache.tinkerpop.gremlin.orientdb.executor.OGremlinResultSet;

package org.apache.tinkerpop.gremlin.orientdb;


public class OrientGraphQuery implements OrientGraphBaseQuery {

  protected final Map<String, Object> params;
  protected final String query;
  private final Integer target;

  public OrientGraphQuery(String query, Map<String, Object> params, Integer target) {
    this.query = query;
    this.params = params;
    this.target = target;
  }

  public String getQuery() {
    return query;
  }

  public Map<String, Object> getParams() {
    return params;
  }

  public OGremlinResultSet execute(OGraph graph) {