|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgate.util.AbstractFeatureBearer
gate.creole.AbstractResource
gate.creole.AbstractLanguageResource
com.ontotext.gate.ontology.TaxonomyImpl
An Ontology Implementation Class
Field Summary | |
private Set |
classes
|
private Map |
classesByName
|
private String |
comment
|
static byte |
DIRECT_CLOSURE
denotes a direct closure(no transitivity) |
private String |
id
|
private String |
label
|
protected long |
lastGeneratedId
|
private static Set |
listeners
Object Modification Listeners |
protected boolean |
modified
Whether the ontology has been modified after loading. |
private String |
name
|
protected boolean |
nullBuffers
Whether the ontology has been modified switches to true when null-ing and reinfering the subclasses and super classes and tops |
private String |
sourceURI
|
private Set |
tops
|
static byte |
TRANSITIVE_CLOSURE
denotes atransitive closure |
private URL |
url
|
private String |
version
|
Fields inherited from class gate.creole.AbstractLanguageResource |
dataStore, lrPersistentId |
Fields inherited from class gate.creole.AbstractResource |
|
Fields inherited from class gate.util.AbstractFeatureBearer |
features |
Constructor Summary | |
TaxonomyImpl()
|
Method Summary | |
void |
addClass(TClass theClass)
Adds a class to the ontology. |
static void |
addObjectModificationListener(ObjectModificationListener listener)
Adds an object modification listener. |
boolean |
containsClassByName(String theName)
Checks if the ontology contains a class with the given name. |
TClass |
createClass(String aName,
String aComment)
Creates a new OClass and returns it. |
private void |
determineTops()
|
boolean |
equals(Object o)
Compares the id,uri and url of the ontology. |
protected static void |
fireObjectModificationEvent(Object source)
Fires an object modification event. |
TClass |
getClassByName(String theName)
Retrieves a class by its name. |
Set |
getClasses()
Retrieves all classes as a set. |
Iterator |
getClasses(Comparator comp)
Retireves an iterator over the classes, ordered according to the comparator. |
String |
getComment()
Gets the comment of this ontology. |
String |
getId()
Gets the id of this ontology. |
String |
getLabel()
Retrieves the label of the ontology |
Taxonomy |
getOntology(URL someUrl)
Gets taxonomy by URL. |
String |
getSourceURI()
Gets the source URI. |
int |
getTaxonomicDistance(TClass class1,
TClass class2)
calculates the taxonomic distance between two classes. |
Set |
getTopClasses()
Gets the top classes. |
URL |
getURL()
Gets the url of this ontology |
String |
getVersion()
Gets the version of this ontology. |
Resource |
init()
Initialises this resource, and returns it. |
boolean |
isDirectSubClassOf(String cls1,
String cls2)
Check for subclass relation with direct closure |
boolean |
isModified()
Checks the modified flag. |
boolean |
isSubClassOf(String cls1,
String cls2)
Check for subclass relation with transitive closure |
void |
load()
Loads this ontology. |
protected void |
reinfer()
Called when the ontology has been modified to re-infer all sub/super classes, tops, etc. |
void |
removeClass(TClass theClass)
note: if a class is deleted and there aresome subclasses of this class which lack any other super classes : then they become top classes. |
void |
setComment(String theComment)
Sets the comment of this ontology. |
void |
setId(String theID)
Sets the id of this ontology. |
void |
setLabel(String theLabel)
Sets the label of the ontology |
void |
setModified(boolean isModified)
Sets the modified flag. |
void |
setSourceURI(String theURI)
Sets the URI of the ontology |
void |
setURL(URL aUrl)
Set the url of this ontology |
void |
setVersion(String theVersion)
Sets version to this ontology. |
void |
store()
Stores this ontology. |
String |
toString()
|
Methods inherited from class gate.creole.AbstractLanguageResource |
cleanup, getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, sync |
Methods inherited from class gate.creole.AbstractResource |
checkParameterValues, getBeanInfo, getName, getParameterValue, getParameterValue, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners |
Methods inherited from class gate.util.AbstractFeatureBearer |
getFeatures, setFeatures |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gate.LanguageResource |
getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, sync |
Methods inherited from interface gate.Resource |
cleanup, getParameterValue, setParameterValue, setParameterValues |
Methods inherited from interface gate.util.FeatureBearer |
getFeatures, setFeatures |
Methods inherited from interface gate.util.NameBearer |
getName, setName |
Field Detail |
public static final byte DIRECT_CLOSURE
public static final byte TRANSITIVE_CLOSURE
private static Set listeners
private String label
private URL url
private String sourceURI
private String version
private String id
private String comment
private Map classesByName
private Set classes
private Set tops
private String name
protected long lastGeneratedId
protected boolean nullBuffers
protected boolean modified
Constructor Detail |
public TaxonomyImpl()
Method Detail |
public static void addObjectModificationListener(ObjectModificationListener listener)
listener
- listener to be added.protected static void fireObjectModificationEvent(Object source)
public Taxonomy getOntology(URL someUrl) throws ResourceInstantiationException
Taxonomy
getOntology
in interface Taxonomy
someUrl
- the url of the taxonomy
ResourceInstantiationException
- if something gets wrong with the loadingpublic Resource init() throws ResourceInstantiationException
init
in interface Resource
init
in class AbstractResource
ResourceInstantiationException
public URL getURL()
Taxonomy
getURL
in interface Taxonomy
public void setURL(URL aUrl)
Taxonomy
setURL
in interface Taxonomy
aUrl
- the url to be setpublic void setLabel(String theLabel)
setLabel
in interface Taxonomy
theLabel
- the label to be setpublic String getLabel()
getLabel
in interface Taxonomy
public void load() throws ResourceInstantiationException
Taxonomy
load
in interface Taxonomy
ResourceInstantiationException
public void store() throws ResourceInstantiationException
Taxonomy
store
in interface Taxonomy
ResourceInstantiationException
public void setSourceURI(String theURI)
Taxonomy
setSourceURI
in interface Taxonomy
theURI
- the URI to be setpublic String getSourceURI()
Taxonomy
getSourceURI
in interface Taxonomy
public void setVersion(String theVersion)
Taxonomy
setVersion
in interface Taxonomy
theVersion
- the version to be setpublic String getVersion()
Taxonomy
getVersion
in interface Taxonomy
public String getId()
Taxonomy
getId
in interface Taxonomy
public void setId(String theID)
Taxonomy
setId
in interface Taxonomy
theID
- the id to be setpublic String getComment()
Taxonomy
getComment
in interface Taxonomy
public void setComment(String theComment)
Taxonomy
setComment
in interface Taxonomy
theComment
- the comment to be setpublic TClass createClass(String aName, String aComment)
Taxonomy
createClass
in interface Taxonomy
aName
- the name of this classaComment
- the comment of this class
public void removeClass(TClass theClass)
removeClass
in interface Taxonomy
theClass
- the class to be removedpublic void addClass(TClass theClass)
Taxonomy
addClass
in interface Taxonomy
theClass
- the class to be addedpublic TClass getClassByName(String theName)
Taxonomy
getClassByName
in interface Taxonomy
theName
- the name of the class
public boolean containsClassByName(String theName)
Taxonomy
containsClassByName
in interface Taxonomy
theName
- name of a class
public Set getClasses()
Taxonomy
getClasses
in interface Taxonomy
public Iterator getClasses(Comparator comp)
Taxonomy
getClasses
in interface Taxonomy
comp
- a comparator defining the order of iterating the classes
private void determineTops()
public Set getTopClasses()
Taxonomy
getTopClasses
in interface Taxonomy
public int getTaxonomicDistance(TClass class1, TClass class2)
getTaxonomicDistance
in interface Taxonomy
class1
- the first classclass2
- the second class
public boolean equals(Object o)
equals
in interface Taxonomy
o
- another ontology to compare with
public String toString()
protected void reinfer()
public void setModified(boolean isModified)
Taxonomy
setModified
in interface Taxonomy
isModified
- sets this param as a value of
the modified property of the ontologypublic boolean isModified()
Taxonomy
isModified
in interface Taxonomy
isModified
in class AbstractLanguageResource
public boolean isSubClassOf(String cls1, String cls2) throws NoSuchClosureTypeException
isSubClassOf
in interface Taxonomy
cls1
- the first classcls2
- the second class
NoSuchClosureTypeException
public boolean isDirectSubClassOf(String cls1, String cls2) throws NoSuchClosureTypeException
isDirectSubClassOf
in interface Taxonomy
cls1
- the first classcls2
- the second class
NoSuchClosureTypeException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |