gate.creole
Class AnnotationSchema

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractLanguageResource
              extended by gate.creole.AnnotationSchema
All Implemented Interfaces:
LanguageResource, Resource, FeatureBearer, NameBearer, Serializable

public class AnnotationSchema
extends AbstractLanguageResource

This class handles annotation schemas.An annotation schema is a representation of an annotation, together with its types and their attributes, values and types.

See Also:
Serialized Form

Field Summary
protected  String annotationName
          The name of the annotation
protected  Set<FeatureSchema> featureSchemaSet
          Schemas for the attributes
static String FILE_URL_PARAM_NAME
           
protected  org.jdom.Namespace namespace
          The namepsace used in the xml file
protected  URL xmlFileUrl
          The xml file URL of the resource
 
Fields inherited from class gate.creole.AbstractLanguageResource
dataStore, lrPersistentId
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Constructor Summary
AnnotationSchema()
          Constructs an annotation schema.
 
Method Summary
 void createAndAddFeatureSchemaObject(org.jdom.Element anAttributeElement)
          This method creates and adds a FeatureSchema object to the current AnnotationSchema one.
 void fromXSchema(InputStream anXSchemaInputStream)
          Creates an AnnotationSchema object from an XSchema file
 void fromXSchema(URL anXSchemaURL)
          Creates an AnnotationSchema object from an XSchema file
 String getAnnotationName()
          Returns the value of annotation name
 FeatureSchema getFeatureSchema(String featureName)
           
 Set<FeatureSchema> getFeatureSchemaSet()
          Returns the feature schema set
 URL getXmlFileUrl()
          Get method for the resource xml file URL
 Resource init()
          Initialise this resource, and return it.
 void setAnnotationName(String annotationName)
          Sets the annotation name
 void setFeatureSchemaSet(Set<FeatureSchema> featureSchemaSet)
          Sets the feature schema set
 void setXmlFileUrl(URL xmlFileUrl)
          Set method for the resource xml file URL
 String toXSchema()
           
 
Methods inherited from class gate.creole.AbstractLanguageResource
cleanup, getDataStore, getLRPersistenceId, getParent, isModified, setDataStore, setLRPersistenceId, setParent, sync
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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

FILE_URL_PARAM_NAME

public static final String FILE_URL_PARAM_NAME
See Also:
Constant Field Values

annotationName

protected String annotationName
The name of the annotation


featureSchemaSet

protected Set<FeatureSchema> featureSchemaSet
Schemas for the attributes


xmlFileUrl

protected URL xmlFileUrl
The xml file URL of the resource


namespace

protected org.jdom.Namespace namespace
The namepsace used in the xml file

Constructor Detail

AnnotationSchema

public AnnotationSchema()
Constructs an annotation schema.

Method Detail

getAnnotationName

public String getAnnotationName()
Returns the value of annotation name


setAnnotationName

public void setAnnotationName(String annotationName)
Sets the annotation name


getFeatureSchemaSet

public Set<FeatureSchema> getFeatureSchemaSet()
Returns the feature schema set


setFeatureSchemaSet

public void setFeatureSchemaSet(Set<FeatureSchema> featureSchemaSet)
Sets the feature schema set


getFeatureSchema

public FeatureSchema getFeatureSchema(String featureName)
Returns:
a FeatureSchema object from featureSchemaSet, given a feature name.It will return null if the feature name is not found.

init

public Resource init()
              throws ResourceInstantiationException
Initialise this resource, and return it. If the schema XML source file URL has been set, it will construct itself from that file.

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

setXmlFileUrl

public void setXmlFileUrl(URL xmlFileUrl)
Set method for the resource xml file URL


getXmlFileUrl

public URL getXmlFileUrl()
Get method for the resource xml file URL


fromXSchema

public void fromXSchema(URL anXSchemaURL)
                 throws ResourceInstantiationException
Creates an AnnotationSchema object from an XSchema file

Parameters:
anXSchemaURL - the URL where to find the XSchema file
Throws:
ResourceInstantiationException

fromXSchema

public void fromXSchema(InputStream anXSchemaInputStream)
                 throws ResourceInstantiationException
Creates an AnnotationSchema object from an XSchema file

Parameters:
anXSchemaInputStream - the Input Stream containing the XSchema file
Throws:
ResourceInstantiationException

createAndAddFeatureSchemaObject

public void createAndAddFeatureSchemaObject(org.jdom.Element anAttributeElement)
This method creates and adds a FeatureSchema object to the current AnnotationSchema one.

Parameters:
anAttributeElement - is an XSchema attribute element

toXSchema

public String toXSchema()
Returns:
a String containing the XSchema document representing an AnnotationSchema object.