1   /*
2    * OntologyEditor.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 17/04/2002
14   *
15   * $Id: OntologyEditor.java,v 1.3 2002/06/28 14:41:14 nasso Exp $
16   */
17  package gate.creole.ontology;
18  
19  import gate.*;
20  import gate.creole.ResourceInstantiationException;
21  
22  import com.ontotext.gate.vr.*;
23  
24  import java.util.*;
25  
26  import javax.swing.*;
27  
28  
29  /**
30   * An interface defining the methods of an Ontology Editor.
31   */
32  public interface OntologyEditor extends VisualResource {
33  
34  /**Creates a new ontology
35   * @param name the name of the ontology
36   * @param sourceURI the URI of the ontology
37   * @param theURL the URL of the ontology
38   * @param comment ontology comment */
39  public void createOntology
40    (String name, String sourceURI, String theURL, String comment)
41    throws ResourceInstantiationException;
42  
43  /**Sets the ontology to be loaded in the editor
44   * @param o the ontology to be loaded */
45  public void setOntology(Ontology o);
46  
47  /** Gets the loaded ontology
48   * @return the current ontology in the editor*/
49  public Ontology getOntology();
50  
51  /**Sets the list of ontologies to be loaded in the editor
52   * @param list the list of ontologies */
53  public void setOntologyList(Vector list);
54  
55  /**Gets the list of ontologies currently in the editor
56   * @return the list of ontologies */
57  public Vector getOntologyList();
58  
59  /** Visualizes the editor */
60  public void visualize();
61  
62  /**Invokes an add sub class dialog in position x,y
63   * @param x the x coordinate of the dialog
64   * @param y the y coordinate of the dialog*/
65  public void addSubClass(int x,int y) ;
66  
67  /**Adds Sub Class given a ClassNode and the resulting info
68   * from the Add Sub Class dialog.
69   * @param root the node which is root to the sub class being added
70   * @param className the name from the dialog
71   * @param classComment the comment from the dialog */
72  public void addSubClass(ClassNode root, String className, String classComment);
73  
74  /**Removes the node/class
75   * @param node the node to be removed*/
76  public void removeClass(ClassNode node);
77  
78  /**Renames a class
79   * @param c the class to be renamed
80   * @param n the class node associated with the class
81   * @param x coords
82   * @param y coords */
83  public void renameClass(OClass c, ClassNode n, int x, int y);
84  
85  /**Selects an ontology.
86   * Is called when an ontology has been selecte
87   * from the ontology list.
88   * @param o the selected ontology */
89  public void ontologySelected(Ontology o) ;
90  
91  /**Saves a list of ontologies.
92   * @param list a list of ontologies to be saved*/
93  public void saveOntologies(Vector list);
94  
95  /**Closes list of ontologies
96   * @param list a list of ontologies to be saved*/
97   public void closeOntologies(Vector list) throws ResourceInstantiationException;
98  
99  /**Gets all modified ontologies.
100  * @return list of the modified ontologies */
101 public Vector getModifiedOntologies() ;
102 
103 /*----------ontologies list popup menu item listeners------------
104 note: these methods could be invoked from within a listener or explicitly*/
105 
106 /**Saves this ontology
107  * @param o the ontology to be saved
108  * @throws  */
109 public void saveOntology(Ontology 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(Ontology 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(Ontology 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(Ontology 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(Ontology 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(OClass 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(Ontology 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(Ontology 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(Ontology 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