LocalMirrorIRIMapper implements OWLOntologyIRIMapper { @Override public IRI getDocumentIRI(IRI ontologyIRI) { String source = ontologyIRI.toString(); IRI targetIRI = null; String targetPrefix = null; for (IRI sourcePrefixIRI : mappings.keySet()) { String sourcePrefix = sourcePrefixIRI.toString(); if (source.startsWith(sourcePrefix)) { if (targetIRI != null) { if (mappings.get(sourcePrefix).toString().length() < targetPrefix.length()) { continue; } } targetPrefix = mappings.get(sourcePrefixIRI).toString(); String target = source.replaceFirst(sourcePrefix, targetPrefix); if (target != null) { if (parentFolder != null && target.indexOf(":") < 0) { File file = new File(target); if (!file.isAbsolute()) { file = new File(parentFolder, target); } try { file = file.getCanonicalFile(); targetIRI = IRI.create(file); } catch (IOException e) { logger.warn("Skipping mapping: "+source+" "+target, e); } } else { targetIRI = IRI.create(target); } } logger.info("Mapping "+source +" ==> "+targetIRI); } } return targetIRI; } LocalMirrorIRIMapper(Map<IRI, IRI> mappings);  LocalMirrorIRIMapper(String mappingFile);  LocalMirrorIRIMapper(File mappingFile);  LocalMirrorIRIMapper(File mappingFile, File parentFolder);  LocalMirrorIRIMapper(URL mappingURL);  LocalMirrorIRIMapper(URL mappingURL, File parentFolder); @Override IRI getDocumentIRI(IRI ontologyIRI);  }
@Test public void testParseCatalogXML2() throws Exception { LocalMirrorIRIMapper m = new LocalMirrorIRIMapper("src/test/resources/owl-mirror.txt"); IRI iri = m.getDocumentIRI(IRI.create("http: assertNotNull(iri); }