1   /*
2    * OntologyEditor.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 17/04/2002
14   *
15   * $Id: OntologyEditor.java,v 1.6 2004/07/23 17:45:30 kalina Exp $
16   */
17  package gate.creole.ontology;
18  
19  import java.util.Set;
20  import java.util.Vector;
21  
22  import com.ontotext.gate.vr.ClassNode;
23  
24  import gate.VisualResource;
25  import gate.creole.ResourceInstantiationException;
26  
27  
28  /**
29   * An interface defining the methods of an Ontology Editor.
30   */
31  public interface OntologyEditor extends VisualResource {
32  
33  /**Creates a new ontology
34   * @param name the name of the ontology
35   * @param sourceURI the URI of the ontology
36   * @param theURL the URL of the ontology
37   * @param comment ontology comment */
38  public void createOntology
39    (String name, String sourceURI, String theURL, String comment)
40    throws ResourceInstantiationException;
41  
42  /**Sets the ontology to be loaded in the editor
43   * @param o the ontology to be loaded */
44  public void setOntology(Taxonomy o);
45  
46  /** Gets the loaded ontology
47   * @return the current ontology in the editor*/
48  public Taxonomy getOntology();
49  
50  /**Sets the list of ontologies to be loaded in the editor
51   * @param list the list of ontologies */
52  public void setOntologyList(Vector list);
53  
54  /**Gets the list of ontologies currently in the editor
55   * @return the list of ontologies */
56  public Vector getOntologyList();
57  
58  /** Visualizes the editor */
59  public void visualize();
60  
61  /**Invokes an add sub class dialog in position x,y
62   * @param x the x coordinate of the dialog
63   * @param y the y coordinate of the dialog*/
64  public void addSubClass(int x,int y) ;
65  
66  /**Adds Sub Class given a ClassNode and the resulting info
67   * from the Add Sub Class dialog.
68   * @param root the node which is root to the sub class being added
69   * @param className the name from the dialog
70   * @param classComment the comment from the dialog */
71  public void addSubClass(ClassNode root, String className, String classComment);
72  
73  /**Removes the node/class
74   * @param node the node to be removed*/
75  public void removeClass(ClassNode node);
76  
77  /**Renames a class
78   * @param c the class to be renamed
79   * @param n the class node associated with the class
80   * @param x coords
81   * @param y coords */
82  public void renameClass(TClass c, ClassNode n, int x, int y);
83  
84  /**Selects an ontology.
85   * Is called when an ontology has been selecte
86   * from the ontology list.
87   * @param o the selected ontology */
88  public void ontologySelected(Taxonomy o) ;
89  
90  /**Saves a list of ontologies.
91   * @param list a list of ontologies to be saved*/
92  public void saveOntologies(Vector list);
93  
94  /**Closes list of ontologies
95   * @param list a list of ontologies to be saved*/
96   public void closeOntologies(Vector list) throws ResourceInstantiationException;
97  
98  /**Gets all modified ontologies.
99   * @return list of the modified ontologies */
100 public Vector getModifiedOntologies() ;
101 
102 /*----------ontologies list popup menu item listeners------------
103 note: these methods could be invoked from within a listener or explicitly*/
104 
105 /**Saves this ontology
106  * @param o the ontology to be saved
107  * @throws {@link ResourceInstantiationException}
108  */
109 public void saveOntology(Taxonomy o) throws ResourceInstantiationException ;
110 
111 /**Invokes a Save As dialog for this ontology and saves it
112  *  to the specified location.
113  *  @param o the ontology to be saved
114  *  @param x the x coordinate of the save as dialog
115  *  @param y the y coordinate of the save as dialog*/
116 public void saveAsOntology(Taxonomy o, int x, int y) throws ResourceInstantiationException;
117 
118 /**Renames an ontology
119  * @param o the ontology to be renamed
120  * @param x the x coordinate of the rename dialog
121  * @param y the y coordinate of the rename dialog*/
122 public void renameOntology(Taxonomy o, int x, int y);
123 
124 /**Deletes an ontology. Invokes AreYouSureDialog if the
125  * ontology has been changed.
126  * @param o the ontology to be deleted
127  * @param x x coordinate of the option pane to be invoked
128  * @param y y coordinate of the option pane to be invoked*/
129 public void deleteOntology(Taxonomy o, int x, int y)
130   throws ResourceInstantiationException;
131 
132 /** Edits the URI of an ontology.
133  * @param o the ontology to be edited
134  * @param x  coords of the dialog
135  * @param y  coords of the dialog
136  */
137 public void editURI(Taxonomy o, int x, int y);
138 
139 /** Edit the URI of an ontology class
140  * @param c class to be edited
141  * @param x  coords of the dialog
142  * @param y  coords of the dialog */
143 public void editClassURI(TClass c, int x, int y);
144 
145 /**
146  * Gets all URIs that are present at the moment as ontology URIs.
147  * @return all the uris that are available in the editor
148  */
149 public Set getAllURIs() ;
150 
151 /**Retrieve a set of all the class URIs in an ontology
152  * @param o the ontology
153  * @return set of all the URIs in the ontology
154  */
155 public Set getAllURIs(Taxonomy o) ;
156 
157 /**Closes an ontology. Invokes AreYouSureDialog if the
158  * ontology has been changed.
159  * @param o the ontology to be closed
160  * @param x x coordinate of the option pane to be invoked
161  * @param y y coordinate of the option pane to be invoked*/
162 public void closeOntology(Taxonomy o, int x, int y)
163   throws ResourceInstantiationException;
164 
165 /*End-------ontologies list popup menu item listeners------------*/
166 
167 /**Wanna Save Dialog invocation.
168  * @param o the ontology to be saved or not
169  * @param x x coordinate of the option pane to be invoked
170  * @param y y coordinate of the option pane to be invoked
171  * @return the result of the option pane */
172 public int AskWannaSave(Taxonomy o, int x, int y);
173 
174 /*------------- menu bar methods --------------*/
175 
176 /**
177  * Acts on choosing Exit from the File menu.
178  */
179 public void fileExit();
180 
181 /**
182  * Acts on choosing Open from the File menu.
183  * @param x the x coordinate of the invocation
184  * @param y the y coordinate of the invocation
185  * @throws ResourceInstantiationException if something goes wrong with the loading.
186  */
187 public void fileOpen(int x,int y)throws ResourceInstantiationException;
188 
189 /**
190  * Invoke a mutiple selection save dialog with a list of ontologies to be saved.
191  * @param x  coords of the dialog
192  * @param y  coords of the dialog
193  * @param ontologies the list of ontologies to be optionally saved
194  */
195 public void fileSave(int x, int y,Vector ontologies) ;
196 
197 /**
198  * Invokes a mutiple selection close dialog with a list of ontologies to be closed.
199  * @param x  coords of the dialog
200  * @param y  coords of the dialog
201  * @param ontologies the list of ontologies to be optionally closed
202  */
203 public void fileClose(int x, int y,Vector ontologies) ;
204 
205 /**Inovkes a new ontology dialog.
206  * @param x  coords of the dialog
207  * @param y  coords of the dialog */
208 public void fileNew(int x, int y);
209 
210 
211 }//interface OntologyEditor
212 
213