How to listen to ontology changes via OWLAPI

How to listen to ontology changes via OWLAPI

I would like to implement a daemon using the OWLAPI (ideally version 5, but I am willing to downgrade) that checks for changes in my ontology.

However, the changes will be done via the Protege Desktop Editor (I use version 5.5.0-beta-7), so I have the following questions:

1. How can my daemon get access to the same ontology instance as the one that I am editing via the Protege Editor? Since if I load an ontology via the Protege Editor and the daemon / OWLAPI from the same file, they each create their own ontology instance, but I want both the Protege Editor and my daemon to point to the same ontology instance.

2. Is there a method in the OWLAPI that notifies me if and what changes have been made to an ontology of interest? Since even if question 1 is resolved, I wouldn’t know how my daemon can get notified about what changes have been made via the Protege Editor.

Re: How to listen to ontology changes via OWLAPI

1. I would expect that this can be done by creating a plugin that listens to the ontology changes and creates a connection to your external software (daemon).2. This would be the modelManager.addOntologyChangeListener(listener) assuming that the ontology of interest is the current active ontology.

I would like to implement a daemon using the OWLAPI (ideally version 5, but I am willing to downgrade) that checks for changes in my ontology.

However, the changes will be done via the Protege Desktop Editor (I use version 5.5.0-beta-7), so I have the following questions:

1. How can my daemon get access to the same ontology instance as the one that I am editing via the Protege Editor? Since if I load an ontology via the Protege Editor and the daemon / OWLAPI from the same file, they each create their own ontology instance, but I want both the Protege Editor and my daemon to point to the same ontology instance.

2. Is there a method in the OWLAPI that notifies me if and what changes have been made to an ontology of interest? Since even if question 1 is resolved, I wouldn’t know how my daemon can get notified about what changes have been made via the Protege Editor.