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