code: public SelectQuery replaceDataset(@Nullable final Dataset dataset) {
          if (Objects.equal(this.dataset, dataset)) {
              return this;
          } else {
              try {
                  return from(this.expression, dataset);
              } catch (final ParseException ex) {
                  throw new Error("Unexpected error - replacing dataset made the query invalid (!)",
                          ex);
              }
          }
      }
docs: Replaces the dataset of this query with the one specified, returning the resulting
  <tt>SelectQuery</tt> object.
  
  @param dataset
  the new dataset; as usual, <tt>null</tt> denotes the default dataset (all the
  graphs)
  @return the resulting <tt>SelectQuery</tt> object (possibly <tt>this</tt> if no change is
  required)