Package org.apache.uima.resource.metadata

Examples of org.apache.uima.resource.metadata.FsIndexCollection


  public static FsIndexCollection mergeFsIndexes(List<? extends FsIndexCollection> aFsIndexCollections,
      ResourceManager aResourceManager) throws ResourceInitializationException {
    Map<String, FsIndexDescription> aggIndexes = new HashMap<String, FsIndexDescription>();
    Iterator<? extends FsIndexCollection> it = aFsIndexCollections.iterator();
    while (it.hasNext()) {
      FsIndexCollection indexColl = it.next();

      if (indexColl != null) {
        try {
          indexColl.resolveImports(aResourceManager);
        } catch (InvalidXMLException e) {
          throw new ResourceInitializationException(e);
        }
        FsIndexDescription[] indexes = indexColl.getFsIndexes();
        for (int i = 0; i < indexes.length; i++) {
          // does an index with this label already exist?
          FsIndexDescription duplicateIndex = (FsIndexDescription) aggIndexes.get(indexes[i]
              .getLabel());
          if (duplicateIndex == null) {
            // no, so add it
            aggIndexes.put(indexes[i].getLabel(), indexes[i]);
          } else if (!duplicateIndex.equals(indexes[i])) {
            // index with same label exists, they better be equal!
            throw new ResourceInitializationException(
                ResourceInitializationException.DUPLICATE_INDEX_NAME, new Object[] {
                    duplicateIndex.getLabel(), duplicateIndex.getSourceUrlString(),
                    indexes[i].getSourceUrlString() });
          }
        }
      }
    }

    // convert index map to FsIndexCollection
    FsIndexCollection aggIndexColl = UIMAFramework.getResourceSpecifierFactory()
        .createFsIndexCollection();
    Collection<FsIndexDescription> indexes = aggIndexes.values();
    FsIndexDescription[] indexArray = new FsIndexDescription[indexes.size()];
    indexes.toArray(indexArray);
    aggIndexColl.setFsIndexes(indexArray);
    return aggIndexColl;
  }
View Full Code Here


    CapabilityPage p = editor.getCapabilityPage();
    if (null != p)
      p.markStale();

    final FsIndexCollection indexCollection = editor.getFsIndexCollection();

    FsIndexDescription[] indexes = (null == indexCollection) ? null : indexCollection
            .getFsIndexes();

    boolean somethingChanged = false;
    if (indexes != null) {
      if (isType) {
        FsIndexDescription[] newFsid = (FsIndexDescription[]) Utility.removeElementsFromArray(
                indexes, typeOrFeatureName, FsIndexDescription.class, fsIndexDescCompare);
        if (newFsid != indexes) {
          somethingChanged = true;
          indexCollection.setFsIndexes(newFsid);
        }
      } else { // is feature
        for (int i = 0; i < indexes.length; i++) {
          if (typeName.equals(indexes[i].getTypeName())) {
            FsIndexKeyDescription[] newFsKeys = (FsIndexKeyDescription[]) Utility
View Full Code Here

    capabilityVisit(cv);
    if (capabilityChanged[0])
      if (null != editor.getCapabilityPage())
        editor.getCapabilityPage().markStale();

    FsIndexCollection indexCollection = getAnalysisEngineMetaData().getFsIndexCollection();

    FsIndexDescription[] indexes = (null == indexCollection) ? null : indexCollection
            .getFsIndexes();

    boolean somethingChanged = false;
    boolean markStale = false;
View Full Code Here

  private boolean isFeatureUsedInIndex(String fullFeatureName) {
    if (!isLocalProcessingDescriptor()) {
      return false;
    }

    FsIndexCollection indexCollection = editor.getMergedFsIndexCollection();
    FsIndexDescription[] fsid = (null == indexCollection) ? null : indexCollection.getFsIndexes();
    if (null != fsid) {
      for (int i = 0; i < fsid.length; i++) {
        FsIndexKeyDescription[] keys = fsid[i].getKeys();
        if (null != keys) {
          for (int j = 0; j < keys.length; j++) {
View Full Code Here

   * @return
   */
  private boolean validateIndexes() {
    CAS localCAS = descriptorCAS.get();
    TypePriorities savedMergedTypePriorities = getMergedTypePriorities();
    FsIndexCollection savedFsIndexCollection = getMergedFsIndexCollection();
    try {
      setMergedFsIndexCollection();
      setMergedTypePriorities();
      descriptorCAS.validate();
    } catch (Exception ex) {
View Full Code Here

    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);
  }
View Full Code Here

    }

    // merge
    TypeSystemDescription aggTypeDesc = mergeTypeSystems(typeSystems, aResourceManager);
    TypePriorities aggTypePriorities = mergeTypePriorities(typePriorities, aResourceManager);
    FsIndexCollection aggIndexColl = mergeFsIndexes(fsIndexes, aResourceManager);

    return doCreateCas(null, aggTypeDesc, aggTypePriorities, aggIndexColl.getFsIndexes(),
        aPerformanceTuningSettings, aResourceManager);
  }
View Full Code Here

        fsIndexes.add(md.getFsIndexCollection());
    }

    // merge TypePriorities and FsIndexes
    TypePriorities aggTypePriorities = mergeTypePriorities(typePriorities, aResourceManager);
    FsIndexCollection aggIndexColl = mergeFsIndexes(fsIndexes, aResourceManager);

    if (aTypeSystem != null) // existing type system object was specified; use that
    {
      return doCreateCas(aTypeSystem, null, aggTypePriorities, aggIndexColl.getFsIndexes(),
          aPerformanceTuningSettings, aResourceManager);
    } else {
      // no type system object specified; merge type system descriptions in metadata
      TypeSystemDescription aggTypeDesc = mergeTypeSystems(typeSystems);
      return doCreateCas(null, aggTypeDesc, aggTypePriorities, aggIndexColl.getFsIndexes(),
          aPerformanceTuningSettings, aResourceManager);
    }
  }
View Full Code Here

  public static FsIndexCollection mergeFsIndexes(List aFsIndexCollections,
      ResourceManager aResourceManager) throws ResourceInitializationException {
    Map aggIndexes = new HashMap();
    Iterator it = aFsIndexCollections.iterator();
    while (it.hasNext()) {
      FsIndexCollection indexColl = (FsIndexCollection) it.next();

      if (indexColl != null) {
        try {
          indexColl.resolveImports(aResourceManager);
        } catch (InvalidXMLException e) {
          throw new ResourceInitializationException(e);
        }
        FsIndexDescription[] indexes = indexColl.getFsIndexes();
        for (int i = 0; i < indexes.length; i++) {
          // does an index with this label already exist?
          FsIndexDescription duplicateIndex = (FsIndexDescription) aggIndexes.get(indexes[i]
              .getLabel());
          if (duplicateIndex == null) {
            // no, so add it
            aggIndexes.put(indexes[i].getLabel(), indexes[i]);
          } else if (!duplicateIndex.equals(indexes[i])) {
            // index with same label exists, they better be equal!
            throw new ResourceInitializationException(
                ResourceInitializationException.DUPLICATE_INDEX_NAME, new Object[] {
                    duplicateIndex.getLabel(), duplicateIndex.getSourceUrlString(),
                    indexes[i].getSourceUrlString() });
          }
        }
      }
    }

    // convert index map to FsIndexCollection
    FsIndexCollection aggIndexColl = UIMAFramework.getResourceSpecifierFactory()
        .createFsIndexCollection();
    Collection indexes = aggIndexes.values();
    FsIndexDescription[] indexArray = new FsIndexDescription[indexes.size()];
    indexes.toArray(indexArray);
    aggIndexColl.setFsIndexes(indexArray);
    return aggIndexColl;
  }
View Full Code Here

    CasDefinition casDefinition = casManager.getCasDefinition();
    ProcessingResourceMetaData md = UIMAFramework.getResourceSpecifierFactory()
            .createProcessingResourceMetaData();
    md.setTypeSystem(casDefinition.getTypeSystemDescription());
    md.setTypePriorities(casDefinition.getTypePriorities());
    FsIndexCollection indColl = UIMAFramework.getResourceSpecifierFactory()
            .createFsIndexCollection();
    indColl.setFsIndexes(casDefinition.getFsIndexDescriptions());
    md.setFsIndexCollection(indColl);
    return md;
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.metadata.FsIndexCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.