private void handleNotesOntologyChanged(List<OWLOntologyChange> changes) {
    try {
      OWLOntologyManager notesOntologyManager = notesOntology.getOWLOntologyManager();
      if (notesOntologyManager.getOntologyFormat(notesOntology)
          instanceof BinaryOWLOntologyDocumentFormat) {
        OWLAPIProjectDocumentStore documentStore =
            OWLAPIProjectDocumentStore.getProjectDocumentStore(project.getProjectId());
        List<OWLOntologyChangeData> infoList = new ArrayList<OWLOntologyChangeData>();
        for (OWLOntologyChange change : changes) {
          OWLOntologyChangeRecord rec = change.getChangeRecord();
          OWLOntologyChangeData info = rec.getData();
          infoList.add(info);
        }
        BinaryOWLOntologyDocumentSerializer serializer = new BinaryOWLOntologyDocumentSerializer();
        serializer.appendOntologyChanges(
            notesOntologyDocument,
            new OntologyChangeDataList(infoList, System.currentTimeMillis()));
      } else {
        // Swap it over
        notesOntologyManager.saveOntology(notesOntology, new BinaryOWLOntologyDocumentFormat());
      }

    } catch (OWLOntologyStorageException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  public void loadOntology() {
    try {
      /*
       * --apaitoymena vimata gia th dhmioyrgia mapped ontologias:
       * 1.dhmioyrgoyme ena toBeMappedIRI me skopo toy thn antistoixish me
       * to local File. 2.dhmioyrgoyme ena File me th dieythynsh ths
       * ontologias sto topiko apothikeytiko meso. 3.dhmioyrgoyme enan
       * SimpleIRIMapper kai ton prosthetoyme mesw toy manager. o
       * SimpleIRIMapper syndeei to toBeMappedIRI poy dwsame arxika, me
       * thn fysikh topothesia ths ontologias sto topiko apothikeytiko
       * meso. 4.dhmioyrgoyme ena ontologyIRI me akrivws thn idia arxiki
       * timh me to toBeMappedIRI to opoio tha einai to IRI ths ontologias
       * mas 5.dhmioyrgoyme thn ontologia mas xrhsimopoiwntas to
       * manager.loadOntology(ontologyIRI);
       */
      String sep = File.separator;

      manager = OWLManager.createOWLOntologyManager();
      toBeMappedIRI =
          IRI.create(
              "http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl");
      // ontFile = new File("../src/ontologyresources/ptyxiaki_v0.8.owl");
      ontFile = new File("src/ontologyresources/ptyxiaki_v0.8.owl");
      // in case of alternative location on load time when the application is jar'ed!
      if (!ontFile.canRead()) {
        ontFile = new File("ontologyresources/ptyxiaki_v0.8.owl");
      }
      manager.addIRIMapper(new SimpleIRIMapper(toBeMappedIRI, IRI.create(ontFile)));
      ontologyIRI =
          IRI.create(
              "http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl");
      topIxOnt = manager.loadOntology(ontologyIRI);
      OWLFactory = manager.getOWLDataFactory();
      topIxFormat = manager.getOntologyFormat(topIxOnt);
      topIxPrefixManager =
          new DefaultPrefixManager(topIxOnt.getOntologyID().getOntologyIRI().toString() + '#');

      System.out.println("loaded ontology: " + this.topIxOnt);
      System.out.println("from: " + this.manager.getOntologyDocumentIRI(this.topIxOnt));

    } catch (OWLException oex) {
      logger.info(oex.getMessage());
    }
  }
 private Optional<IRI> getPrefix(String prefixedName) {
   OWLOntology activeOntology = modelManager.getActiveOntology();
   OWLOntologyManager manager = modelManager.getOWLOntologyManager();
   OWLDocumentFormat format = manager.getOntologyFormat(activeOntology);
   for (Namespaces ns : Namespaces.values()) {
     if (prefixedName.startsWith(ns.name().toLowerCase() + ":")) {
       return Optional.of(IRI.create(ns.toString()));
     }
   }
   int colonIndex = prefixedName.indexOf(':');
   if (colonIndex > 0 && format != null && format.isPrefixOWLOntologyFormat()) {
     PrefixDocumentFormat prefixes = format.asPrefixOWLOntologyFormat();
     String prefixLabel = prefixedName.substring(0, colonIndex + 1);
     String prefix = prefixes.getPrefix(prefixLabel);
     if (prefix != null) {
       return Optional.of(IRI.create(prefix));
     }
   }
   return Optional.empty();
 }
 private boolean isOBOFormat(OWLOntology ontology) {
   OWLOntologyManager man = ontology.getOWLOntologyManager();
   return man.getOntologyFormat(ontology) instanceof OBOOntologyFormat;
 }
 /**
  * Constructs a short form provider that reuses any prefix name mappings obtainable from the
  * format of the specified ontology (the manager will be asked for the ontology format of the
  * specified ontology)
  *
  * @param man The manager
  * @param ont The ontology
  */
 @Deprecated
 public ManchesterOWLSyntaxPrefixNameShortFormProvider(OWLOntologyManager man, OWLOntology ont) {
   this(man.getOntologyFormat(ont));
 }