コード例 #1
0
  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;
  }
コード例 #2
0
 public void updateCache() {
   ontCache = new OntologyCache(ontHandler);
   ontCache.init();
 }