Examples of FSIterator


Examples of org.apache.uima.cas.FSIterator

      indexRepositories.add(this.casBeingFilled.getBaseIndexRepository());
      // There should always be another index for the Initial View
      indexRepositories.add(this.casBeingFilled.getView(CAS.NAME_DEFAULT_SOFA).getIndexRepository());
      //add an entry to indexRepositories for each Sofa in the CAS (which can only happen if
      //a mergePoint was specified)
      FSIterator sofaIter = this.casBeingFilled.getSofaIterator();
      while(sofaIter.hasNext()) {
        SofaFS sofa = (SofaFS)sofaIter.next();
        if (sofa.getSofaRef() == 1) {
          casBeingFilled.registerInitialSofa();
        } else {
          // add indexRepo for views other than the initial view
          indexRepositories.add(casBeingFilled.getSofaIndexRepository(sofa));
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

          throws AnalysisEngineProcessException {

    System.out.println("Debug: inputViewJCas.getViewName() "+inputViewJCas.getViewName());

   
    FSIterator subContextAnnotationIterator = AnnotationCollectionUtils.subiterator(
        inputViewJCas, contextAnnotation);

    Boolean atLeastOneAnnotationToSearchFoundAmoungTheSubContextAnnotation = false;
    // for each annotation to search under the context annotation
    while (subContextAnnotationIterator.hasNext()) {
      Annotation aSubAnnotation = (Annotation) subContextAnnotationIterator
          .next();

      System.out.println("Debug: annotationToSearch "+annotationToSearch);
      System.out.println("Debug: aSubAnnotation.getClass().getName() "+aSubAnnotation.getClass().getName());
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

        return new Object[] {};
      }

      StrictTypeConstraint typeConstrain = new StrictTypeConstraint(mCurrentType);

      FSIterator strictTypeIterator = mCAS.createFilteredIterator(
              mCAS.getIndexRepository().getAllIndexedFS(mCurrentType), typeConstrain);

      LinkedList<ModelFeatureStructure> featureStrucutreList = new LinkedList<ModelFeatureStructure>();

      for (int i = 0; strictTypeIterator.hasNext(); i++) {
        featureStrucutreList.add(new ModelFeatureStructure(mDocument,
                (FeatureStructure) strictTypeIterator.next()));
      }

      ModelFeatureStructure[] featureStructureArray = new ModelFeatureStructure[featureStrucutreList
              .size()];
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

  public Collection<AnnotationFS> getAnnotations(Type type) {
    FSIndex annotationIndex = mCAS.getAnnotationIndex(type);

    StrictTypeConstraint typeConstrain = new StrictTypeConstraint(type);

    FSIterator strictTypeIterator = mCAS.createFilteredIterator(
        annotationIndex.iterator(), typeConstrain);

    return fsIteratorToCollection(strictTypeIterator);
  }
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

    FSMatchConstraint annotationInSpanAndStrictTypeConstraint = cf.and(
        annotatioInSpanConstraint, strictType);

    FSIndex allAnnotations = getCAS().getAnnotationIndex(type);

    FSIterator annotationInsideSpanIndex = getCAS().createFilteredIterator(
        allAnnotations.iterator(),
        annotationInSpanAndStrictTypeConstraint);

    return fsIteratorToCollection(annotationInsideSpanIndex);
  }
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

        // try to retreive the filename of the input file from the CAS
        File outFile = null;
        Type srcDocInfoType = aCas.getTypeSystem().getType(
                "org.apache.uima.examples.SourceDocumentInformation");
        if (srcDocInfoType != null) {
          FSIterator it = aCas.getIndexRepository().getAllIndexedFS(srcDocInfoType);
          if (it.hasNext()) {
            FeatureStructure srcDocInfoFs = it.get();
            Feature uriFeat = srcDocInfoType.getFeatureByBaseName("uri");
            Feature offsetInSourceFeat = srcDocInfoType.getFeatureByBaseName("offsetInSource");
            String uri = srcDocInfoFs.getStringValue(uriFeat);
            int offsetInSource = srcDocInfoFs.getIntValue(offsetInSourceFeat);
            File inFile;
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

      assertNotNull(cas.getIndexRepository().getIndex("MyIndex"));

      // test that priorities work
      cas.createFS(supertypeHandle);
      cas.createFS(subtypeHandle);
      FSIterator iter = cas.getAnnotationIndex().iterator();
      while (iter.isValid()) {
        if (iter.get().getType() == subtypeHandle) // expected
          break;
        if (iter.get().getType() == supertypeHandle) // unexpected
          fail();
        iter.moveToNext();
      }

      // test that passing an invalid object causes an error
      descList.add(new ConfigurationParameter_impl());
      try {
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

  public void testIteratorCopy() {
    Annotation something = new Annotation(jcas);
    something.addToIndexes();

    JFSIndexRepository ir = jcas.getJFSIndexRepository();
    FSIterator i1 = ir.getAnnotationIndex().iterator();
    FSIterator i2 = i1.copy();
    FSIterator i3 = i2.copy();
    assertTrue(i3 != null);
  }
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

      r2.addToIndexes();
      r1.addToIndexes();

      JFSIndexRepository jfsi = jcas.getJFSIndexRepository();
      FSIndex fsi1 = jfsi.getIndex("all", Root.type);
      FSIterator fsit1 = fsi1.iterator();
      assertTrue(fsit1.isValid());
      assertTrue(r2 == fsit1.get());
      fsit1.moveToNext();
      assertTrue(fsit1.isValid());
      assertTrue(r1 == fsit1.get());
      /*
       * while (fsit1.isValid()) { System.out.println("Iterator getting: " +
       * fsit1.get().toString()); fsit1.moveToNext(); }
       */

 
View Full Code Here

Examples of org.apache.uima.cas.FSIterator

      for (int i = 0; i < 50; i++) {
        root1.make();
        // System.out.print("m");
      }
      JFSIndexRepository jir = jcas.getJFSIndexRepository();
      FSIterator it = jir.getIndex("all", Root.type).iterator();
      // System.out.print("\nTesting Random: ");
      while (it.isValid()) {
        root1.test(it.get());
        // System.out.print("t");
        it.moveToNext();
      }
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.