code: private String asString(final Resource resource, final Map<String, String> values) {
          if (uriTemplate.match(resource.getURI(), values) && values.containsKey("path")) {
              String path = "/" + values.get("path");
  
              final Matcher matcher = FORWARD_COMPONENT_PATTERN.matcher(path);
  
              if (matcher.matches()) {
                  final boolean metadata = matcher.group(1) != null;
                  final boolean versioning = matcher.group(2) != null;
                  final boolean webacAcl = matcher.group(4) != null;
  
                  if (versioning) {
                      path = replaceOnce(path, "/" + FCR_VERSIONS, "/" + LDPCV_TIME_MAP);
                  }
  
                  if (metadata) {
                      path = replaceOnce(path, "/" + FCR_METADATA, "/" + FEDORA_DESCRIPTION);
                  }
  
                  if (webacAcl) {
                      path = replaceOnce(path, "/" + FCR_ACL, "/" + CONTAINER_WEBAC_ACL);
                  }
              }
  
              path = forward.convert(path);
  
              if (path == null) {
                  return null;
              }
  
              try {
                  path = URLDecoder.decode(path, "UTF-8");
              } catch (final UnsupportedEncodingException e) {
                  LOGGER.debug("Unable to URL-decode path " + e + " as UTF-8", e);
              }
  
              if (path.isEmpty()) {
                  return "/";
              }
  
              // Validate path
              if (path.contains("//")) {
                  throw new InvalidResourceIdentifierException("Path contains empty element! " + path);
              }
              return path;
          }
  
          if (isRootWithoutTrailingSlash(resource)) {
              return "/";
          }
  
          return null;
      }
docs: Convert the incoming Resource to a JCR path (but don't attempt to load the node).
  
  @param resource Jena Resource to convert
  @param values a map that will receive the matching URI template variables for future use.
  @return String of JCR path