GATE
Version 3.1-2270

gate.creole.ontology.jena
Class JenaOntologyImpl

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractLanguageResource
              extended by com.ontotext.gate.ontology.TaxonomyImpl
                  extended by com.ontotext.gate.ontology.OntologyImpl
                      extended by gate.creole.ontology.jena.JenaOntologyImpl
All Implemented Interfaces:
Ontology, Taxonomy, ActionsPublisher, LanguageResource, Resource, FeatureBearer, NameBearer, Serializable

public class JenaOntologyImpl
extends OntologyImpl
implements ActionsPublisher

An implementation for GATE Ontologies based on Jena2

Author:
Valentin Tablan
See Also:
Serialized Form

Nested Class Summary
protected  class JenaOntologyImpl.CleanUpAction
           
protected  class JenaOntologyImpl.LoadOntologyDataAction
           
protected  class JenaOntologyImpl.SaveOntologyAction
           
 
Field Summary
protected  List actionsList
           
static int DAML
          Constant for DAML ontology type.
protected  URL damlFileURL
           
protected  String language
           
static int OWL_DL
          Constant for Owl-DL ontology type.
static int OWL_FULL
          Constant for Owl-Full ontology type.
static int OWL_LITE
          Constant for Owl-Lite ontology type.
protected  URL owlDlFileURL
           
protected  URL owlFullFileURL
           
protected  URL owlLiteFileURL
           
static int RDFS
          Constant for RDF-S ontology type.
protected  URL rdfsFileURL
           
 
Fields inherited from class com.ontotext.gate.ontology.OntologyImpl
instances, instancesByName, propertyDefinitionSet
 
Fields inherited from class com.ontotext.gate.ontology.TaxonomyImpl
DIRECT_CLOSURE, lastGeneratedId, modified, nullBuffers, TRANSITIVE_CLOSURE
 
Fields inherited from class gate.creole.AbstractLanguageResource
dataStore, lrPersistentId
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Constructor Summary
JenaOntologyImpl()
           
 
Method Summary
 void cleanup()
          Clear the internal state of the resource
protected  Set convertoToGateClasses(Iterator jenaIterator)
           
 List getActions()
          Returns a list of Action objects.
 URL getDamlFileURL()
           
 String getLanguage()
           
 URL getOwlDlFileURL()
           
 URL getOwlFullFileURL()
           
 URL getOwlLiteFileURL()
           
 URL getRdfsFileURL()
           
 Resource init()
          Initialises this resource, and returns it.
 void load()
          Loads the ontology from an external file.
 void load(URL inputURL, int ontologyType)
          Loads ontological data of a given type from a URL.
 void save(File outputFile, int ontologyType)
          Saves the ontology to a file.
 void setDamlFileURL(URL damlFileURL)
           
 void setLanguage(String language)
           
 void setOwlDlFileURL(URL owlDlFileURL)
           
 void setOwlFullFileURL(URL owlFullFileURL)
           
 void setOwlLiteFileURL(URL owlLiteFileURL)
           
 void setRdfsFileURL(URL rdfsFileURL)
           
protected  void toGateClassRec(com.hp.hpl.jena.ontology.OntClass jenaClass, OClass parent)
          Converts a Jena class and all its subclasses to GATE classes and adds them to this ontology.
protected  void toJenaClassRec(OClass aGateClass, com.hp.hpl.jena.ontology.OntModel jenaModel, com.hp.hpl.jena.ontology.OntClass parentClass)
          Converts a GATE class and all its subclasses (recursively) to Jena classes and adds them to the Jena model provided.
 
Methods inherited from class com.ontotext.gate.ontology.OntologyImpl
addDatatypeProperty, addDatatypeProperty, addInstance, addInstance, addObjectProperty, addObjectProperty, addProperty, addProperty, addPropertyDefinition, addSymmetricProperty, addSymmetricProperty, addTransitiveProperty, addTransitiveProperty, createClass, getDirectInstances, getInstanceByName, getInstances, getInstances, getPropertyDefinitionByName, getPropertyDefinitions, reduceToMostSpecificClasses, removeInstance
 
Methods inherited from class com.ontotext.gate.ontology.TaxonomyImpl
addClass, addObjectModificationListener, containsClassByName, equals, fireObjectModificationEvent, getClassByName, getClasses, getClasses, getComment, getDefaultNameSpace, getId, getLabel, getOntology, getTaxonomicDistance, getTopClasses, getURL, getVersion, isDirectSubClassOf, isModified, isSubClassOf, reinfer, removeClass, setComment, setDefaultNameSpace, setId, setLabel, setModified, setURL, setVersion, store, toString
 
Methods inherited from class gate.creole.AbstractLanguageResource
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.creole.ontology.Taxonomy
addClass, containsClassByName, equals, getClassByName, getClasses, getClasses, getComment, getDefaultNameSpace, getId, getLabel, getTaxonomicDistance, getTopClasses, getURL, getVersion, isDirectSubClassOf, isModified, isSubClassOf, removeClass, setComment, setDefaultNameSpace, setId, setLabel, setModified, setURL, setVersion, store
 
Methods inherited from interface gate.LanguageResource
getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, sync
 
Methods inherited from interface gate.Resource
getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Field Detail

owlLiteFileURL

protected URL owlLiteFileURL

owlDlFileURL

protected URL owlDlFileURL

owlFullFileURL

protected URL owlFullFileURL

rdfsFileURL

protected URL rdfsFileURL

damlFileURL

protected URL damlFileURL

language

protected String language

actionsList

protected List actionsList

OWL_LITE

public static final int OWL_LITE
Constant for Owl-Lite ontology type.

See Also:
Constant Field Values

OWL_DL

public static final int OWL_DL
Constant for Owl-DL ontology type.

See Also:
Constant Field Values

OWL_FULL

public static final int OWL_FULL
Constant for Owl-Full ontology type.

See Also:
Constant Field Values

RDFS

public static final int RDFS
Constant for RDF-S ontology type.

See Also:
Constant Field Values

DAML

public static final int DAML
Constant for DAML ontology type.

See Also:
Constant Field Values
Constructor Detail

JenaOntologyImpl

public JenaOntologyImpl()
Method Detail

init

public Resource init()
              throws ResourceInstantiationException
Description copied from class: TaxonomyImpl
Initialises this resource, and returns it.

Specified by:
init in interface Resource
Overrides:
init in class TaxonomyImpl
Throws:
ResourceInstantiationException

getActions

public List getActions()
Description copied from interface: ActionsPublisher
Returns a list of Action objects. This method will be called everytime a menu for this resource needs to be built, thus allowing for dynamic updates to the list of actions. A null value in this list will cause a separator to be created.

Specified by:
getActions in interface ActionsPublisher
Returns:
a List of Actions.

load

public void load()
          throws ResourceInstantiationException
Loads the ontology from an external file.

Specified by:
load in interface Taxonomy
Overrides:
load in class TaxonomyImpl
Throws:
ResourceInstantiationException

load

public void load(URL inputURL,
                 int ontologyType)
          throws ResourceInstantiationException
Loads ontological data of a given type from a URL.

Parameters:
inputURL - the URL for the file to be read.
ontologyType - the type of ontology (one of OWL_LITE, OWL_DL, OWL_FULL, RDFS or DAML).
Throws:
ResourceInstantiationException

save

public void save(File outputFile,
                 int ontologyType)
Saves the ontology to a file.

Parameters:
outputFile - the file to write to.
ontologyType - the output format to write.

toJenaClassRec

protected void toJenaClassRec(OClass aGateClass,
                              com.hp.hpl.jena.ontology.OntModel jenaModel,
                              com.hp.hpl.jena.ontology.OntClass parentClass)
Converts a GATE class and all its subclasses (recursively) to Jena classes and adds them to the Jena model provided.

Parameters:
aClass - the GATE class to be converted.
jenaModel - the Jena model to be populated.
parentClass - the parent of the GATE class in the Jena model. If null then the created Jena class will be marked as a top class.

convertoToGateClasses

protected Set convertoToGateClasses(Iterator jenaIterator)

toGateClassRec

protected void toGateClassRec(com.hp.hpl.jena.ontology.OntClass jenaClass,
                              OClass parent)
Converts a Jena class and all its subclasses to GATE classes and adds them to this ontology.

Parameters:
aClass - the Class in Jena model
parent - the parent class for the class to be added in this ontology.

cleanup

public void cleanup()
Description copied from class: AbstractLanguageResource
Clear the internal state of the resource

Specified by:
cleanup in interface Resource
Overrides:
cleanup in class AbstractLanguageResource

getLanguage

public String getLanguage()
Returns:
Returns the language.

setLanguage

public void setLanguage(String language)
Parameters:
language - The language to set.

getDamlFileURL

public URL getDamlFileURL()
Returns:
Returns the damlFileURL.

setDamlFileURL

public void setDamlFileURL(URL damlFileURL)
Parameters:
damlFileURL - The damlFileURL to set.

getOwlDlFileURL

public URL getOwlDlFileURL()
Returns:
Returns the owlDlFileURL.

setOwlDlFileURL

public void setOwlDlFileURL(URL owlDlFileURL)
Parameters:
owlDlFileURL - The owlDlFileURL to set.

getOwlFullFileURL

public URL getOwlFullFileURL()
Returns:
Returns the owlFullFileURL.

setOwlFullFileURL

public void setOwlFullFileURL(URL owlFullFileURL)
Parameters:
owlFullFileURL - The owlFullFileURL to set.

getOwlLiteFileURL

public URL getOwlLiteFileURL()
Returns:
Returns the owlLiteFileURL.

setOwlLiteFileURL

public void setOwlLiteFileURL(URL owlLiteFileURL)
Parameters:
owlLiteFileURL - The owlLiteFileURL to set.

getRdfsFileURL

public URL getRdfsFileURL()
Returns:
Returns the rdfsFileURL.

setRdfsFileURL

public void setRdfsFileURL(URL rdfsFileURL)
Parameters:
rdfsFileURL - The rdfsFileURL to set.

GATE
Version 3.1-2270