01 /*
02 * OntologyModificationListener.java
03 *
04 * Niraj Aswani, 09/March/07
05 *
06 * $Id: OntologyModificationListener.html,v 1.0 2007/03/09 16:13:01 niraj Exp $
07 */
08 package gate.creole.ontology;
09
10 import java.util.EventListener;
11
12 /**
13 * Objects wishing to listen to various ontology events, must implement
14 * this interface (using implements java keyword) and the methods of
15 * this interface. They must get registered themselves with the
16 * respective ontology by using the
17 * ontology.addOntologyModificationListener(OntologyModificationListener)
18 * method.
19 *
20 * @author Niraj Aswani
21 *
22 */
23 public interface OntologyModificationListener extends EventListener {
24 /**
25 * This method is invoked whenever a relation between two objects of the same class (e.g. OClass and OClass, RDFPRoeprty and RDFProeprty etc) is changed.
26 *
27 * @param ontology the source of the event
28 * @param resource1 the affected OResource
29 * @param resource2 the affected OResource
30 * @param eventType the type of an event (@see OConstants) for more
31 * details
32 */
33 public void resourceRelationChanged(Ontology ontology, OResource resource1, OResource resource2,int eventType);
34
35
36 /**
37 * This method should be invoked when a property value is added or removed (specified by the event type).
38 * @param ontology the source of the event
39 * @param resource the affected resource whose property value is added or removed
40 * @param property the property whose value has been added or removed
41 * @param value the actual value that is added or removed. If the value is null - it indicates all the values related to the property are deleted.
42 * @param eventType type of the event (@see OConstants) for more details
43 */
44 public void resourcePropertyValueChanged(Ontology ontology, OResource resource, RDFProperty property, Object value, int eventType);
45
46 /**
47 * This method is invoked whenever a resource
48 * (class/property/instance) is removed from the ontology.
49 *
50 * @param ontology the source of the event
51 * @param resources an array of URIs of resources which were deleted
52 * (including the resource which was asked to be deleted).
53 */
54 public void resourcesRemoved(Ontology ontology, String[] resources);
55
56 /**
57 * This method is invoked whenever a resource
58 * (class/property/instance) is added to the ontology.
59 *
60 * @param ontology the source of the event
61 * @param resource an instance of OResource, which was created as a
62 * result of addition of a resource.
63 */
64 public void resourceAdded(Ontology ontology, OResource resource);
65
66 /**
67 * This method is called whenever ontology is reset. In other words
68 * when all resources of the ontology are deleted using the ontology.cleanup method.
69 * @param ontology
70 */
71 public void ontologyReset(Ontology ontology);
72 }
|