Package org.apache.uima.cas

Examples of org.apache.uima.cas.FeaturePath.initialize()


      }

      // test featurePath function not supported
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/stringFeature:coveredText()");
         featurePath.typeInit(cas.getDocumentAnnotation().getType());
         featurePath.getValueAsString(cas.getDocumentAnnotation());
      } catch (CASRuntimeException ex) {
         assertTrue(ex.getMessage().indexOf("uima.cas.String") > -1);
      }
View Full Code Here


      }

      // test featurePath function not supported
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/byteFeature:coveredText()");
         featurePath.typeInit(cas.getDocumentAnnotation().getType());
         featurePath.getValueAsString(cas.getDocumentAnnotation());
      } catch (CASRuntimeException ex) {
         assertTrue(ex.getMessage().indexOf("uima.cas.Byte") > -1);
      }
View Full Code Here

      }

      // test array featurePath
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/refFeature/fsArray/refFeature");
         featurePath.typeInit(cas.getDocumentAnnotation().getType());
         featurePath.getValueAsString(cas.getDocumentAnnotation());
      } catch (CASException ex) {
         assertTrue(ex.getMessage().indexOf("uima.tcas.DocumentAnnotation") > -1);
      }
View Full Code Here

      }

      // try to add a feature to the feature path with a built-in function
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/refFeature:coveredText()");
         featurePath.addFeature(refFeat);
      } catch (CASRuntimeException ex) {
         assertTrue(ex.getMessage().indexOf("refFeature") > -1);
      }
View Full Code Here

      // use featurePath object with an different type than used for typeInit()
      // and the case that type used for typeInit() has and featurePath that is
      // not always valid
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/refFeature/stringFeature");
         featurePath.typeInit(cas.getDocumentAnnotation().getType());

         Type testAnnotType = cas.getTypeSystem().getType(
               "uima.tt.TestAnnotation");
         AnnotationFS fs = cas.createAnnotation(testAnnotType, 0, 1);
View Full Code Here

      // use featurePath object with an different type than used for typeInit()
      // and the case that type used for typeInit() has and featurePath that is
      // always valid
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/stringFeature");
         featurePath.typeInit(cas.getDocumentAnnotation().getType());

         Type testAnnotType = cas.getTypeSystem().getType(
               "uima.tt.TestAnnotation");
         AnnotationFS fs = cas.createAnnotation(testAnnotType, 0, 1);
View Full Code Here

         assertTrue(ex.getMessage().indexOf("uima.tt.TestAnnotation") > -1);
      }

      // pass null as FS
      featurePath = new FeaturePathImpl();
      featurePath.initialize("/refFeature:coveredText()");
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      assertEquals(null, featurePath.getValueAsString(null));
      assertEquals(null, featurePath.getTypClass(null));
      assertEquals(null, featurePath.getType(null));
   }
View Full Code Here

      assertTrue(featurePath.size() == 2);
      assertTrue(featurePath.getFeature(1) == stringFeat);

      // test path always valid after addFeature()
      featurePath = new FeaturePathImpl();
      featurePath.initialize("/refFeature2");
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      featurePath.addFeature(stringFeat);

      // test path possible valid after addFeature()
      featurePath = new FeaturePathImpl();
View Full Code Here

      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      featurePath.addFeature(stringFeat);

      // test path possible valid after addFeature()
      featurePath = new FeaturePathImpl();
      featurePath.initialize("/refFeature2");
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      featurePath.addFeature(refFeat);
      featurePath.addFeature(stringFeat);

   }
View Full Code Here

      cas.getDocumentAnnotation().setStringValue(stringFeat, "MyExample");
      cas.getDocumentAnnotation().setFeatureValue(refFeat,
            cas.getDocumentAnnotation());

      FeaturePath featurePath = new FeaturePathImpl();
      featurePath.initialize("/refFeature2");
      featurePath.addFeature(stringFeat);

      assertEquals("MyExample", featurePath.getValueAsString(cas
            .getDocumentAnnotation()));
      assertEquals("/refFeature2/stringFeature", featurePath.getFeaturePath());
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.