|
Ontology |
|
1 /* 2 * Ontology.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 17 package gate.creole.ontology; 18 19 import java.net.*; 20 import java.util.*; 21 import gate.*; 22 import gate.creole.ResourceInstantiationException; 23 24 /**Defines the interface of an ontology*/ 25 public interface Ontology extends LanguageResource{ 26 27 /** Gets ontology by URL. The ontology will be searched first among the LRs and 28 * afterwards loaded by the URL if not found 29 * @param someUrl the url of the ontology 30 * @return the retrieved or loaded ontology 31 * @throws ResourceInstantiationException if something gets wrong with the loading*/ 32 public Ontology getOntology(URL someUrl) throws ResourceInstantiationException; 33 34 /** 35 * Gets the label. 36 * @return the label of the ontology 37 */ 38 public String getLabel(); 39 40 /** 41 * Sets the label of the ontology. 42 * @param theLabel the label to be set 43 */ 44 public void setLabel(String theLabel); 45 46 /** Gets the url of this ontology 47 * @return the url of this ontology */ 48 public URL getURL(); 49 50 /**Set the url of this ontology 51 * @param aUrl the url to be set */ 52 public void setURL(URL aUrl); 53 54 /**Loads this ontology. According to different storages - different implementations 55 * are expected. 56 * Should take care of the modifiedAfterLoading member */ 57 public void load() throws ResourceInstantiationException ; 58 59 /**Stores this ontology. According to different storages - different implementations 60 * are expected. 61 * Should take care of the modifiedAfterLoading member */ 62 public void store() throws ResourceInstantiationException; 63 64 /**Sets the URI of the ontology 65 * @param theURI the URI to be set */ 66 public void setSourceURI(String theURI); 67 68 /**Gets the source URI. 69 * @return the URI of this ontology*/ 70 public String getSourceURI(); 71 72 /**Sets version to this ontology. 73 * @param theVersion the version to be set */ 74 public void setVersion(String theVersion); 75 76 /**Gets the version of this ontology. 77 * @return the version of this ontology*/ 78 public String getVersion(); 79 80 /**Gets the id of this ontology. 81 * @return the id of this ontology */ 82 public String getId(); 83 84 /**Sets the id of this ontology. 85 * @param theId the id to be set */ 86 public void setId(String theId); 87 88 /**Gets the comment of this ontology. 89 * @return the comment of this ontology */ 90 public String getComment(); 91 92 /**Sets the comment of this ontology. 93 * @param theComment the comment to be set */ 94 public void setComment(String theComment); 95 96 /**Creates a new OClass and returns it. 97 * @param aName the name of this class 98 * @param aComment the comment of this class 99 * @return the newly created class */ 100 public OClass createClass(String aName, String aComment); 101 102 /**Removes a class from this ontology. 103 * @param theClass the class to be removed */ 104 public void removeClass(OClass theClass); 105 106 /**Adds a class to the ontology. 107 * @param theClass the class to be added */ 108 public void addClass(OClass theClass); 109 110 /**Retrieves a class by its name. 111 * @param theName the name of the class 112 * @return the class matching the name or null if no matches. 113 */ 114 public OClass getClassByName(String theName); 115 116 /**Checks if the ontology contains a class with the given name. 117 * @param theName name of a class 118 * @return true if the ontology contains a class with the name specified */ 119 public boolean containsClassByName(String theName); 120 121 /**Retrieves all classes as a set. 122 * @return set of all the classes in this ontology */ 123 public Set getClasses(); 124 125 /**Retireves an iterator over the classes, ordered according to the comparator. 126 * @param comp a comparator defining the order of iterating the classes 127 * @return an iterator over the classes 128 */ 129 public Iterator getClasses(Comparator comp); 130 131 /**Gets the top classes. 132 * @return set of the top classes of this ontology */ 133 public Set getTopClasses(); 134 135 /** Gets the taxonomic distance between 2 classes. 136 * @param class1 the first class 137 * @param class2 the second class 138 * @return the taxonomic distance between the 2 classes 139 */ 140 public int getTaxonomicDistance(OClass class1,OClass class2); 141 142 /** 143 * Checks the equality of two ontologies. 144 * @param o the other ontology 145 * @return true if the ontologies are considered equal, otherwise - false. 146 */ 147 public boolean equals(Object o); 148 149 /**Sets the modified flag. 150 * @param isModified sets this param as a value of 151 * the modified property of the ontology */ 152 public void setModified(boolean isModified); 153 154 /**Checks the modified flag. 155 * @return whether the ontology has been modified after the loading*/ 156 public boolean isModified(); 157 158 }//interface Ontology
|
Ontology |
|