/** Compress the URI using the prefix mapping. This version of the code looks through all the maplets and checks each candidate prefix URI for being a leading substring of the argument URI. There's probably a much more efficient algorithm available, preprocessing the prefix strings into some kind of search table, but for the moment we don't need it. */ @Override public String shortForm( String uri ) { Entry<String, String> e = findMapping( uri, true ); return e == null ? uri : e.getKey() + ":" + uri.substring( (e.getValue()).length() ); }