org.apache.uima.analysis_engine
Interface ResultSpecification

All Superinterfaces:
Cloneable, Serializable, XMLizable

public interface ResultSpecification
extends XMLizable, Serializable, Cloneable

A ResultSpecification is a set of desired outputs from a Analysis Engine or Annotator. Each output is a reference to either a Type or a Feature.

Annotator implementations may, but are not required to, check the ResultSpecification passed as a parameter to their AnalysisComponent.setResultSpecification(ResultSpecification)}, and produce only those Types and Features that are part of the ResultSpecification. Annotators can call the containsType(String) and containsFeature(String) to determine which types and features belong to this ResultSpecification and should be produced.

ResultSpecifications are language enabled to allow different values to be set and returned, based on a ISO language identifier. There are two styles of the get and add methods: one takes an additional parameter specifying the language(s), the other doesn't have this parameter. Using the one without the language parameter is equivalent to using the "x-unspecified" language. The functions that add ResultSpecifications can do this for multiple languages at once because the language parameter is an array of strings. The functions to retrieve a ResultSpecification specify one particular language.

If you query the ResultSpecification with a language with a country code (e.g. en-US), results for the base language (en) will be returned as well.


Method Summary
 void addCapabilities(Capability[] aCapabilities)
          Adds the output types and features from the specified capabilities to this ResultSpecification.
 void addCapabilities(Capability[] aCapabilities, boolean aOutputs)
          Adds either outputs or inputs from the specified capabilities to this ResultSpecification.
 void addResultFeature(String aFullFeatureName)
          Adds a Feature to this ResultSpecification for the language x-unspecified.
 void addResultFeature(String aFullFeatureName, String[] aLanguageIDs)
          Adds a Feature to this ResultSpecification for the specified languages.
 void addResultType(String aTypeName, boolean aAllAnnotatorFeatures)
          Adds an Type to this ResultSpecification for the language x-unspecified.
 void addResultType(String aTypeName, boolean aAllAnnotatorFeatures, String[] aLanguageIDs)
          Adds an Type to this ResultSpecification for the specified languages.
 void addResultTypeOrFeature(TypeOrFeature aTypeOrFeature)
          Adds a Result Type or Feature to this ResultSpecification for the language x-unspecified.
 void addResultTypeOrFeature(TypeOrFeature aTypeOrFeature, String[] aLanguageIDs)
          Adds a Result Type or Feature to this ResultSpecification for the specified languages.
 Object clone()
          create a copy of the current object
 void compile(TypeSystem aTypeSystem)
          Compiles this ResultSpecification using a specific TypeSystem.
 boolean containsFeature(String aFullFeatureName)
          Determines whether this ResultSpecification contains the specified Feature for the language x-unspecified.
 boolean containsFeature(String aFullFeatureName, String aLanguage)
          Determines whether this ResultSpecification contains the specified Feature for the specified language.
 boolean containsType(String aTypeName)
          Determines whether this ResultSpecification contains the specified Type for the language x-unspecified.
 boolean containsType(String aTypeName, String aLanguage)
          Determines whether this ResultSpecification contains the specified Type for the specified language
 TypeOrFeature[] getResultTypesAndFeatures()
          Retrieves the Types and Features that the AnalysisEngine or Annotator is requested to produce for the default language x-unspecified.
 TypeOrFeature[] getResultTypesAndFeatures(String language)
          Retrieves the Types and Features that the AnalysisEngine or Annotator is requested to produce for the specified language.
 void removeTypeOrFeature(TypeOrFeature aTypeOrFeature)
          removes the specified TypeOrFeature from this ResultSpecification.
 void setResultTypesAndFeatures(TypeOrFeature[] aTypesAndFeatures)
          Sets the Types and Features that the AnalysisEngine or Annotator is requested to produce for the language x-unspecified.
 void setResultTypesAndFeatures(TypeOrFeature[] aTypesAndFeatures, String[] aLanguageIDs)
          Sets the Types and Features that the AnalysisEngine or Annotator is requested to produce for the specified languages.
 
Methods inherited from interface org.apache.uima.util.XMLizable
buildFromXMLElement, buildFromXMLElement, toXML, toXML, toXML, toXML
 

Method Detail

getResultTypesAndFeatures

TypeOrFeature[] getResultTypesAndFeatures()
Retrieves the Types and Features that the AnalysisEngine or Annotator is requested to produce for the default language x-unspecified.

Returns:
an array of TypeOrFeature objects that define the result types and features for the language x-unspecified.

getResultTypesAndFeatures

TypeOrFeature[] getResultTypesAndFeatures(String language)
Retrieves the Types and Features that the AnalysisEngine or Annotator is requested to produce for the specified language.

Returns:
an array of TypeOrFeature objects that define the result types and features for the specified language.

setResultTypesAndFeatures

void setResultTypesAndFeatures(TypeOrFeature[] aTypesAndFeatures)
Sets the Types and Features that the AnalysisEngine or Annotator is requested to produce for the language x-unspecified.

Parameters:
aTypesAndFeatures - an array of TypeOrFeature objects that define the result types and features for the language x-unspecified.

setResultTypesAndFeatures

void setResultTypesAndFeatures(TypeOrFeature[] aTypesAndFeatures,
                               String[] aLanguageIDs)
Sets the Types and Features that the AnalysisEngine or Annotator is requested to produce for the specified languages.

Parameters:
aTypesAndFeatures - an array of TypeOrFeature objects that define the result types and features for the specified languages.
aLanguageIDs - an array of ISO language identifiers.

addResultTypeOrFeature

void addResultTypeOrFeature(TypeOrFeature aTypeOrFeature)
Adds a Result Type or Feature to this ResultSpecification for the language x-unspecified. If the current ToF is already contained in the result spec, the language specification for this ToF will be replaced with x-unspecified.

Parameters:
aTypeOrFeature - the Type or Feature to add for the language x-unspecified

addResultTypeOrFeature

void addResultTypeOrFeature(TypeOrFeature aTypeOrFeature,
                            String[] aLanguageIDs)
Adds a Result Type or Feature to this ResultSpecification for the specified languages. If the current ToF is already contained in the result spec, the language specification for this ToF will be replaced with the specified languages.

Parameters:
aTypeOrFeature - the Type or Feature to add for the specified languages
aLanguageIDs - an array of ISO language identifiers.

addResultType

void addResultType(String aTypeName,
                   boolean aAllAnnotatorFeatures)
Adds an Type to this ResultSpecification for the language x-unspecified. If the current Type is already contained in the result spec, the language specification for this Type will be replaced with x-unspecified.

Parameters:
aTypeName - the name of the Type to add for the language x-unspecified
aAllAnnotatorFeatures - whether all features of this type should also be produced

addResultType

void addResultType(String aTypeName,
                   boolean aAllAnnotatorFeatures,
                   String[] aLanguageIDs)
Adds an Type to this ResultSpecification for the specified languages. If the given Type is already contained in the result spec, the languages specificied will be added to those already associated with the Type in this ResultSpec.

Parameters:
aTypeName - the name of the Type to add for the specified languages
aAllAnnotatorFeatures - whether all features of this type should also be produced
aLanguageIDs - an array of ISO language identifiers.

addResultFeature

void addResultFeature(String aFullFeatureName)
Adds a Feature to this ResultSpecification for the language x-unspecified. If the given Type is already contained in the result spec, the languages specificied will be added to those already associated with the Type in this ResultSpec.

Parameters:
aFullFeatureName - the fully-qualified name of the Feature to add for the language x-unspecified

addResultFeature

void addResultFeature(String aFullFeatureName,
                      String[] aLanguageIDs)
Adds a Feature to this ResultSpecification for the specified languages. If the current Feature is already contained in the result spec, the language specification for this Feature will be replaced with the specified languages.

Parameters:
aFullFeatureName - the fully-qualified name of the Feature to add for the specified languages
aLanguageIDs - an array of ISO language identifiers.

compile

void compile(TypeSystem aTypeSystem)
Compiles this ResultSpecification using a specific TypeSystem. This allows the containsType(String) and containsFeature(String) methods to properly consider the inheritance of types and to expand features when this ResultSpecification contains Types with allAnnotatorFeatures set to true.

This method is called automatically by the Analysis Engine. Annotators and Applications do not need to call it.

Parameters:
aTypeSystem - the Type System used to determine which features belong to each Type

containsType

boolean containsType(String aTypeName)
Determines whether this ResultSpecification contains the specified Type for the language x-unspecified.

Parameters:
aTypeName - the name of the type
Returns:
true if and only if this ResultSpecification contains the type with name aTypeName.

containsType

boolean containsType(String aTypeName,
                     String aLanguage)
Determines whether this ResultSpecification contains the specified Type for the specified language

Parameters:
aTypeName - the name of the type
aLanguage - the language to search for
Returns:
true if and only if this ResultSpecification contains the type with name aTypeName for the specified language.

containsFeature

boolean containsFeature(String aFullFeatureName)
Determines whether this ResultSpecification contains the specified Feature for the language x-unspecified.

Parameters:
aFullFeatureName - the fully-qualified name of the feature, in the form MyTypeName:MyFeatureName.
Returns:
true if and only if this ResultSpecification contains the feature with name aFullFeatureName.

containsFeature

boolean containsFeature(String aFullFeatureName,
                        String aLanguage)
Determines whether this ResultSpecification contains the specified Feature for the specified language.

Parameters:
aFullFeatureName - the fully-qualified name of the feature, in the form MyTypeName:MyFeatureName.
aLanguage - the language to search for
Returns:
true if and only if this ResultSpecification contains the feature with name aFullFeatureName for the specified language.

addCapabilities

void addCapabilities(Capability[] aCapabilities)
Adds the output types and features from the specified capabilities to this ResultSpecification.

Parameters:
aCapabilities - capabilities to add

addCapabilities

void addCapabilities(Capability[] aCapabilities,
                     boolean aOutputs)
Adds either outputs or inputs from the specified capabilities to this ResultSpecification.

Parameters:
aCapabilities - capabilities to add
aOutputs - true to add the output types/features to this ResultSpecification, false to add the input types/features to this ResultSpecification.

removeTypeOrFeature

void removeTypeOrFeature(TypeOrFeature aTypeOrFeature)
removes the specified TypeOrFeature from this ResultSpecification.

Parameters:
aTypeOrFeature - the Type or Feature to remove

clone

Object clone()
create a copy of the current object

Returns:
Object returns a copy of the current object


Copyright © 2007 The Apache Software Foundation. All Rights Reserved.