Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Detect entities refactoring/removing events with Protege4.1 owl api

Timothy Redmond tredmond at
Mon Nov 8 17:04:18 PST 2010

On 11/08/2010 10:16 AM, Daniele Bacarella wrote:
> It only provides a list of ontologychanges from which it's not 
> possible identifying  uniquely  the event and with it the 
> entity/entities involved.

Just to make sure that we are talking about the same thing, I believe 
that we are talking about


I don't know exactly what you mean by "it's not possible identifying 
  uniquely  the event" and "the entity/entities involved".  It is true 
that the ontology changes that you listen for this way are very low 
level.  It might be difficult to detect a refactor operation because it 
involves many ontology changes no one of which indicates a refactor.

It is not too difficult though - for example - to detect when an entity 
is deleted.  In the OWL API, an entity is deleted from an ontology when 
the ontology contains no axioms that mention the entity.  Thus an entity 
will only be finally removed when an axiom is removed that references 
the entity.  So when the listener detects that an axiom is removed, the 
listener can look at the entities referenced by the axiom 
(axiom.getSignature()) and then see if these entities are still 
referenced by some axiom in the ontology 
(ontology.containsEntityInSignature(entity)).  So for example the 
following code will detect deletions:

    	org.semanticweb.owlapi.model.OWLOntology ontology = change.getOntology();
    	boolean deleted = false;
    	for (org.semanticweb.owlapi.model.OWLEntity e : change.getAxiom().getSignature()) {
    		if (!ontology.containsEntityInSignature(e)) {
    			System.out.println("Entity " + e + " deleted");
    			deleted = true;
    	return deleted;

> I also tried getting , say , if an event was "Entity removed" or not 
> checking that all the changes were "REMOVE CHANGE" but I failed 
> getting the entity name in case it got subclasses.

There is no "entity removed" event (like in Protege 3) but you can still 
detect when an entity is removed.

Refactors would be much more difficult to detect because they are 
complex operations that can be implemented in many different ways.


> On Mon, Nov 8, 2010 at 7:00 PM, Thomas Russ <tar at 
> <mailto:tar at>> wrote:
>     On Nov 8, 2010, at 9:50 AM, Daniele Bacarella wrote:
>         I saw that there was the class ModelAdapter in Protege 3.4.4
>         which provides the methods that I am looking for.
>         How can I do that with Protege 4.1 owl api?
>     Maybe OWLOntologyChangeListener ?
>     _______________________________________________
>     protege-discussion mailing list
>     protege-discussion at
>     <mailto:protege-discussion at>
>     Instructions for unsubscribing:
> -- 
>  -------------------------------------
>  Daniele Bacarella
>  Email: daniele.bacarella at <mailto:daniele.bacarella at>
>  Blog:
>  -------------------------------------
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at
> Instructions for unsubscribing:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the protege-discussion mailing list