public boolean doImportAndUpdateCache(File sourceFile, String encoding) { if (sourceFile == null) { logger.debug("input file is null."); return false; } logger.debug("Importing " + sourceFile.getName() + " OWL Ontology ..."); if (!sourceFile.exists()) { logger.error("file does not exist " + sourceFile.getAbsolutePath()); return false; } try { InputStreamReader s = EncodingDetector.getInputStreamReader(sourceFile, encoding); ontHandler.getOntModel().read(s, null); } catch (Throwable t) { logger.error("Error reading the OWL ontology file!", t); return false; } // update the cache ontCache = new OntologyCache(ontHandler); ontCache.init(); // notify listeners this.notifyListeners(); logger.debug("done."); return true; }
public ImportJSONLinesFileCommand(String id, String model, String revisedId, File file) { super(id, model, revisedId, file); this.encoding = EncodingDetector.detect(file); }