gate.creole.ontology
Interface Ontology

All Superinterfaces:
FeatureBearer, LanguageResource, NameBearer, Resource, Serializable
All Known Subinterfaces:
KnowledgeBase
All Known Implementing Classes:
ProtegeProjectName

public interface Ontology
extends LanguageResource

Defines the interface of an ontology


Method Summary
 void addClass(OClass theClass)
          Adds a class to the ontology.
 boolean containsClassByName(String theName)
          Checks if the ontology contains a class with the given name.
 OClass createClass(String aName, String aComment)
          Creates a new OClass and returns it.
 boolean equals(Object o)
          Checks the equality of two ontologies.
 OClass 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()
          Gets the label.
 Ontology getOntology(URL someUrl)
          Gets ontology by URL.
 String getSourceURI()
          Gets the source URI.
 int getTaxonomicDistance(OClass class1, OClass class2)
          Gets the taxonomic distance between 2 classes.
 Set getTopClasses()
          Gets the top classes.
 URL getURL()
          Gets the url of this ontology
 String getVersion()
          Gets the version of this ontology.
 boolean isModified()
          Checks the modified flag.
 void load()
          Loads this ontology.
 void removeClass(OClass theClass)
          Removes a class from this ontology.
 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.
 
Methods inherited from interface gate.LanguageResource
getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, sync
 
Methods inherited from interface gate.Resource
cleanup, getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Method Detail

getOntology

public Ontology getOntology(URL someUrl)
                     throws ResourceInstantiationException
Gets ontology by URL. The ontology will be searched first among the LRs and afterwards loaded by the URL if not found

Parameters:
someUrl - the url of the ontology
Returns:
the retrieved or loaded ontology
Throws:
ResourceInstantiationException - if something gets wrong with the loading

getLabel

public String getLabel()
Gets the label.

Returns:
the label of the ontology

setLabel

public void setLabel(String theLabel)
Sets the label of the ontology.

Parameters:
theLabel - the label to be set

getURL

public URL getURL()
Gets the url of this ontology

Returns:
the url of this ontology

setURL

public void setURL(URL aUrl)
Set the url of this ontology

Parameters:
aUrl - the url to be set

load

public void load()
          throws ResourceInstantiationException
Loads this ontology. According to different storages - different implementations are expected. Should take care of the modifiedAfterLoading member

Throws:
ResourceInstantiationException

store

public void store()
           throws ResourceInstantiationException
Stores this ontology. According to different storages - different implementations are expected. Should take care of the modifiedAfterLoading member

Throws:
ResourceInstantiationException

setSourceURI

public void setSourceURI(String theURI)
Sets the URI of the ontology

Parameters:
theURI - the URI to be set

getSourceURI

public String getSourceURI()
Gets the source URI.

Returns:
the URI of this ontology

setVersion

public void setVersion(String theVersion)
Sets version to this ontology.

Parameters:
theVersion - the version to be set

getVersion

public String getVersion()
Gets the version of this ontology.

Returns:
the version of this ontology

getId

public String getId()
Gets the id of this ontology.

Returns:
the id of this ontology

setId

public void setId(String theId)
Sets the id of this ontology.

Parameters:
theId - the id to be set

getComment

public String getComment()
Gets the comment of this ontology.

Returns:
the comment of this ontology

setComment

public void setComment(String theComment)
Sets the comment of this ontology.

Parameters:
theComment - the comment to be set

createClass

public OClass createClass(String aName,
                          String aComment)
Creates a new OClass and returns it.

Parameters:
aName - the name of this class
aComment - the comment of this class
Returns:
the newly created class

removeClass

public void removeClass(OClass theClass)
Removes a class from this ontology.

Parameters:
theClass - the class to be removed

addClass

public void addClass(OClass theClass)
Adds a class to the ontology.

Parameters:
theClass - the class to be added

getClassByName

public OClass getClassByName(String theName)
Retrieves a class by its name.

Parameters:
theName - the name of the class
Returns:
the class matching the name or null if no matches.

containsClassByName

public boolean containsClassByName(String theName)
Checks if the ontology contains a class with the given name.

Parameters:
theName - name of a class
Returns:
true if the ontology contains a class with the name specified

getClasses

public Set getClasses()
Retrieves all classes as a set.

Returns:
set of all the classes in this ontology

getClasses

public Iterator getClasses(Comparator comp)
Retireves an iterator over the classes, ordered according to the comparator.

Parameters:
comp - a comparator defining the order of iterating the classes
Returns:
an iterator over the classes

getTopClasses

public Set getTopClasses()
Gets the top classes.

Returns:
set of the top classes of this ontology

getTaxonomicDistance

public int getTaxonomicDistance(OClass class1,
                                OClass class2)
Gets the taxonomic distance between 2 classes.

Parameters:
class1 - the first class
class2 - the second class
Returns:
the taxonomic distance between the 2 classes

equals

public boolean equals(Object o)
Checks the equality of two ontologies.

Parameters:
o - the other ontology
Returns:
true if the ontologies are considered equal, otherwise - false.

setModified

public void setModified(boolean isModified)
Sets the modified flag.

Parameters:
isModified - sets this param as a value of the modified property of the ontology

isModified

public boolean isModified()
Checks the modified flag.

Specified by:
isModified in interface LanguageResource
Returns:
whether the ontology has been modified after the loading