code: public static QueryRootNode parse(String statement,
                                        String language,
                                        LocationFactory resolver,
                                        QueryNodeFactory factory)
              throws InvalidQueryException {
  
          QueryTreeBuilder builder = QueryTreeBuilderRegistry.getQueryTreeBuilder(language);
          return builder.createQueryTree(statement, resolver, factory);
      }
docs: Parses a query <code>statement</code> according to a query
  <code>language</code> into a query tree.
  <br>
  <code>language</code> must be one of: {@link javax.jcr.query.Query#SQL},
  {@link javax.jcr.query.Query#XPATH}.
  
  @param statement the query statement.
  @param language  the language of the query statement.
  @param factory   the query node factory.
  @return the root node of the generated query tree.
  @throws InvalidQueryException if an error occurs while parsing the
  statement.