code: public Response.ResponseBuilder getTimeMapBuilder(final LdpRequest req,
              final IOService serializer, final String baseUrl) {
  
          final List<MediaType> acceptableTypes = req.getHeaders().getAcceptableMediaTypes();
          final String identifier = getBaseUrl(baseUrl, req) + req.getPartition() + req.getPath();
          final List<Link> links = getMementoLinks(identifier, resource.getMementos()).collect(toList());
  
          final Response.ResponseBuilder builder = Response.ok().link(identifier, ORIGINAL + " " + TIMEGATE);
          builder.links(links.toArray(new Link[0])).link(Resource.getIRIString(), "type")
              .link(RDFSource.getIRIString(), "type").header(ALLOW, join(",", GET, HEAD, OPTIONS));
  
          final RDFSyntax syntax = getSyntax(acceptableTypes, of(APPLICATION_LINK_FORMAT)).orElse(null);
          if (nonNull(syntax)) {
              final IRI profile = ofNullable(getProfile(acceptableTypes, syntax)).orElse(expanded);
  
              final List<Triple> extraData = getExtraTriples(identifier);
              for (final Link l : links) {
                  if (l.getRels().contains(MEMENTO)) {
                      extraData.add(rdf.createTriple(rdf.createIRI(identifier), Memento.memento,
                                      rdf.createIRI(l.getUri().toString())));
                  }
              }
  
              final StreamingOutput stream = new StreamingOutput() {
                  @Override
                  public void write(final OutputStream out) throws IOException {
                      serializer.write(concat(links.stream().flatMap(linkToTriples), extraData.stream()), out, syntax,
                              profile);
                  }
              };
  
              return builder.type(syntax.mediaType).entity(stream);
          }
  
          return builder.type(APPLICATION_LINK_FORMAT)
              .entity(links.stream().map(Link::toString).collect(joining(",\n")) + "\n");
      }
docs: Create a response builder for a TimeMap response
  @param baseUrl the base URL
  @param req the LDP request
  @param serializer the serializer to use
  @return a response builder object