Package org.apache.uima.cas

Examples of org.apache.uima.cas.CAS.createFS()


      FeatureStructure newFS = null;
      if (each instanceof AnnotationFS) {
        newFS = transformAnnotation((AnnotationFS) each, newType, new2oldBegin, new2oldEnd, stream, match);
      } else {
        newFS = cas.createFS(newType);
        fillFeatures(each, newFS, newFS.getType(), new2oldBegin, new2oldEnd, stream, match);
      }
      cas.addFsToIndexes(newFS);
    }
  }
View Full Code Here


          Map<Integer, Integer> new2oldBegin, Map<Integer, Integer> new2oldEnd,
          RutaStream stream, RuleMatch match) {
    CAS cas = stream.getCas();
    Integer beginOld = annotation.getBegin();
    Integer endOld = annotation.getEnd();
    FeatureStructure newFS = cas.createFS(newType);
    fillFeatures(annotation, newFS, newType, new2oldBegin, new2oldEnd, stream, match);

    Integer beginNew = new2oldBegin.get(beginOld);
    Integer endNew = new2oldEnd.get(endOld);
    if (endNew == null && beginNew != null) {
View Full Code Here

      FeatureStructure oldFeatureFS = oldFS.getFeatureValue(oldFeature);
      FeatureStructure newFeatureFS = null;
      if (oldRange.isArray()) {
        newFeatureFS = cas.createArrayFS(0);
      } else {
        newFeatureFS = cas.createFS(feature.getRange());
      }
      if (newFeatureFS instanceof AnnotationFS) {
        transformAnnotation((AnnotationFS) newFeatureFS, newFeatureFS.getType(), new2oldBegin,
                new2oldEnd, stream, match);
      } else {
View Full Code Here

    if (creator != null) {
      ruleString = verbalizer.verbalize(creator.getRule());
      ruleId = creator.getRule().getId();
      ruleScript = creator.getRule().getParent().getScript().getRootBlock().getNamespace();
    }
    FeatureStructure fs = cas.createFS(t);
    fs.setStringValue(featureRule, ruleString);
    fs.setFeatureValue(featureAnnotation, annotation);
    fs.setIntValue(featureId, ruleId);
    fs.setStringValue(featureScript, ruleScript);
    fsList.add(fs);
View Full Code Here

    Type t = type.getType(element.getParent());
    for (List<RuleElementMatch> eachList : list) {
      for (RuleElementMatch each : eachList) {
        List<AnnotationFS> matched = each.getTextsMatched();
        for (AnnotationFS annotationFS : matched) {
          FeatureStructure createFS = cas.createFS(t);
          copyFeatures(annotationFS, createFS, cas);
          if (createFS instanceof AnnotationFS) {
            stream.addAnnotation((AnnotationFS) createFS, match);
          }
          cas.addFsToIndexes(createFS);
View Full Code Here

      CAS inputCas1 = tae.newCAS();
      Type sdiType = inputCas1.getTypeSystem().getType(
              "org.apache.uima.examples.SourceDocumentInformation");
      Feature uriFeat = sdiType.getFeatureByBaseName("uri");
      inputCas1.setDocumentText("This is");
      FeatureStructure sdiFS = inputCas1.createFS(sdiType);
      sdiFS.setStringValue(uriFeat, "cas1");
      inputCas1.getIndexRepository().addFS(sdiFS);
      CAS inputCas2 = tae.newCAS();
      inputCas2.setDocumentText(" one.\nThis is");
      FeatureStructure sdiFS2 = inputCas2.createFS(sdiType);
View Full Code Here

      FeatureStructure sdiFS = inputCas1.createFS(sdiType);
      sdiFS.setStringValue(uriFeat, "cas1");
      inputCas1.getIndexRepository().addFS(sdiFS);
      CAS inputCas2 = tae.newCAS();
      inputCas2.setDocumentText(" one.\nThis is");
      FeatureStructure sdiFS2 = inputCas2.createFS(sdiType);
      sdiFS2.setStringValue(uriFeat, "cas2");
      inputCas2.getIndexRepository().addFS(sdiFS2);
      CAS inputCas3 = tae.newCAS();
      inputCas3.setDocumentText(" two.\n");
      FeatureStructure sdiFS3 = inputCas3.createFS(sdiType);
View Full Code Here

      FeatureStructure sdiFS2 = inputCas2.createFS(sdiType);
      sdiFS2.setStringValue(uriFeat, "cas2");
      inputCas2.getIndexRepository().addFS(sdiFS2);
      CAS inputCas3 = tae.newCAS();
      inputCas3.setDocumentText(" two.\n");
      FeatureStructure sdiFS3 = inputCas3.createFS(sdiType);
      sdiFS3.setStringValue(uriFeat, "cas3");
      inputCas3.getIndexRepository().addFS(sdiFS3);

      // input first CAS. Should be no segments yet.
      CasIterator iter = tae.processAndOutputNewCASes(inputCas1);
View Full Code Here

    try {
      CAS localCas = jcas.getCas();
      Type subTok = localCas.getTypeSystem().getType("SubToken");
      Annotation a1 = new Annotation(jcas);
      a1.addToIndexes();
      FeatureStructure f1 = localCas.createFS(subTok);
      localCas.getIndexRepository().addFS(f1);

      JFSIndexRepository ir = jcas.getJFSIndexRepository();
      FSIndex index = ir.getAnnotationIndex();
      FSIterator it = index.iterator();
View Full Code Here

  public void testFSListNotPromoted() throws Exception {
    try {
      CAS localCas = jcas.getCas();
      TypeSystem ts = localCas.getTypeSystem();
      Type fsl = ts.getType("uima.cas.NonEmptyFSList");
      FeatureStructure fs = localCas.createFS(fsl);
      assertTrue(fs instanceof NonEmptyFSList);
    } 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.