code: public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, Node node)
        throws InvalidQueryException, RepositoryException
     {
        AbstractQueryImpl query = createQueryInstance();
        query.init(session, sessionDataManager, handler, node);
        return query;
     }
docs: Creates a query object from a node 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 node
  a node of type nt:query.
  @return a <code>Query</code> instance to execute.
  @throws InvalidQueryException
  if <code>absPath</code> is not a valid persisted query (that
  is, a node of type nt:query)
  @throws RepositoryException
  if any other error occurs.