Class CasCreationUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TypeSystemDescription
convertData2TypeSystem
(CasData aCasData) Extracts a TypeSystem definition from a CasData.static CAS
Creates a new CAS instance.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
(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
(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 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
(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 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 systems, 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
Determines whether one type subsumes another.
-
Constructor Details
-
CasCreationUtils
public CasCreationUtils()
-
-
Method Details
-
createCas
Creates a new CAS instance.- Returns:
- a new CAS instance
- Throws:
ResourceInitializationException
- if CAS creation fails
-
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 -- usecreateCas(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 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(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 analysis 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 onUIMAFramework
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 enginesIf you pass this method objects of type
AnalysisEngineDescription
,CollectionReaderDescription
,CasInitializerDescription
, orCasConsumerDescription
, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind ofResourceSpecifier
, it will callUIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map)
. For example, if aURISpecifier
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 ofResourceSpecifier
,ProcessingResourceMetaData
,TypeSystemDescription
,FsIndexCollection
, orTypePriorities
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 enginesIf you pass this method objects of type
AnalysisEngineDescription
,CollectionReaderDescription
,CasInitializerDescription
, orCasConsumerDescription
, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind ofResourceSpecifier
, it will callUIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map)
. For example, if aURISpecifier
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 ofResourceSpecifier
,ProcessingResourceMetaData
,TypeSystemDescription
,FsIndexCollection
, orTypePriorities
objects.aPerformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
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 enginesIf you pass this method objects of type
AnalysisEngineDescription
,CollectionReaderDescription
,CasInitializerDescription
, orCasConsumerDescription
, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind ofResourceSpecifier
, it will callUIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map)
. For example, if aURISpecifier
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 ofResourceSpecifier
,ProcessingResourceMetaData
,TypeSystemDescription
,FsIndexCollection
, orTypePriorities
objects.aPerformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
interfaceaResourceManager
- 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 CASaTypePriorities
- type priorities to install in the CASaFsIndexes
- 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 CASaTypePriorities
- type priorities to install in the CASaFsIndexes
- indexes to install in the CASaPerformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
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 CASaTypePriorities
- type priorities to install in the CASaFsIndexes
- indexes to install in the CASaPerformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
interfaceaResourceManager
- the resource manager- 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
, orCasConsumerDescription
, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind ofResourceSpecifier
, it will callUIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map)
. For example, if aURISpecifier
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 ofResourceSpecifier
,ProcessingResourceMetaData
,TypeSystemDescription
,FsIndexCollection
, orTypePriorities
objects.aTypeSystem
- type system to install in the CAS, null if noneaPerformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
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
, orCasConsumerDescription
, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind ofResourceSpecifier
, it will callUIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map)
. For example, if aURISpecifier
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 ofResourceSpecifier
,ProcessingResourceMetaData
,TypeSystemDescription
,FsIndexCollection
, orTypePriorities
objects.aTypeSystem
- type system to install in the CAS, null if noneaPerformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
interfaceaResourceManager
- 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 CASaTypePriorities
- type priorities to install in the CASaFsIndexes
- indexes to install in the CASaPerformanceTuningSettings
- the settings for performance tuning- 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 CASaTypePriorities
- type priorities to install in the CASaFsIndexes
- indexes to install in the CASaPerformanceTuningSettings
- the settings for performance tuningaResourceManager
- 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. In V3, creating the type system is expensive (due to loading and setting up of JCas classes), so we do the type system creation once per CasDefinition and store it with the CAS definition- Parameters:
casDef
- completely describes the CAS to be createdperformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
interface- Returns:
- a new CAS matching the given CasDefinition
- Throws:
ResourceInitializationException
- if CAS creation fails
-
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 createdperformanceTuningSettings
- Properties object containing framework performance tuning settings using key names defined onUIMAFramework
interfacetypeSystem
- type system object to reuse- Returns:
- a new CAS matching the given CasDefinition
- Throws:
ResourceInitializationException
- if CAS creation fails
-
setupTypeSystem
public static void setupTypeSystem(CASMgr aCASMgr, TypeSystemDescription aTypeSystem) throws ResourceInitializationException Installs a TypeSystem in a CAS.- Parameters:
aCASMgr
- theCASMgr
object whose type system is to be modified.aTypeSystem
- description 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
- theCASMgr
object to be modifiedaTypePriorities
- description of the type priorities to add- Throws:
ResourceInitializationException
- if an error occurs during type priority setup
-
setupIndexes
public static void setupIndexes(CASMgr aCASMgr, FsIndexDescription[] aIndexes) throws ResourceInitializationException Adds FeatureStructure indexes to a CAS.- Parameters:
aCASMgr
- theCASMgr
object to be modifiedaIndexes
- descriptions of the indexes to add- Throws:
ResourceInitializationException
- if an error occurs during index creation
-
convertData2TypeSystem
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 mergedaResourceManager
- 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 incompatibility 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 ResourceInitializationExceptionMerges 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 mergedaResourceManager
- Resource Manager to use to locate type systems imported by nameaOutputMergedTypes
- 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 descriptionaResourceManager
- 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 incompatibility exists or if an import could not be resolved
-
mergeDelegateAnalysisEngineTypeSystems
public static TypeSystemDescription mergeDelegateAnalysisEngineTypeSystems(AnalysisEngineDescription aAggregateDescription, ResourceManager aResourceManager, Map<String, Set<String>> aOutputMergedTypes) throws ResourceInitializationExceptionMerges 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 descriptionaResourceManager
- ResourceManager instance used to resolve importsaOutputMergedTypes
- 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 objectsaResourceManager
- 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 descriptionaResourceManager
- 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 objectsaResourceManager
- 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 descriptionaResourceManager
- 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, throws ResourceInitializationException? super Exception> aOutputFailedRemotes) 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 descriptionaResourceManager
- ResourceManager instance used to resolve importsaOutputMergedTypes
- 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 parameter 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 incompatibility 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 typeaType2Name
- name of second typeaNameMap
- Map from type names to TypeDescriptions- Returns:
- true if and only if the type named
aType1Name
subsumes the type namedaType2Name
according to the information given in theaNameMap
.
-
mergeFeatures
protected static void mergeFeatures(TypeDescription aType, FeatureDescription[] aFeatures) throws ResourceInitializationException Merges features into a TypeDescription.- Parameters:
aType
- TypeDescription into which to merge the featuresaFeatures
- 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 ResourceInitializationExceptionGets 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
, orCasConsumerDescription
, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind ofResourceSpecifier
, it will callUIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map)
. For example, if aURISpecifier
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. Note that this last kind of lookup may be expensive (calling produceResource, which in turn may query remote connections etc.). Because of this, a cache is maintained for these, (because some scenarios end up requesting the same metadata multiple times, in rapid succession). Because remote resource may become available, the cache entries are removed 30 seconds after they are created. This also reclaims space from the cache.- Parameters:
aComponentDescriptionOrMetaData
- a collection ofResourceSpecifier
,ProcessingResourceMetaData
,TypeSystemDescription
,FsIndexCollection
, orTypePriorities
objects.aResourceManager
- used to resolve delegate analysis engine importsaOutputFailedRemotes
- 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:
ResourceInitializationException
- if a failure occurs because an import could not be resolved
-
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 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
, orCasConsumerDescription
, it will not instantiate the components. It will just extract the type system information from the descriptor. For any other kind ofResourceSpecifier
, it will callUIMAFramework.produceResource(org.apache.uima.resource.ResourceSpecifier, Map)
. For example, if aURISpecifier
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:
aComponentDescriptionOrMetaData
- a collection ofResourceSpecifier
,ProcessingResourceMetaData
,TypeSystemDescription
,FsIndexCollection
, orTypePriorities
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:
ResourceInitializationException
- if a failure occurs because an import could not be resolved
-