/** * Turn a filename into a well-formed file: URL relative to the working directory. * * @param filename * @return String The filename as an absolute URL */ public static String resolveFileURL(String filename) throws IRIException { IRI r = globalResolver.resolve(filename); if (!r.getScheme().equalsIgnoreCase("file")) { // Pragmatic hack that copes with "c:" return resolveFileURL("./" + filename); } return r.toString(); }
/* * No exception thrown by this method. */ private static IRI resolveIRI(String relStr, String baseStr) { IRI i = iriFactory.create(relStr); if (i.isAbsolute()) // removes excess . segments return globalResolver.getBaseIRI().create(i); IRI base = iriFactory.create(baseStr); if ("file".equalsIgnoreCase(base.getScheme())) return globalResolver.getBaseIRI().create(i); return base.create(i); }