Search Mailing List Archives
[protege-discussion] Detect entities refactoring/removing events with Protege4.1 owl api
Daniele Bacarella
daniele.bacarella at gmail.com
Tue Nov 9 13:02:42 PST 2010
On Tue, Nov 9, 2010 at 2:04 AM, Timothy Redmond <tredmond at stanford.edu>wrote:
> 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
>
> getOWLModelManager().getOWLOntologyManager().addOntologyChangeListener(...);
>
>
> 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;
> }
>
>
Thanks very much Timothy, it seems working.
>
> 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.
>
> -Timothy
>
>
>
>
>
> On Mon, Nov 8, 2010 at 7:00 PM, Thomas Russ <tar at isi.edu> 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 lists.stanford.edu
>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>
>> Instructions for unsubscribing:
>> http://protege.stanford.edu/doc/faq.html#01a.03
>>
>
>
>
> --
> -------------------------------------
> Daniele Bacarella
> Email: daniele.bacarella at gmail.com
> Blog: http://jmobilecenter.blogspot.com
> http://www.teleconsulto.com
> -------------------------------------
>
>
> _______________________________________________
> protege-discussion mailing listprotege-discussion at lists.stanford.eduhttps://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>
>
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing:
> http://protege.stanford.edu/doc/faq.html#01a.03
>
>
--
-------------------------------------
Daniele Bacarella
Email: daniele.bacarella at gmail.com
Blog: http://jmobilecenter.blogspot.com
http://www.teleconsulto.com
-------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101109/26bdffe9/attachment.html>
More information about the protege-discussion
mailing list