| Taxonomy.java |
1 /*
2 * Taxonomy.java
3 *
4 * Copyright (c) 2002-2004, The University of Sheffield.
5 *
6 * This file is part of GATE (see http://gate.ac.uk/), and is free
7 * software, licenced under the GNU Library General Public License,
8 * Version 2, June1991.
9 *
10 * A copy of this licence is included in the distribution in the file
11 * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12 *
13 * borislav popov 02/2002
14 *
15 *
16 * $Id: Taxonomy.java,v 1.5 2006/02/05 23:48:47 valyt Exp $
17 */
18 package gate.creole.ontology;
19
20 import gate.LanguageResource;
21 import gate.creole.ResourceInstantiationException;
22 import java.net.URL;
23 import java.util.Comparator;
24 import java.util.Iterator;
25 import java.util.Set;
26
27 /** Defines the interface of an ontology */
28 public interface Taxonomy extends LanguageResource {
29
30 /**
31 * Gets the label.
32 *
33 * @return the label of the ontology
34 */
35 public String getLabel();
36
37 /**
38 * Sets the label of the ontology.
39 *
40 * @param theLabel
41 * the label to be set
42 */
43 public void setLabel(String theLabel);
44
45 /**
46 * Gets the url of this ontology
47 *
48 * @return the url of this ontology
49 */
50 public URL getURL();
51
52 /**
53 * Set the url of this ontology
54 *
55 * @param aUrl
56 * the url to be set
57 */
58 public void setURL(URL aUrl);
59
60 /**
61 * Loads this ontology. According to different storages - different
62 * implementations are expected. Should take care of the modifiedAfterLoading
63 * member
64 */
65 public void load() throws ResourceInstantiationException;
66
67 /**
68 * Stores this ontology. According to different storages - different
69 * implementations are expected. Should take care of the modifiedAfterLoading
70 * member
71 */
72 public void store() throws ResourceInstantiationException;
73
74 /**
75 * Sets the URI of the ontology
76 *
77 * @param theURI
78 * the URI to be set
79 */
80 public void setDefaultNameSpace(String theURI);
81
82 /**
83 * Gets the default name space for this ontology. This value is prepended
84 * to local URIs (the ones not containing '#'.
85 *
86 * @return a String value.
87 */
88 public String getDefaultNameSpace();
89
90 /**
91 * Sets version to this ontology.
92 *
93 * @param theVersion
94 * the version to be set
95 */
96 public void setVersion(String theVersion);
97
98 /**
99 * Gets the version of this ontology.
100 *
101 * @return the version of this ontology
102 */
103 public String getVersion();
104
105 /**
106 * Gets the id of this ontology.
107 *
108 * @return the id of this ontology
109 */
110 public String getId();
111
112 /**
113 * Sets the id of this ontology.
114 *
115 * @param theId
116 * the id to be set
117 */
118 public void setId(String theId);
119
120 /**
121 * Gets the comment of this ontology.
122 *
123 * @return the comment of this ontology
124 */
125 public String getComment();
126
127 /**
128 * Sets the comment of this ontology.
129 *
130 * @param theComment
131 * the comment to be set
132 */
133 public void setComment(String theComment);
134
135 /**
136 * Creates a new OClass and returns it.
137 *
138 * @param aName
139 * the name of this class
140 * @param aComment
141 * the comment of this class
142 * @return the newly created class
143 */
144 public TClass createClass(String aName, String aComment);
145
146 /**
147 * Removes a class from this ontology.
148 *
149 * @param theClass
150 * the class to be removed
151 */
152 public void removeClass(TClass theClass);
153
154 /**
155 * Adds a class to the ontology.
156 *
157 * @param theClass
158 * the class to be added
159 */
160 public void addClass(TClass theClass);
161
162 /**
163 * Retrieves a class by its name.
164 *
165 * @param theName
166 * the name of the class
167 * @return the class matching the name or null if no matches.
168 */
169 public TClass getClassByName(String theName);
170
171 /**
172 * Checks if the ontology contains a class with the given name.
173 *
174 * @param theName
175 * name of a class
176 * @return true if the ontology contains a class with the name specified
177 */
178 public boolean containsClassByName(String theName);
179
180 /**
181 * Retrieves all classes as a set.
182 *
183 * @return set of all the classes in this ontology
184 */
185 public Set getClasses();
186
187 /**
188 * Retireves an iterator over the classes, ordered according to the
189 * comparator.
190 *
191 * @param comp
192 * a comparator defining the order of iterating the classes
193 * @return an iterator over the classes
194 */
195 public Iterator getClasses(Comparator comp);
196
197 /**
198 * Gets the top classes.
199 *
200 * @return set of the top classes of this ontology
201 */
202 public Set getTopClasses();
203
204 /**
205 * Gets the taxonomic distance between 2 classes.
206 *
207 * @param class1
208 * the first class
209 * @param class2
210 * the second class
211 * @return the taxonomic distance between the 2 classes
212 */
213 public int getTaxonomicDistance(TClass class1, TClass class2);
214
215 /**
216 * Check for subclass relation with transitive closure
217 *
218 * @param cls1
219 * the first class
220 * @param cls2
221 * the second class
222 */
223 public boolean isSubClassOf(String cls1, String cls2);
224
225 /**
226 * Check for subclass relation with direct closure
227 *
228 * @param cls1
229 * the first class
230 * @param cls2
231 * the second class
232 */
233 public boolean isDirectSubClassOf(String cls1, String cls2);
234
235 /**
236 * Checks the equality of two ontologies.
237 *
238 * @param o
239 * the other ontology
240 * @return true if the ontologies are considered equal, otherwise - false.
241 */
242 public boolean equals(Object o);
243
244 /**
245 * Sets the modified flag.
246 *
247 * @param isModified
248 * sets this param as a value of the modified property of the
249 * ontology
250 */
251 public void setModified(boolean isModified);
252
253 /**
254 * Checks the modified flag.
255 *
256 * @return whether the ontology has been modified after the loading
257 */
258 public boolean isModified();
259 }// interface Taxonomy
260