code: public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, String statement,
        String language) throws InvalidQueryException, RepositoryException
     {
        AbstractQueryImpl query = createQueryInstance();
        query.init(session, sessionDataManager, handler, statement, language);
        return query;
     }
docs: Creates a query object that can be executed on the workspace.
  
  @param session
  the session of the user executing the query.
  @param sessionDataManager
  the item manager of the user executing the query. Needed to
  return <code>Node</code> instances in the result set.
  @param statement
  the actual query statement.
  @param language
  the syntax of the query statement.
  @return a <code>Query</code> instance to execute.
  @throws InvalidQueryException
  if the query is malformed or the <code>language</code> is
  unknown.
  @throws RepositoryException
  if any other error occurs.