org.apache.uima.util
Class CasCreationUtils

java.lang.Object
  extended by org.apache.uima.util.CasCreationUtils

public class CasCreationUtils
extends Object

Utilities for creating and setting up CASes. Also includes utilities for merging CAS type systems.


Constructor Summary
CasCreationUtils()
           
 
Method Summary
static TypeSystemDescription convertData2TypeSystem(CasData aCasData)
          Extracts a TypeSystem definition from a CasData.
static CAS createCas(AnalysisEngineDescription aDescription)
          Creates a new CAS instance for an Analysis Engine.
static CAS createCas(AnalysisEngineDescription aDescription, Properties aPerformanceTuningSettings)
          Creates a new CAS instance for an Analysis Engine.
static CAS createCas(AnalysisEngineMetaData aMetaData)
          Creates a new CAS instance.
static CAS createCas(CasDefinition casDef, Properties performanceTuningSettings)
          Create a CAS from a CAS Definition.
static CAS createCas(CasDefinition casDef, Properties performanceTuningSettings, TypeSystem typeSystem)
          Create a CAS from a CAS Definition, but reuse the provided TypeSystem object.
static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData)
          Creates a new CAS instance for a collection of CAS Processors.
static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData, Properties aPerformanceTuningSettings)
          Creates a new CAS instance for a collection of CAS Processors.
static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData, Properties aPerformanceTuningSettings, ResourceManager aResourceManager)
          Creates a new CAS instance for a collection of CAS Processors.
static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData, TypeSystem aTypeSystem, Properties aPerformanceTuningSettings)
          Creates a new CAS instance for a collection of CAS Processors, which.
static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData, TypeSystem aTypeSystem, Properties aPerformanceTuningSettings, ResourceManager aResourceManager)
          Creates a new CAS instance for a collection of CAS Processors, which.
static CAS createCas(ProcessingResourceMetaData aMetaData)
          Creates a new CAS instance.
static CAS createCas(TypeSystemDescription aTypeSystem, TypePriorities aTypePriorities, FsIndexDescription[] aFsIndexes)
          Creates a new CAS instance.
static CAS createCas(TypeSystemDescription aTypeSystem, TypePriorities aTypePriorities, FsIndexDescription[] aFsIndexes, Properties aPerformanceTuningSettings)
          Creates a new CAS instance.
static CAS createCas(TypeSystemDescription aTypeSystem, TypePriorities aTypePriorities, FsIndexDescription[] aFsIndexes, Properties aPerformanceTuningSettings, ResourceManager aResourceManager)
          Creates a new CAS instance.
static CAS createCas(TypeSystem aTypeSystem, TypePriorities aTypePriorities, FsIndexDescription[] aFsIndexes, Properties aPerformanceTuningSettings)
          Creates a new CAS instance that reuses an existing type system.
static CAS createCas(TypeSystem aTypeSystem, TypePriorities aTypePriorities, FsIndexDescription[] aFsIndexes, Properties aPerformanceTuningSettings, ResourceManager aResourceManager)
          Creates a new CAS instance that reuses an existing type system.
static List<ProcessingResourceMetaData> getMetaDataList(Collection<? extends MetaDataObject> aComponentDescriptionOrMetaData, ResourceManager aResourceManager)
          Gets a list of ProcessingResourceMetadata objects from a list containing either ResourceSpecifiers, ProcessingResourceMetadata objects, or subparts of ProcessingResourceMetadata objects (type sypstems, indexes, or type priorities).
static List<ProcessingResourceMetaData> getMetaDataList(Collection<? extends MetaDataObject> aComponentDescriptionOrMetaData, ResourceManager aResourceManager, Map<String,? super Exception> aOutputFailedRemotes)
          Gets a list of ProcessingResourceMetadata objects from a list containing either ResourceSpecifiers, ProcessingResourceMetadata objects, or subparts of ProcessingResourceMetadata objects (type systems, indexes, or type priorities).
static FsIndexCollection mergeDelegateAnalysisEngineFsIndexCollections(AnalysisEngineDescription aAggregateDescription)
          Merges the FS Index Collections of each component within an aggregate Analysis Engine, producing a single combined FS Index Collection.
static FsIndexCollection mergeDelegateAnalysisEngineFsIndexCollections(AnalysisEngineDescription aAggregateDescription, ResourceManager aResourceManager)
          Merges the FS Index Collections of each component within an aggregate Analysis Engine, producing a single combined FS Index Collection.
static ProcessingResourceMetaData mergeDelegateAnalysisEngineMetaData(AnalysisEngineDescription aAggregateDescription, ResourceManager aResourceManager, Map<String,Set<String>> aOutputMergedTypes, Map<String,? super Exception> aOutputFailedRemotes)
          Merges the Type Systems, Type Priorities, and FS Indexes of each component within an aggregate Analysis Engine.
static TypePriorities mergeDelegateAnalysisEngineTypePriorities(AnalysisEngineDescription aAggregateDescription)
          Merges the Type Priorities of each component within an aggregate Analysis Engine, producing a single combined TypePriorities object.
static TypePriorities mergeDelegateAnalysisEngineTypePriorities(AnalysisEngineDescription aAggregateDescription, ResourceManager aResourceManager)
          Merges the Type Priorities of each component within an aggregate Analysis Engine, producing a single combined TypePriorities object.
static TypeSystemDescription mergeDelegateAnalysisEngineTypeSystems(AnalysisEngineDescription aAggregateDescription)
          Merges the Type Systems of each component within an aggregate Analysis Engine, producing a single combined Type System.
static TypeSystemDescription mergeDelegateAnalysisEngineTypeSystems(AnalysisEngineDescription aAggregateDescription, ResourceManager aResourceManager)
          Merges the Type Systems of each component within an aggregate Analysis Engine, producing a single combined Type System.
static TypeSystemDescription mergeDelegateAnalysisEngineTypeSystems(AnalysisEngineDescription aAggregateDescription, ResourceManager aResourceManager, Map<String,Set<String>> aOutputMergedTypes)
          Merges the Type Systems of each component within an aggregate Analysis Engine, producing a single combined Type System.
protected static void mergeFeatures(TypeDescription aType, FeatureDescription[] aFeatures)
          Merges features into a TypeDescription.
static FsIndexCollection mergeFsIndexes(List<? extends FsIndexCollection> aFsIndexCollections, ResourceManager aResourceManager)
          Merges a List of FsIndexCollections into a single FsIndexCollection object.
static TypePriorities mergeTypePriorities(List<? extends TypePriorities> aTypePriorities, ResourceManager aResourceManager)
          Merges a List of TypePriorities into a single TypePriorities object.
static TypeSystemDescription mergeTypeSystems(Collection<? extends TypeSystemDescription> aTypeSystems)
          Merges several TypeSystemDescriptions into one.
static TypeSystemDescription mergeTypeSystems(Collection<? extends TypeSystemDescription> aTypeSystems, ResourceManager aResourceManager)
          Merges several TypeSystemDescriptions into one.
static TypeSystemDescription mergeTypeSystems(Collection<? extends TypeSystemDescription> aTypeSystems, ResourceManager aResourceManager, Map<String,Set<String>> aOutputMergedTypes)
          Merges several TypeSystemDescriptions into one.
static void setupIndexes(CASMgr aCASMgr, FsIndexDescription[] aIndexes)
          Adds FeatureStructure indexes to a CAS.
static void setupTypePriorities(CASMgr aCASMgr, TypePriorities aTypePriorities)
          Adds TypePriorities to a CAS.
static void setupTypeSystem(CASMgr aCASMgr, TypeSystemDescription aTypeSystem)
          Installs a TypeSystem in a CAS.
protected static boolean subsumes(String aType1Name, String aType2Name, Map<String,? extends TypeDescription> aNameMap)
          Determines whether one type subsumes another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CasCreationUtils

public CasCreationUtils()
Method Detail

createCas

public static CAS createCas(AnalysisEngineMetaData aMetaData)
                     throws ResourceInitializationException
Creates a new CAS instance. Note this method does not work for Aggregate Analysis Engine descriptors -- use createCas(AnalysisEngineDescription) instead.

Parameters:
aMetaData - metadata for the analysis engine that will process this CAS. This is used to set up the CAS's type system and indexes.
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(ProcessingResourceMetaData aMetaData)
                     throws ResourceInitializationException
Creates a new CAS instance.

Parameters:
aMetaData - metadata for the resource that will process this CAS. This is used to set up the CAS's type system and indexes.
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(AnalysisEngineDescription aDescription)
                     throws ResourceInitializationException
Creates a new CAS instance for an Analysis Engine. This works for both primitive and aggregate analysis engines.

Parameters:
aDescription - description of the anlaysis engine that will process this CAS. This is used to set up the CAS's type system and indexes.
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(AnalysisEngineDescription aDescription,
                            Properties aPerformanceTuningSettings)
                     throws ResourceInitializationException
Creates a new CAS instance for an Analysis Engine. This works for both primitive and aggregate analysis engines.

Parameters:
aDescription - description of the anlaysis engine that will process this CAS. This is used to set up the CAS's type system and indexes.
aPerformanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData)
                     throws ResourceInitializationException
Creates a new CAS instance for a collection of CAS Processors. This method correctly handles aggregate as well as primitive analysis engines

If you pass this method objects of type AnalysisEngineDescription, CollectionReaderDescription, CasInitializerDescription, or CasConsumerDescription, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind of ResourceSpecifier, it will call UIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map). For example, if a URISpecifier is passed, a remote connection will be established and the service will be queries for its metadata. An exception will be thrown if the connection can not be opened.

Parameters:
aComponentDescriptionsOrMetaData - a collection of ResourceSpecifier, ProcessingResourceMetaData, TypeSystemDescription, FsIndexCollection, or TypePriorities objects.
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData,
                            Properties aPerformanceTuningSettings)
                     throws ResourceInitializationException
Creates a new CAS instance for a collection of CAS Processors. This method correctly handles aggregate as well as primitive analysis engines

If you pass this method objects of type AnalysisEngineDescription, CollectionReaderDescription, CasInitializerDescription, or CasConsumerDescription, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind of ResourceSpecifier, it will call UIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map). For example, if a URISpecifier is passed, a remote connection will be established and the service will be queries for its metadata. An exception will be thrown if the connection can not be opened.

Parameters:
aComponentDescriptionsOrMetaData - a collection of ResourceSpecifier, ProcessingResourceMetaData, TypeSystemDescription, FsIndexCollection, or TypePriorities objects.
aPerformanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData,
                            Properties aPerformanceTuningSettings,
                            ResourceManager aResourceManager)
                     throws ResourceInitializationException
Creates a new CAS instance for a collection of CAS Processors. This method correctly handles aggregate as well as primitive analysis engines

If you pass this method objects of type AnalysisEngineDescription, CollectionReaderDescription, CasInitializerDescription, or CasConsumerDescription, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind of ResourceSpecifier, it will call UIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map). For example, if a URISpecifier is passed, a remote connection will be established and the service will be queries for its metadata. An exception will be thrown if the connection can not be opened.

Parameters:
aComponentDescriptionsOrMetaData - a collection of ResourceSpecifier, ProcessingResourceMetaData, TypeSystemDescription, FsIndexCollection, or TypePriorities objects.
aPerformanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
aResourceManager - the resource manager to use to resolve import declarations within the metadata
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(TypeSystemDescription aTypeSystem,
                            TypePriorities aTypePriorities,
                            FsIndexDescription[] aFsIndexes)
                     throws ResourceInitializationException
Creates a new CAS instance.

Parameters:
aTypeSystem - type system to install in the CAS
aTypePriorities - type priorities to install in the CAS
aFsIndexes - indexes to install in the CAS
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(TypeSystemDescription aTypeSystem,
                            TypePriorities aTypePriorities,
                            FsIndexDescription[] aFsIndexes,
                            Properties aPerformanceTuningSettings)
                     throws ResourceInitializationException
Creates a new CAS instance.

Parameters:
aTypeSystem - type system to install in the CAS
aTypePriorities - type priorities to install in the CAS
aFsIndexes - indexes to install in the CAS
aPerformanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(TypeSystemDescription aTypeSystem,
                            TypePriorities aTypePriorities,
                            FsIndexDescription[] aFsIndexes,
                            Properties aPerformanceTuningSettings,
                            ResourceManager aResourceManager)
                     throws ResourceInitializationException
Creates a new CAS instance.

Parameters:
aTypeSystem - type system to install in the CAS
aTypePriorities - type priorities to install in the CAS
aFsIndexes - indexes to install in the CAS
aPerformanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData,
                            TypeSystem aTypeSystem,
                            Properties aPerformanceTuningSettings)
                     throws ResourceInitializationException
Creates a new CAS instance for a collection of CAS Processors, which. reuses an existing type system. Using this method allows several CASes to all share the exact same type system object. This method correctly handles aggregate as well as primitive analysis engines.

If you pass this method objects of type AnalysisEngineDescription, CollectionReaderDescription, CasInitializerDescription, or CasConsumerDescription, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind of ResourceSpecifier, it will call UIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map). For example, if a URISpecifier is passed, a remote connection will be established and the service will be queries for its metadata. An exception will be thrown if the connection can not be opened.

Parameters:
aComponentDescriptionsOrMetaData - a collection of ResourceSpecifier, ProcessingResourceMetaData, TypeSystemDescription, FsIndexCollection, or TypePriorities objects.
aTypeSystem - type system to install in the CAS, null if none
aPerformanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(Collection<? extends MetaDataObject> aComponentDescriptionsOrMetaData,
                            TypeSystem aTypeSystem,
                            Properties aPerformanceTuningSettings,
                            ResourceManager aResourceManager)
                     throws ResourceInitializationException
Creates a new CAS instance for a collection of CAS Processors, which. reuses an existing type system. Using this method allows several CASes to all share the exact same type system object. This method correctly handles aggregate as well as primitive analysis engines.

If you pass this method objects of type AnalysisEngineDescription, CollectionReaderDescription, CasInitializerDescription, or CasConsumerDescription, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind of ResourceSpecifier, it will call UIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map). For example, if a URISpecifier is passed, a remote connection will be established and the service will be queries for its metadata. An exception will be thrown if the connection can not be opened.

Parameters:
aComponentDescriptionsOrMetaData - a collection of ResourceSpecifier, ProcessingResourceMetaData, TypeSystemDescription, FsIndexCollection, or TypePriorities objects.
aTypeSystem - type system to install in the CAS, null if none
aPerformanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
aResourceManager - the resource manager to use to resolve import declarations within the metadata, and also to set the JCas ClassLoader for the new CAS
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(TypeSystem aTypeSystem,
                            TypePriorities aTypePriorities,
                            FsIndexDescription[] aFsIndexes,
                            Properties aPerformanceTuningSettings)
                     throws ResourceInitializationException
Creates a new CAS instance that reuses an existing type system. Using this method allows several CASes to all share the exact same type system object.

Parameters:
aTypeSystem - type system to install in the CAS
aTypePriorities - type priorities to install in the CAS
aFsIndexes - indexes to install in the CAS
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(TypeSystem aTypeSystem,
                            TypePriorities aTypePriorities,
                            FsIndexDescription[] aFsIndexes,
                            Properties aPerformanceTuningSettings,
                            ResourceManager aResourceManager)
                     throws ResourceInitializationException
Creates a new CAS instance that reuses an existing type system. Using this method allows several CASes to all share the exact same type system object.

Parameters:
aTypeSystem - type system to install in the CAS
aTypePriorities - type priorities to install in the CAS
aFsIndexes - indexes to install in the CAS
aResourceManager - resource manager, which is used to set the JCas ClassLoader for the new CAS
Returns:
a new CAS instance
Throws:
ResourceInitializationException - if CAS creation fails

createCas

public static CAS createCas(CasDefinition casDef,
                            Properties performanceTuningSettings)
                     throws ResourceInitializationException
Create a CAS from a CAS Definition.

Parameters:
casDef - completely describes the CAS to be created
performanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
Returns:
a new CAS matching the given CasDefinition
Throws:
ResourceInitializationException

createCas

public static CAS createCas(CasDefinition casDef,
                            Properties performanceTuningSettings,
                            TypeSystem typeSystem)
                     throws ResourceInitializationException
Create a CAS from a CAS Definition, but reuse the provided TypeSystem object.

Parameters:
casDef - completely describes the CAS to be created
performanceTuningSettings - Properties object containing framework performance tuning settings using key names defined on UIMAFramework interface
typeSystem - type system object to reuse
Returns:
a new CAS matching the given CasDefinition
Throws:
ResourceInitializationException

setupTypeSystem

public static void setupTypeSystem(CASMgr aCASMgr,
                                   TypeSystemDescription aTypeSystem)
                            throws ResourceInitializationException
Installs a TypeSystem in a CAS.

Parameters:
aCASMgr - the CASMgr object whose type system is to be modified.
aTypeSystem - desription of type system to install
Throws:
ResourceInitializationException - if an error occurs during modification of the type system

setupTypePriorities

public static void setupTypePriorities(CASMgr aCASMgr,
                                       TypePriorities aTypePriorities)
                                throws ResourceInitializationException
Adds TypePriorities to a CAS.

Parameters:
aCASMgr - the CASMgr object to be modified
aTypePriorities - description of the type priorities to add
Throws:
CASException - if an error occurs during type priority setup
ResourceInitializationException

setupIndexes

public static void setupIndexes(CASMgr aCASMgr,
                                FsIndexDescription[] aIndexes)
                         throws ResourceInitializationException
Adds FeatureStructure indexes to a CAS.

Parameters:
aCASMgr - the CASMgr object to be modified
aIndexes - descriptions of the indexes to add
Throws:
ResourceInitializationException - if an error occurs during index creation

convertData2TypeSystem

public static TypeSystemDescription convertData2TypeSystem(CasData aCasData)
Extracts a TypeSystem definition from a CasData.

Parameters:
aCasData - the CAS Data from which to extract the type system
Returns:
a description of a TypeSystem to which the CAS Data conforms

mergeTypeSystems

public static TypeSystemDescription mergeTypeSystems(Collection<? extends TypeSystemDescription> aTypeSystems)
                                              throws ResourceInitializationException
Merges several TypeSystemDescriptions into one. Also resolves imports in the TypeSystemDescription objects.

Parameters:
aTypeSystems - a collection of TypeSystems to be merged
Returns:
a new TypeSystemDescription that is the result of merging all of the type systems together
Throws:
ResourceInitializationException - if an incompatibility exists or if an import could not be resolved

mergeTypeSystems

public static TypeSystemDescription mergeTypeSystems(Collection<? extends TypeSystemDescription> aTypeSystems,
                                                     ResourceManager aResourceManager)
                                              throws ResourceInitializationException
Merges several TypeSystemDescriptions into one. Also resolves imports in the TypeSystemDescription objects.

Parameters:
aTypeSystems - a collection of TypeSystems to be merged
aResourceManager - Resource Manager to use to locate type systems imported by name
Returns:
a new TypeSystemDescription that is the result of merging all of the type systems together
Throws:
ResourceInitializationException - if an incompatibiliy exists or if an import could not be resolved

mergeTypeSystems

public static TypeSystemDescription mergeTypeSystems(Collection<? extends TypeSystemDescription> aTypeSystems,
                                                     ResourceManager aResourceManager,
                                                     Map<String,Set<String>> aOutputMergedTypes)
                                              throws ResourceInitializationException
Merges several TypeSystemDescriptions into one. Also resolves imports in the TypeSystemDescription objects.

This version of this method takes an argument aOutputMergedTypes, which this method will populate with the names and descriptor locations of any types whose definitions have been merged from multiple non-identical sources. That is, types that are declared more than once, with different (but compatible) sets of features in each declaration, or with different (but compatible) supertypes.

Parameters:
aTypeSystems - a collection of TypeSystems to be merged
aResourceManager - Resource Manager to use to locate type systems imported by name
aOutputMergedTypes - A Map that this method will populate with information about the set of types whose definitions were merged from multiple non-identical sources. The keys in the Map will be the type names (Strings) and the values will be {link Set}s containing Descriptor URLs (Strings) where those types are declared. You may pass null if you are not interested in this information.
Returns:
a new TypeSystemDescription that is the result of merging all of the type systems together
Throws:
ResourceInitializationException - if an incompatibility exists or if an import could not be resolved

mergeDelegateAnalysisEngineTypeSystems

public static TypeSystemDescription mergeDelegateAnalysisEngineTypeSystems(AnalysisEngineDescription aAggregateDescription)
                                                                    throws ResourceInitializationException
Merges the Type Systems of each component within an aggregate Analysis Engine, producing a single combined Type System.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
Returns:
a new TypeSystemDescription that is the result of merging all of the delegate AE type systems together
Throws:
ResourceInitializationException - if an incompatibility exists or if an import could not be resolved

mergeDelegateAnalysisEngineTypeSystems

public static TypeSystemDescription mergeDelegateAnalysisEngineTypeSystems(AnalysisEngineDescription aAggregateDescription,
                                                                           ResourceManager aResourceManager)
                                                                    throws ResourceInitializationException
Merges the Type Systems of each component within an aggregate Analysis Engine, producing a single combined Type System.

This version of this method takes an argument aOutputMergedTypeNames, to which this method will add the names of any types whose definitions have been merged from multiple non-identical sources. That is, types that are declared more than once, with different (but compatible) sets of features in each declaration, or with different (but compatible) supertypes.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
aResourceManager - ResourceManager instance used to resolve imports
Returns:
a new TypeSystemDescription that is the result of merging all of the delegate AE type systems together
Throws:
ResourceInitializationException - if an incompatibiliy exists or if an import could not be resolved

mergeDelegateAnalysisEngineTypeSystems

public static TypeSystemDescription mergeDelegateAnalysisEngineTypeSystems(AnalysisEngineDescription aAggregateDescription,
                                                                           ResourceManager aResourceManager,
                                                                           Map<String,Set<String>> aOutputMergedTypes)
                                                                    throws ResourceInitializationException
Merges the Type Systems of each component within an aggregate Analysis Engine, producing a single combined Type System.

This version of this method takes an argument aOutputMergedTypes, which this method will populate with the names and descriptor locations of any types whose definitions have been merged from multiple non-identical sources. That is, types that are declared more than once, with different (but compatible) sets of features in each declaration, or with different (but compatible) supertypes.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
aResourceManager - ResourceManager instance used to resolve imports
aOutputMergedTypes - A Map that this method will populate with information about the set of types whose definitions were merged from multiple non-identical sources. The keys in the Map will be the type names (Strings) and the values will be {link Set}s containing Descriptor URLs (Strings) where those types are declared. You may pass null if you are not interested in this information. *
Returns:
a new TypeSystemDescription that is the result of merging all of the delegate AE type systems together
Throws:
ResourceInitializationException - if an incompatibility exists or if an import could not be resolved

mergeFsIndexes

public static FsIndexCollection mergeFsIndexes(List<? extends FsIndexCollection> aFsIndexCollections,
                                               ResourceManager aResourceManager)
                                        throws ResourceInitializationException
Merges a List of FsIndexCollections into a single FsIndexCollection object.

Parameters:
aFsIndexCollections - list of FsIndexCollection objects
aResourceManager - ResourceManager instance to use to resolve imports
Returns:
a merged FsIndexCollection object
Throws:
ResourceInitializationException - if an incompatibility exists or if an import could not be resolved

mergeDelegateAnalysisEngineFsIndexCollections

public static FsIndexCollection mergeDelegateAnalysisEngineFsIndexCollections(AnalysisEngineDescription aAggregateDescription)
                                                                       throws ResourceInitializationException
Merges the FS Index Collections of each component within an aggregate Analysis Engine, producing a single combined FS Index Collection.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
Returns:
a new FsIndexCollection that is the result of merging all of the delegate AE FsIndexCollections together
Throws:
ResourceInitializationException - if an incompatibility exists or if an import could not be resolved

mergeDelegateAnalysisEngineFsIndexCollections

public static FsIndexCollection mergeDelegateAnalysisEngineFsIndexCollections(AnalysisEngineDescription aAggregateDescription,
                                                                              ResourceManager aResourceManager)
                                                                       throws ResourceInitializationException
Merges the FS Index Collections of each component within an aggregate Analysis Engine, producing a single combined FS Index Collection.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
aResourceManager - ResourceManager instance used to resolve imports
Returns:
a new FsIndexCollection that is the result of merging all of the delegate AE FsIndexCollections together
Throws:
ResourceInitializationException - if an incompatibility exists or if an import could not be resolved

mergeTypePriorities

public static TypePriorities mergeTypePriorities(List<? extends TypePriorities> aTypePriorities,
                                                 ResourceManager aResourceManager)
                                          throws ResourceInitializationException
Merges a List of TypePriorities into a single TypePriorities object.

Parameters:
aTypePriorities - list of TypePriorities objects
aResourceManager - ResourceManager instance to use to resolve imports
Returns:
a merged TypePriorities object
Throws:
ResourceInitializationException - if an import could not be resolved

mergeDelegateAnalysisEngineTypePriorities

public static TypePriorities mergeDelegateAnalysisEngineTypePriorities(AnalysisEngineDescription aAggregateDescription)
                                                                throws ResourceInitializationException
Merges the Type Priorities of each component within an aggregate Analysis Engine, producing a single combined TypePriorities object.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
Returns:
a new TypePriorities object that is the result of merging all of the delegate AE TypePriorities together
Throws:
ResourceInitializationException - if an incompatibility exists

mergeDelegateAnalysisEngineTypePriorities

public static TypePriorities mergeDelegateAnalysisEngineTypePriorities(AnalysisEngineDescription aAggregateDescription,
                                                                       ResourceManager aResourceManager)
                                                                throws ResourceInitializationException
Merges the Type Priorities of each component within an aggregate Analysis Engine, producing a single combined TypePriorities object.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
aResourceManager - ResourceManager instance used to resolve imports
Returns:
a new TypePriorities object that is the result of merging all of the delegate AE TypePriorities together
Throws:
ResourceInitializationException - if an incompatibility exists

mergeDelegateAnalysisEngineMetaData

public static ProcessingResourceMetaData mergeDelegateAnalysisEngineMetaData(AnalysisEngineDescription aAggregateDescription,
                                                                             ResourceManager aResourceManager,
                                                                             Map<String,Set<String>> aOutputMergedTypes,
                                                                             Map<String,? super Exception> aOutputFailedRemotes)
                                                                      throws ResourceInitializationException
Merges the Type Systems, Type Priorities, and FS Indexes of each component within an aggregate Analysis Engine.

This version of this method takes an argument aOutputMergedTypes, which this method will populate with the names and descriptor locations of any types whose definitions have been merged from multiple non-identical sources. That is, types that are declared more than once, with different (but compatible) sets of features in each declaration, or with different (but compatible) supertypes.

Parameters:
aAggregateDescription - an aggregate Analysis Engine description
aResourceManager - ResourceManager instance used to resolve imports
aOutputMergedTypes - A Map that this method will populate with information about the set of types whose definitions were merged from multiple non-identical sources. That is, types that are declared more than once, with different (but compatible) sets of features in each declaration, or with different (but compatible) supertypes. The keys in the Map will be the type names (Strings) and the values will be {link Set}s containing Descriptor URLs (Strings) where those types are declared. You may pass null if you are not interested in this information.
aOutputFailedRemotes - If this paramter is non-null, and if a remote AE could not be contacted, then an entry will be added to this map. The key will be the context name (e.g., /myDelegate1/nestedRemoteDelegate) of the failed remote, and the value will be the Exception that occurred. If this parameter is null, an exception will be thrown if a remote AE could not be contacted.
Returns:
an object containing the merged TypeSystem, TypePriorities, and FS Index definitions.
Throws:
ResourceInitializationException - if an incompatibiliy exists or if an import could not be resolved

subsumes

protected static boolean subsumes(String aType1Name,
                                  String aType2Name,
                                  Map<String,? extends TypeDescription> aNameMap)
Determines whether one type subsumes another.

Parameters:
aType1Name - name of first type
aType2Name - name of second type
aNameMap - Map from type names to TypeDescriptions
Returns:
true if and only if the type named aType1Name subsumes the type named aType2Name according to the information given in the aNameMap.

mergeFeatures

protected static void mergeFeatures(TypeDescription aType,
                                    FeatureDescription[] aFeatures)
                             throws ResourceInitializationException
Merges features into a TypeDescription.

Parameters:
aType - TypeDescription into which to merge the features
aFeatures - array of features to merge
Throws:
ResourceInitializationException - if an incompatibility exists

getMetaDataList

public static List<ProcessingResourceMetaData> getMetaDataList(Collection<? extends MetaDataObject> aComponentDescriptionOrMetaData,
                                                               ResourceManager aResourceManager,
                                                               Map<String,? super Exception> aOutputFailedRemotes)
                                                        throws ResourceInitializationException
Gets a list of ProcessingResourceMetadata objects from a list containing either ResourceSpecifiers, ProcessingResourceMetadata objects, or subparts of ProcessingResourceMetadata objects (type systems, indexes, or type priorities). Subparts will be wrapped inside a ProcessingResourceMetadata object. All objects will be cloned, so that further processing (such as import resolution) does not affect the caller.

If you pass this method objects of type AnalysisEngineDescription, CollectionReaderDescription, CasInitializerDescription, or CasConsumerDescription, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind of ResourceSpecifier, it will call UIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map). For example, if a URISpecifier is passed, a remote connection will be established and the service will be queries for its metadata. An exception will be thrown if the connection can not be opened.

Parameters:
aComponentDescriptionsOrMetaData - a collection of ResourceSpecifier, ProcessingResourceMetaData, TypeSystemDescription, FsIndexCollection, or TypePriorities objects.
aResourceManager - used to resolve delegate analysis engine imports
aOutputFailedRemotes - If this parameter is non-null, and if a remote AE could not be contacted, then the context name (e.g. /myDelegate1/nestedRemoteDelegate) of the failed remote will be added to this collection. If this parameter is null, an exception will be thrown if a remote AE could not be contacted.
Returns:
a List containing the ProcessingResourceMetaData objects containing all of the information in all of the objects in aComponentDescriptionOrMetaData (including all components of aggregate AnalysisEngines)
Throws:
ResourceInitialziationException - if a failure occurs because an import could not be resolved
ResourceInitializationException

getMetaDataList

public static List<ProcessingResourceMetaData> getMetaDataList(Collection<? extends MetaDataObject> aComponentDescriptionOrMetaData,
                                                               ResourceManager aResourceManager)
                                                        throws ResourceInitializationException
Gets a list of ProcessingResourceMetadata objects from a list containing either ResourceSpecifiers, ProcessingResourceMetadata objects, or subparts of ProcessingResourceMetadata objects (type sypstems, indexes, or type priorities). Subparts will be wrapped inside a ProcessingResourceMetadata object. All objects will be cloned, so that further processing (such as import resolution) does not affect the caller.

If you pass this method objects of type AnalysisEngineDescription, CollectionReaderDescription, CasInitializerDescription, or CasConsumerDescription, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind of ResourceSpecifier, it will call UIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map). For example, if a URISpecifier is passed, a remote connection will be established and the service will be queries for its metadata. An exception will be thrown if the connection can not be opened.

Parameters:
aComponentDescriptionsOrMetaData - a collection of ResourceSpecifier, ProcessingResourceMetaData, TypeSystemDescription, FsIndexCollection, or TypePriorities objects.
aResourceManager - used to resolve delegate analysis engine imports
Returns:
a List containing the ProcessingResourceMetaData objects containing all of the information in all of the objects in aComponentDescriptionOrMetaData (including all components of aggregate AnalysisEngines)
Throws:
ResourceInitialziationException - if a failure occurs because an import could not be resolved
ResourceInitializationException


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