code: public static SelectQuery from(final TupleExpr expression, @Nullable final Dataset dataset)
              throws ParseException {
  
          Preconditions.checkNotNull(expression);
  
          try {
              // Sesame rendering facilities are definitely broken, so we use our own
              final String string = new SPARQLRenderer(null, true).render(expression, dataset);
              SelectQuery query = CACHE.getIfPresent(string);
              if (query == null) {
                  query = new SelectQuery(string, expression, dataset);
                  CACHE.put(string, query);
              }
              return query;
  
          } catch (final Exception ex) {
              throw new ParseException(expression.toString(),
                      "The supplied algebraic expression does not denote a valid SPARQL query", ex);
          }
      }
docs: Returns an <tt>SelectQuery</tt> for the algebraic expression and optional dataset
  specified.
  
  @param expression
  the algebraic expression for the query
  @param dataset
  the dataset optionally associated to the query
  @return the corresponding <tt>SelectQuery</tt> object
  @throws ParseException
  in case the supplied algebraic expression does not denote a valid SPARQL SELECT
  query