Java Code Examples for org.apache.uima.util.CasCreationUtils#mergeTypePriorities()

The following examples show how to use org.apache.uima.util.CasCreationUtils#mergeTypePriorities() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiPageEditor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the cas.
 *
 * @param aAeDescription the a ae description
 * @param aPerformanceTuningSettings the a performance tuning settings
 * @param aResourceManager the a resource manager
 * @return the cas
 * @throws ResourceInitializationException the resource initialization exception
 */
public CAS createCas(AnalysisEngineDescription aAeDescription,
        Properties aPerformanceTuningSettings, ResourceManager aResourceManager)
        throws ResourceInitializationException {
  
  getMergeInput(aAeDescription, aResourceManager);

  // merge
  TypeSystemDescription aggTypeDesc = CasCreationUtils.mergeTypeSystems(typeSystemsToMerge, aResourceManager);
  TypePriorities aggTypePriorities = CasCreationUtils.mergeTypePriorities(typePrioritiesToMerge, aResourceManager);
  FsIndexCollection aggIndexColl = CasCreationUtils.mergeFsIndexes(fsIndexesToMerge, aResourceManager);

  return CasCreationUtils.createCas(aggTypeDesc, aggTypePriorities, aggIndexColl.getFsIndexes(),
          aPerformanceTuningSettings, aResourceManager);
}
 
Example 2
Source File: CasDefinition.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
public CasDefinition(Collection<? extends ProcessingResourceMetaData> aMetaDataToMerge, ResourceManager aResourceManager)
        throws ResourceInitializationException {
  // extract TypeSystems, TypePriorities, and FsIndexes from metadata
  List<TypeSystemDescription> typeSystems = new ArrayList<>();
  List<TypePriorities> typePrioritiesList = new ArrayList<>();
  List<FsIndexCollection> fsIndexes = new ArrayList<>();
  Iterator<? extends ProcessingResourceMetaData> it = aMetaDataToMerge.iterator();
  while (it.hasNext()) {
    ProcessingResourceMetaData md = it.next();
    if (md.getTypeSystem() != null)
      typeSystems.add(md.getTypeSystem());
    if (md.getTypePriorities() != null)
      typePrioritiesList.add(md.getTypePriorities());
    if (md.getFsIndexCollection() != null)
      fsIndexes.add(md.getFsIndexCollection());
  }

  // merge TypePriorities and FsIndexes
  TypePriorities aggTypePriorities = CasCreationUtils.mergeTypePriorities(typePrioritiesList,
          aResourceManager);
  FsIndexCollection aggIndexColl = CasCreationUtils.mergeFsIndexes(fsIndexes, aResourceManager);
  TypeSystemDescription aggTypeDesc = CasCreationUtils.mergeTypeSystems(typeSystems,
          aResourceManager);

  this.typeSystemDescription = aggTypeDesc;
  this.typePriorities = aggTypePriorities;
  this.fsIndexDescriptions = aggIndexColl.getFsIndexes();
  this.resourceManager = aResourceManager;
}
 
Example 3
Source File: AggregateAnalysisEngine_impl.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
/**
 * Does processing using the delegate AnalysisEngine metadata once it becomes available.
 * <p>
 * Specifically, sets this aggregate AE's Type System, Type Priorities, and FS Index Descriptions
 * equal to the result of merging the information from its delegate AEs.
 * 
 * @throws ResourceInitializationException
 *           if an error occurs
 */
protected void processDelegateAnalysisEngineMetaData() throws ResourceInitializationException {
  // set this aggregate AnalysisEngine's TypeSystem, TypePriorities, and FS
  // Index Descriptions to the result of merging the information from all
  // delegate AEs. (The aggregate AE may specify its own indexes or type
  // priorities but NOT its own types.)

  // first, create Collections of TypeSystems, TypePriorities, and Index Descriptions
  List<TypeSystemDescription> typeSystems = new ArrayList<>();
  List<TypePriorities> typePriorities = new ArrayList<>();
  List<FsIndexCollection> fsIndexCollections = new ArrayList<>();

  TypePriorities thisAEsTypePriorities = getAnalysisEngineMetaData().getTypePriorities();
  if (thisAEsTypePriorities != null) {
    typePriorities.add(thisAEsTypePriorities);
  }
  FsIndexCollection thisAEsIndexes = getAnalysisEngineMetaData().getFsIndexCollection();
  if (thisAEsIndexes != null) {
    fsIndexCollections.add(thisAEsIndexes);
  }

  // iterate over metadata for all components
  Iterator<ProcessingResourceMetaData> metadataIterator = _getComponentMetaData().values().iterator();
  while (metadataIterator.hasNext()) {
    ProcessingResourceMetaData md = metadataIterator.next();
    if (md.getTypeSystem() != null)
      typeSystems.add(md.getTypeSystem());
    if (md.getTypePriorities() != null)
      typePriorities.add(md.getTypePriorities());
    if (md.getFsIndexCollection() != null)
      fsIndexCollections.add(md.getFsIndexCollection());
  }

  // now do merge
  TypeSystemDescription aggTypeDesc = CasCreationUtils.mergeTypeSystems(typeSystems,
          getResourceManager());
  TypePriorities aggTypePriorities = CasCreationUtils.mergeTypePriorities(typePriorities,
          getResourceManager());
  FsIndexCollection aggIndexColl = CasCreationUtils.mergeFsIndexes(fsIndexCollections,
          getResourceManager());

  // assign results of merge to this aggregate AE's metadata
  AnalysisEngineMetaData aggregateMD = this.getAnalysisEngineMetaData();
  aggregateMD.setTypeSystem(aggTypeDesc);
  aggregateMD.setTypePriorities(aggTypePriorities);
  aggregateMD.setFsIndexCollection(aggIndexColl);

  // check for inconsistent operationalProperties between aggregate and delegates
  validateOperationalProperties();
}
 
Example 4
Source File: MultiPageEditor.java    From uima-uimaj with Apache License 2.0 3 votes vote down vote up
/**
 * Merge delegate analysis engine type priorities.
 *
 * @param aAeDescription the a ae description
 * @param aResourceManager the a resource manager
 * @return the type priorities
 * @throws ResourceInitializationException the resource initialization exception
 */
private TypePriorities mergeDelegateAnalysisEngineTypePriorities(
        AnalysisEngineDescription aAeDescription, ResourceManager aResourceManager) 
      throws ResourceInitializationException {
  
  getMergeInput(aAeDescription, aResourceManager);    
  return CasCreationUtils.mergeTypePriorities(typePrioritiesToMerge, aResourceManager);
}