Package org.apache.uima.resource.metadata

# Interface Capability

All Superinterfaces:
  `Cloneable`, `MetaDataObject`, `Serializable`, `XMLizable`

All Known Implementing Classes:
  `Capability_impl`

public interface Capability extends MetaDataObject
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.

As with all `MetaDataObject`s, a `Capability` may or may not be modifiable. An application can find out by calling the `MetaDataObject.isModifiable()` method.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Capability[]`
  `EMPTY_CAPABILITIES`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `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`
  `getDescription()`
  Gets the description of this Capability.
  `TypeOrFeature[]`
  `getInputs()`
  Gets the inputs of this Capability.
  `String[]`
  `getInputSofas()`
  Gets the inputs Sofa names of this Capability.
  `String[]`
  `getLanguagesSupported()`
  A convenience method that analyzes the preconditions of this `Capability` and returns the ISO language identifiers that the Resource supports.
  `String[]`
  `getMimeTypesSupported()`
  A convenience method that analyzes the preconditions of this `Capability` and returns the MIME types that the Resource can take as input.
  `TypeOrFeature[]`
  `getOutputs()`
  Gets the outputs of this Capability.
  `String[]`
  `getOutputSofas()`
  Gets the output Sofa names of this Capability.
  `Precondition[]`
  `getPreconditions()`
  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 capability
  `void`
  `setPreconditions(Precondition[] aPreconditions)`
  Sets the `Precondition`s of this `Capability`.

  ### 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

    static final Capability[] EMPTY_CAPABILITIES

- ## Method Details

  - ### getDescription

    String getDescription()
    Gets the description of this Capability.
    Returns:
      the description of this Capability.

  - ### setDescription

    void setDescription(String aDescription)
    Sets the description of this Capability.
    Parameters:
      `aDescription` - aDescription the description of this Capability.

  - ### getInputs

    TypeOrFeature[] getInputs()
    Gets the inputs of this Capability.
    Returns:
      an array of references to Types or Features in this Resource's Type System.

  - ### getOutputs

    TypeOrFeature[] getOutputs()
    Gets the outputs of this Capability.
    Returns:
      an array of references to Types or Features in this Resource's TypeSystem.

  - ### getInputSofas

    String[] getInputSofas()
    Gets the inputs Sofa names of this Capability.
    Returns:
      an array of strings representing the SofAName

  - ### getOutputSofas

    String[] getOutputSofas()
    Gets the output Sofa names of this Capability.
    Returns:
      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 this `Capability` 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 this `Capability` 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

    void setInputs(TypeOrFeature[] aInputs)
    Sets the inputs of this Capability.
    Parameters:
      `aInputs` - an array of references to Types or Features in this Resource's TypeSystem.

  - ### setOutputs

    void setOutputs(TypeOrFeature[] aOutputs)
    Sets the outputs of this Capability.
    Parameters:
      `aOutputs` - an array of references to Types or Features in this Resource's TypeSystem.

  - ### setInputSofas

    void setInputSofas(String[] aInputSofas)
    Sets the input Sofa names.
    Parameters:
      `aInputSofas` - an array of strings containing SofA names

  - ### setOutputSofas

    void setOutputSofas(String[] aOutputSofas)
    Sets the output Sofa names of this capability
    Parameters:
      `aOutputSofas` - an array of strings containing SoFA name

  - ### setPreconditions

    void setPreconditions(Precondition[] aPreconditions)
    Sets the `Precondition`s of this `Capability`.
    Parameters:
      `aPreconditions` - an array of `Precondition` objects
    Throws:
      `UIMA_UnsupportedOperationException` - if this `MetaDataObject` is not modifiable.

  - ### setLanguagesSupported

    void setLanguagesSupported(String[] aLanguageIDs)
    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

    void setMimeTypesSupported(String[] aMimeTypes)
    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

    void addInputType(String aTypeName, boolean aAllAnnotatorFeatures)
    A convenience method that adds an input Type to this Capability.
    Parameters:
      `aTypeName` - the fully qualified type name
      `aAllAnnotatorFeatures` - 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 calling `addInputFeature(String)`.

  - ### addInputFeature

    void addInputFeature(String aFeatureName)
    A convenience method that adds an input Feature to this Capability.
    Parameters:
      `aFeatureName` - the fully qualified feature name

  - ### addOutputType

    void addOutputType(String aTypeName, boolean aAllAnnotatorFeatures)
    A convenience method that adds an output Type to this Capability.
    Parameters:
      `aTypeName` - the fully qualified type name
      `aAllAnnotatorFeatures` - 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 calling `addOutputFeature(String)`.

  - ### addOutputFeature

    void addOutputFeature(String aFeatureName)
    A convenience method that adds an output Feature to this Capability.
    Parameters:
      `aFeatureName` - the fully qualified feature name

  - ### addInputSofa

    void addInputSofa(String aSofaName)
    A convenience method that adds an input Sofa name to this Capability.
    Parameters:
      `aSofaName` - the sofa to add to the inputs

  - ### addOutputSofa

    void addOutputSofa(String aSofaName)
    A convenience method that adds an output Sofa name to this Capability.
    Parameters:
      `aSofaName` - the sofa to add as an output

  - ### addSupportedLanguage

    void addSupportedLanguage(String aLanguage)
    A convenience method that adds a supported language to this Capability.
    Parameters:
      `aLanguage` - the ISO language identifier

  - ### removeSupportedLanguage

    void removeSupportedLanguage(String aLanguage)
    A convenience method that removes a supported language from this Capability.
    Parameters:
      `aLanguage` - the ISO language identifier