code: public static String getUriTemplateString(ImmutableFunctionalTerm uriFunction) {
          ValueConstant term = (ValueConstant) uriFunction.getTerm(0);
          final String template = term.getValue();
          ImmutableList<? extends ImmutableTerm> otherSubTerms = uriFunction.getTerms()
                  .subList(1, uriFunction.getTerms().size());
  
          List<String> splitParts = Splitter.on(PLACE_HOLDER).splitToList(template);
  
          StringBuilder templateWithVars = new StringBuilder();
  
          int numVars = otherSubTerms.size();
          int numParts = splitParts.size();
  
          if (numParts != numVars + 1 && numParts != numVars) {
              throw new IllegalArgumentException("the number of place holders should be equal to the number of other terms.");
          }
  
          for (int i = 0; i < numVars; i++) {
              templateWithVars.append(splitParts.get(i))
                      .append("{")
                      .append(otherSubTerms.get(i))
                      .append("}");
          }
  
          if (numParts == numVars + 1) {
              templateWithVars.append(splitParts.get(numVars));
          }
  
          return templateWithVars.toString();
      }
docs: Converts a URI function to a URI template
  <p>
  For instance:
  <pre>
  URI("http://example.org/{}/{}/{}", X, Y, X) -> "http://example.org/{X}/{Y}/{X}"
  </pre>
  
  @param uriFunction URI Function
  @return a URI template with variable names inside the placeholders