code: public ResponseBuilder getTimeMapBuilder(final SortedSet<Instant> mementos, final TrellisRequest req,
              final String baseUrl) {
  
          final List<MediaType> acceptableTypes = req.getAcceptableMediaTypes();
          final String identifier = fromUri(baseUrl).path(req.getPath()).build().toString();
          final List<Link> links = getMementoLinks(identifier, mementos).collect(toList());
  
          final ResponseBuilder builder = ok().link(identifier, ORIGINAL + " " + TIMEGATE);
          builder.links(links.stream().map(this::filterLinkParams).toArray(Link[]::new))
              .link(Resource.getIRIString(), TYPE).link(RDFSource.getIRIString(), TYPE)
              .header(ALLOW, join(",", GET, HEAD, OPTIONS));
  
          final RDFSyntax syntax = getSyntax(trellis.getIOService(), acceptableTypes, APPLICATION_LINK_FORMAT);
  
          if (syntax != null) {
              final IRI profile = getProfile(acceptableTypes, syntax);
              final IRI jsonldProfile = profile != null ? profile : compacted;
  
              final StreamingOutput stream = new StreamingOutput() {
                  @Override
                  public void write(final OutputStream out) throws IOException {
                      trellis.getIOService().write(timemap.asRdf(identifier, links), out, syntax, jsonldProfile);
                  }
              };
  
              return builder.type(syntax.mediaType()).entity(stream);
          }
  
          return builder.type(APPLICATION_LINK_FORMAT)
              .entity(links.stream().map(this::filterLinkParams).map(Link::toString).collect(joining(",\n")) + "\n");
      }
docs: Create a response builder for a TimeMap response.
  
  @param mementos the mementos
  @param baseUrl the base URL
  @param req the LDP request
  @return a response builder object