1

I have an ontology that I need to save on file if and only if some changes occured and the reasoner (pellet in my case) is consistent with these changes. So i write:

 reasoner.flush(); //sync reasoner
 if(reasoner.isConsistent())
 manager.saveOntology(ontos[1], new RDFXMLDocumentFormat(), IRI.create((new   File(file)).toURI())); 

I would synchronize Pellet only if the ontology has been modified, than if it is consistent synchronize it and apply changes. Any idea how to proceed? Thank you

(Edit: I use manager.applyChange method in order to modify the ontology).

Discipulos
  • 423
  • 8
  • 23

1 Answers1

1

Finally, I used reasoner.getPendingChanges().isEmpty() to check for new changes with a buffering reasoner (with a non bufferd one changes apply automatically).

Discipulos
  • 423
  • 8
  • 23
  • Another solution is to add an ontology change listener to the ontology manager. However your solution has the advantage of not requiring a flush. – Ignazio Jul 12 '15 at 10:50
  • Thank your for your feedback. If I use a non buffering reasoner and the reasoner itself as change listener, i.e. with manager.addOntologyChangeListener( reasoner ), how can I check for changes ? – Discipulos Jul 13 '15 at 12:02
  • I don't think it's possible with just a non buffering reasoner and no other listener. – Ignazio Jul 13 '15 at 12:53
  • That sounds plausible since it is a " non buffering" reasoner. Thank you ! – Discipulos Jul 14 '15 at 14:20