Interface Capability
- All Superinterfaces:
Cloneable
,MetaDataObject
,Serializable
,XMLizable
- All Known Implementing Classes:
Capability_impl
A
Capability
defines an operation that an Resource can carry out. Each Capability
consists of the following information:
- The output types and features that the Resource can produce in the CAS
- The input types and features that are required
- The Sofa names of input Sofas that are required
- The Sofa names of output Sofas that the resource can produce
- Preconditions that must be satisfied in order for processing to begin. In a text analysis engine, the most common precondition is a check on the language of the document.
MetaDataObject
s, a Capability
may or may not be modifiable. An
application can find out by calling the MetaDataObject.isModifiable()
method.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInputFeature
(String aFeatureName) A convenience method that adds an input Feature to this Capability.void
addInputSofa
(String aSofaName) A convenience method that adds an input Sofa name to this Capability.void
addInputType
(String aTypeName, boolean aAllAnnotatorFeatures) A convenience method that adds an input Type to this Capability.void
addOutputFeature
(String aFeatureName) A convenience method that adds an output Feature to this Capability.void
addOutputSofa
(String aSofaName) A convenience method that adds an output Sofa name to this Capability.void
addOutputType
(String aTypeName, boolean aAllAnnotatorFeatures) A convenience method that adds an output Type to this Capability.void
addSupportedLanguage
(String aLanguage) A convenience method that adds a supported language to this Capability.String[]
String[]
A convenience method that analyzes the preconditions of thisCapability
and returns the ISO language identifiers that the Resource supports.String[]
A convenience method that analyzes the preconditions of thisCapability
and returns the MIME types that the Resource can take as input.String[]
Retrieves the preconditions that must be satisfied in order for the Resource to begin processing.void
removeSupportedLanguage
(String aLanguage) A convenience method that removes a supported language from this Capability.void
setDescription
(String aDescription) Sets the description of this Capability.void
setInputs
(TypeOrFeature... aInputs) Sets the inputs of this Capability.void
setInputSofas
(String... aInputSofas) Sets the input Sofa names.void
setLanguagesSupported
(String... aLanguageIDs) A convenience method that sets the languages that this Resource supports.void
setMimeTypesSupported
(String... aMimeTypes) A convenience method that sets the MIME types that this Resource can take as input.void
setOutputs
(TypeOrFeature... aOutputs) Sets the outputs of this Capability.void
setOutputSofas
(String... aOutputSofas) Sets the output Sofa names of this capabilityvoid
setPreconditions
(Precondition... aPreconditions) Sets thePrecondition
s of thisCapability
.Methods inherited from interface org.apache.uima.resource.metadata.MetaDataObject
clone, equals, getAttributeValue, getSourceUrl, getSourceUrlString, isModifiable, listAttributes, setAttributeValue, setSourceUrl
Methods inherited from interface org.apache.uima.util.XMLizable
buildFromXMLElement, buildFromXMLElement, toXML, toXML, toXML, toXML
-
Field Details
-
EMPTY_CAPABILITIES
-
-
Method Details
-
getDescription
String getDescription()- Returns:
- the description of this Capability.
-
setDescription
Sets the description of this Capability.- Parameters:
aDescription
- aDescription the description of this Capability.
-
getInputs
TypeOrFeature[] getInputs()- Returns:
- the inputs of this Capability as an array of references to Types or Features in this Resource's Type System.
-
getOutputs
TypeOrFeature[] getOutputs()- Returns:
- the outputs of this Capability as an array of references to Types or Features in this Resource's TypeSystem.
-
getInputSofas
String[] getInputSofas()- Returns:
- the inputs Sofa names of this Capability as an array of strings representing the SofAName
-
getOutputSofas
String[] getOutputSofas()- Returns:
- the output Sofa names of this Capability as an array of strings representing output SofA names
-
getPreconditions
Precondition[] getPreconditions()Retrieves the preconditions that must be satisfied in order for the Resource to begin processing.- Returns:
- an unmodifiable list of
Precondition
s.
-
getLanguagesSupported
String[] getLanguagesSupported()A convenience method that analyzes the preconditions of thisCapability
and returns the ISO language identifiers that the Resource supports. This is only meaningful when analyzing text documents.- Returns:
- an array of ISO language identifiers. An empty array means that the Resource claims to be language-independent.
-
getMimeTypesSupported
String[] getMimeTypesSupported()A convenience method that analyzes the preconditions of thisCapability
and returns the MIME types that the Resource can take as input.- Returns:
- an array of MIME types. This may be empty if the Resource does not declare MIME type preconditions.
-
setInputs
Sets the inputs of this Capability.- Parameters:
aInputs
- an array of references to Types or Features in this Resource's TypeSystem.
-
setOutputs
Sets the outputs of this Capability.- Parameters:
aOutputs
- an array of references to Types or Features in this Resource's TypeSystem.
-
setInputSofas
Sets the input Sofa names.- Parameters:
aInputSofas
- an array of strings containing SofA names
-
setOutputSofas
Sets the output Sofa names of this capability- Parameters:
aOutputSofas
- an array of strings containing SoFA name
-
setPreconditions
Sets thePrecondition
s of thisCapability
.- Parameters:
aPreconditions
- an array ofPrecondition
objects- Throws:
UIMA_UnsupportedOperationException
- if thisMetaDataObject
is not modifiable.
-
setLanguagesSupported
A convenience method that sets the languages that this Resource supports. This is only meaningful when text documents are analyzed.Calling this method affects the preconditions of this
Capability
. All other language support preconditions will be removed, but non-language related preconditions will be unaffected.- Parameters:
aLanguageIDs
- an array of ISO language identifiers. An empty array means that the Resource claims to be language-independent.
-
setMimeTypesSupported
A convenience method that sets the MIME types that this Resource can take as input.Calling this method affects the preconditions of this
Capability
. All other MIME type preconditions will be removed, but other preconditions will be unaffected.- Parameters:
aMimeTypes
- an array of MIME types. This may be empty if the Resource does not declare MIME type preconditions.
-
addInputType
A convenience method that adds an input Type to this Capability.- Parameters:
aTypeName
- the fully qualified type nameaAllAnnotatorFeatures
- if true, indicates that this Capability requires as input all features of this type that are specified in the same AnalysisEngine descriptor. If false, features must be explicitly declared by callingaddInputFeature(String)
.
-
addInputFeature
A convenience method that adds an input Feature to this Capability.- Parameters:
aFeatureName
- the fully qualified feature name
-
addOutputType
A convenience method that adds an output Type to this Capability.- Parameters:
aTypeName
- the fully qualified type nameaAllAnnotatorFeatures
- if true, indicates that this Capability declares as output all features of this type that are specified in the same AnalysisEngine descriptor. If false, features must be explicitly declared by callingaddOutputFeature(String)
.
-
addOutputFeature
A convenience method that adds an output Feature to this Capability.- Parameters:
aFeatureName
- the fully qualified feature name
-
addInputSofa
A convenience method that adds an input Sofa name to this Capability.- Parameters:
aSofaName
- the sofa to add to the inputs
-
addOutputSofa
A convenience method that adds an output Sofa name to this Capability.- Parameters:
aSofaName
- the sofa to add as an output
-
addSupportedLanguage
A convenience method that adds a supported language to this Capability.- Parameters:
aLanguage
- the ISO language identifier
-
removeSupportedLanguage
A convenience method that removes a supported language from this Capability.- Parameters:
aLanguage
- the ISO language identifier
-