Package org.apache.uima.cas

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


      }

      // test non supported built-in function
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("feature/path:test()");
      } catch (CASException ex) {
         assertTrue(ex.getMessage().indexOf("test()") > -1);
      }

      // test featurePath contains primitive feature in path
View Full Code Here


      }

      // test featurePath contains primitive feature in path
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/refFeature/stringFeature/refFeature");
         // featurePath.typeSystemInit(cas.getDocumentAnnotation().getType());
         System.out.println(featurePath.getStringValue(cas
               .getDocumentAnnotation()));
      } catch (CASRuntimeException ex) {
         assertTrue(ex.getMessage().indexOf("stringFeature") > -1);
View Full Code Here

      }

      // test featurePath feature not defined
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("/refFeature/refFeatureNotDef");
         // featurePath.typeSystemInit(cas.getDocumentAnnotation().getType());
         featurePath.getValueAsString(cas.getDocumentAnnotation());
      } catch (CASRuntimeException ex) {
         assertTrue(ex.getMessage().indexOf("refFeatureNotDef") > -1);
      }
View Full Code Here

      }

      // 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

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.