private void processFile(File f) { if (f.isHidden()) { return; } for (File file : f.listFiles()) { if (file.isDirectory() && recursive) { processFile(file); } else { boolean parsedFile = false; if (file.getName().endsWith(".obo")) { oboFileMap.put(file.getName(), IRI.create(file)); } else if(file.getName().endsWith(".omn")) { parseManchesterSyntaxFile(file); } else { for (String ext : fileExtensions) { if (file.getName().endsWith(ext)) { parseFile(file); parsedFile = true; } } } } } }
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); } }