| TClass.java |
1 /*
2 * TClass.java
3 *
4 * Copyright (c) 2002, 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: TClass.java,v 1.1 2004/07/23 17:48:08 kalina Exp $
17 */
18 package gate.creole.ontology;
19
20 import java.util.ArrayList;
21 import java.util.Set;
22
23
24 /**An Interface representing a single ontology class */
25 public interface TClass {
26
27 /**denotes a direct closure(no transitivity)*/
28 public static final byte DIRECT_CLOSURE = 0;
29
30 /**denotes atransitive closure */
31 public static final byte TRANSITIVE_CLOSURE = 1;
32
33 /**Gets the id.
34 * @return the id of the class
35 */
36 public String getId();
37
38 /**Gets the ontology to which the class belongs.
39 * @return the ontology to which the class belongs
40 */
41 public Taxonomy getOntology() ;
42
43 /**Gets the URI of the class.
44 * @return the URI of the class
45 */
46 public String getURI() ;
47
48 /**
49 * Sets the URI of the class.
50 * @param theURI the new URI to be set
51 */
52 public void setURI(String theURI) ;
53
54 /** Gets the comment of the class.
55 * @return the comment of the class
56 */
57 public String getComment();
58
59 /** Sets the class comment.
60 * @param aComment the comment to be set
61 */
62 public void setComment(String aComment) ;
63
64 /** Gets class name.
65 * @return the name of the class
66 */
67 public String getName() ;
68
69 /** Sets the class name.
70 * @param aName the new name of the class
71 */
72 public void setName(String aName) ;
73
74 /**
75 * Adds a sub class to this class.
76 * @param subClass the subClass to be added.
77 */
78 public void addSubClass(TClass subClass) ;
79
80 /** Adds a super class to this class.
81 * @param superClass the super class to be added
82 */
83 public void addSuperClass(TClass superClass) ;
84
85 /**
86 * Removes a sub class.
87 * @param subClass the sub class to be removed
88 */
89 public void removeSubClass(TClass subClass) ;
90
91 /**
92 * Removes a super class.
93 * @param superClass the super class to be removed
94 */
95 public void removeSuperClass(TClass superClass) ;
96
97 /**
98 * Gets the subclasses according to the desired closure.
99 * @param closure either DIRECT_CLOSURE or TRASITIVE_CLOSURE
100 * @return the set of subclasses
101 * @throws NoSuchClosureTypeException if an unknown closure is specified.
102 */
103 public Set getSubClasses(byte closure) throws NoSuchClosureTypeException;
104
105 /**
106 * Gets the super classes according to the desired closure.
107 * @param closure either DIRECT_CLOSURE or TRASITIVE_CLOSURE
108 * @return the set of super classes
109 * @throws NoSuchClosureTypeException if an unknown closure is specified.
110 */
111 public Set getSuperClasses(byte closure)throws NoSuchClosureTypeException ;
112
113 /**
114 * Infers the sub classes transitive closure.
115 */
116 void inferSubClassesTransitiveClosure();
117
118 /**
119 * Infers the super classes transitive closure.
120 */
121 void inferSuperClassesTransitiveClosure();
122
123 /**
124 * Checks whether this class is a top.
125 * @return true if this is a top class, otherwise - false.
126 */
127 public boolean isTopClass();
128
129 /**
130 * Dumps the class to string.
131 * @return the string representation of the class.
132 */
133 public String toString();
134
135 /**
136 * Gets the super classes, and returns them in an array list where on each index there
137 * is a collection of the super classes at distance - the index.
138 * @return <b>distance</b> from this class to a <b>set of super classes</b>
139 * e.g. 1 : a,b
140 * 2 : c,d
141 */
142 public ArrayList getSuperClassesVSDistance();
143
144 /**
145 * Gets the sub classes, and returns them in an array list where on each index there
146 * is a collection of the sub classes at distance - the index.
147 * @return <b>distance</b> from this class to a <b>set of sub classes</b>
148 * e.g. 1 : a,b
149 * 2 : c,d
150 */
151 public ArrayList getSubClassesVSDistance();
152
153
154 /**
155 * Checks the equality of two classes.
156 * @param o the ontology class to be tested versus this one.
157 * @return true, if the classes are equal, otherwise - false.
158 */
159 public boolean equals(Object o);
160
161 } //class TClass