protected void parseIfExtensionSupported(File file) { String name = file.getName(); int lastIndexOf = name.lastIndexOf('.'); if (lastIndexOf < 0) { // no extension for the file, nothing to do return; } String extension = name.substring(lastIndexOf); if (".zip".equalsIgnoreCase(extension) || ".jar".equalsIgnoreCase(extension)) { try { ZipIRIMapper mapper = new ZipIRIMapper(file, "jar:" + file.toURI() + "!/"); mapper.oboMappings().forEach(e -> oboFileMap.put(e.getKey(), e.getValue())); mapper.iriMappings() .forEach(e -> ontologyIRI2PhysicalURIMap.put(e.getKey(), e.getValue())); } catch (IOException e) { // if we can't parse a file, then we can't map it LOGGER.debug("Exception reading file", e); } } else if (".obo".equalsIgnoreCase(extension)) { oboFileMap.put(name, IRI.create(file)); } else if (".ofn".equalsIgnoreCase(extension)) { parseFSSFile(file); } else if (".omn".equalsIgnoreCase(extension)) { parseManchesterSyntaxFile(file); } else if (fileExtensions.contains(extension.toLowerCase())) { parseFile(file); } }
protected void parseIfExtensionSupported(File file) { String name = file.getName(); int lastIndexOf = name.lastIndexOf('.'); if (lastIndexOf < 0) { // no extension for the file, nothing to do return; } String extension = name.substring(lastIndexOf); if (".zip".equalsIgnoreCase(extension) || ".jar".equalsIgnoreCase(extension)) { try { ZipIRIMapper mapper = new ZipIRIMapper(file, "jar:" + file.toURI() + "!/"); mapper.oboMappings().forEach(e -> oboFileMap.put(e.getKey(), e.getValue())); mapper.iriMappings() .forEach(e -> ontologyIRI2PhysicalURIMap.put(e.getKey(), e.getValue())); } catch (IOException e) { // if we can't parse a file, then we can't map it LOGGER.debug("Exception reading file", e); } } else if (".obo".equalsIgnoreCase(extension)) { oboFileMap.put(name, IRI.create(file)); } else if (".ofn".equalsIgnoreCase(extension)) { parseFSSFile(file); } else if (".omn".equalsIgnoreCase(extension)) { parseManchesterSyntaxFile(file); } else if (fileExtensions.contains(extension.toLowerCase())) { parseFile(file); } }
protected void parseIfExtensionSupported(File file) { String name = file.getName(); int lastIndexOf = name.lastIndexOf('.'); if (lastIndexOf < 0) { // no extension for the file, nothing to do return; } String extension = name.substring(lastIndexOf); if (".zip".equalsIgnoreCase(extension) || ".jar".equalsIgnoreCase(extension)) { try { ZipIRIMapper mapper = new ZipIRIMapper(file, "jar:" + file.toURI() + "!/"); mapper.oboMappings().forEach(e -> oboFileMap.put(e.getKey(), e.getValue())); mapper.iriMappings() .forEach(e -> ontologyIRI2PhysicalURIMap.put(e.getKey(), e.getValue())); } catch (IOException e) { // if we can't parse a file, then we can't map it LOGGER.debug("Exception reading file", e); } } else if (".obo".equalsIgnoreCase(extension)) { oboFileMap.put(name, IRI.create(file)); } else if (".ofn".equalsIgnoreCase(extension)) { parseFSSFile(file); } else if (".omn".equalsIgnoreCase(extension)) { parseManchesterSyntaxFile(file); } else if (fileExtensions.contains(extension.toLowerCase())) { parseFile(file); } }