|
GATE Version 3.1-2270 |
|||||||||
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
public class TaxonomyImpl
A Taxonomy Implementation Class
Field Summary | |
---|---|
static byte |
DIRECT_CLOSURE
denotes a direct closure(no transitivity) |
protected long |
lastGeneratedId
|
protected boolean |
modified
Whether the ontology has been modified after loading. once it became true it stays true till a save takes place |
protected boolean |
nullBuffers
Whether the ontology has been modified switches to true when null-ing and reinfering the subclasses and super classes and tops |
static byte |
TRANSITIVE_CLOSURE
denotes atransitive closure |
Fields inherited from class gate.creole.AbstractLanguageResource |
---|
dataStore, lrPersistentId |
Fields inherited from class gate.util.AbstractFeatureBearer |
---|
features |
Constructor Summary | |
---|---|
TaxonomyImpl()
|
Method Summary | |
---|---|
void |
addClass(TClass theClass)
Adds a class to the ontology. |
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. |
boolean |
equals(Object o)
Compares the id,uri and url of the ontology. |
protected 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 |
getDefaultNameSpace()
Gets the default name space for this ontology. |
String |
getId()
Gets the id of this ontology. |
String |
getLabel()
Retrieves the label of the ontology |
static Taxonomy |
getOntology(URL someUrl)
Gets a taxonomy by URL. |
int |
getTaxonomicDistance(TClass class1,
TClass class2)
calculates the taxonomic distance between two classes. note that the method is relatively big, but in case similar methods are developed for graph traversal, some parts of this method would naturally become separate methods/members. |
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()
Returns true of an LR has been modified since the last sync. |
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. currently could be implemented simpler but this implementation could be useful in the future |
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. this could be changed on request or made optional. |
void |
setComment(String theComment)
Sets the comment of this ontology. |
void |
setDefaultNameSpace(String theURI)
Sets the URI of the 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 |
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
protected long lastGeneratedId
protected boolean nullBuffers
protected boolean modified
Constructor Detail |
---|
public TaxonomyImpl()
Method Detail |
---|
public void addObjectModificationListener(ObjectModificationListener listener)
listener
- listener to be added.protected void fireObjectModificationEvent(Object source)
event
- the event to be firedpublic static Taxonomy getOntology(URL someUrl) throws ResourceInstantiationException
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 setDefaultNameSpace(String theURI)
Taxonomy
setDefaultNameSpace
in interface Taxonomy
theURI
- the URI to be setpublic String getDefaultNameSpace()
Taxonomy
getDefaultNameSpace
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
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
equals
in class Object
o
- another ontology to compare with
public String toString()
toString
in class Object
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()
AbstractLanguageResource
isModified
in interface Taxonomy
isModified
in interface LanguageResource
isModified
in class AbstractLanguageResource
public boolean isSubClassOf(String cls1, String cls2)
isSubClassOf
in interface Taxonomy
cls1
- the first classcls2
- the second classpublic boolean isDirectSubClassOf(String cls1, String cls2)
isDirectSubClassOf
in interface Taxonomy
cls1
- the first classcls2
- the second class
|
GATE Version 3.1-2270 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |