code: public static <QL> GremlinExpression getGremlinExpression(QL expression,
  	    Map<String, Object> parameters) {
  	GremlinExpression gremlinExpression = null;
  	if (expression instanceof String) {
  	    gremlinExpression = new GremlinExpression("", (String) expression);
  	} else if (expression instanceof Gremlin) {
  	    Gremlin gremlin = (Gremlin) expression;
  	    gremlinExpression = new GremlinExpression(gremlin.name(),
  		    gremlin.value());
  	} else if (AnnotatedElement.class.isAssignableFrom(expression
  		.getClass())) {
  	    AnnotatedElement<?> typeExpression = (AnnotatedElement<?>) expression;
  	    gremlinExpression = extractExpression(typeExpression);
  	} else if (Class.class.isAssignableFrom(expression.getClass())) {
  	    Class<?> clazz = (Class<?>) expression;
  	    gremlinExpression = extractExpression(clazz);
  	} else if (Method.class.isAssignableFrom(expression.getClass())) {
  	    Method method = (Method) expression;
  	    gremlinExpression = extractExpression(method);
  	} else {
  	    throw new XOException("Unsupported query expression "
  		    + expression.toString() + "(class=" + expression.getClass()
  		    + ")");
  	}
  	return applyParameters(parameters, gremlinExpression);
      }
docs: This is a helper method to extract the Gremlin expression.
  
  @param expression
  is the object which comes in from
  DatastoreSession#executeQuery(Object, java.util.Map).
  @param parameters
  is a Map of parameters.
  @return A {@link String} containing a Gremlin expression is returned.
  @param <QL>
  is the query language.