Package org.apache.uima.cas

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


            .getDocumentAnnotation()));

      // test typeName()
      path = "/refFeature:typeName()";
      featurePath = new FeaturePathImpl();
      featurePath.initialize(path);
      assertEquals(path, featurePath.getFeaturePath());
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      assertEquals("uima.tcas.DocumentAnnotation", featurePath
            .getValueAsString(cas.getDocumentAnnotation()));
View Full Code Here


            .getValueAsString(cas.getDocumentAnnotation()));

      // test typeName()
      path = "/refFeature/refFeature/refFeature/refFeature/refFeature/refFeature/refFeature:typeName()";
      featurePath = new FeaturePathImpl();
      featurePath.initialize(path);
      assertEquals(path, featurePath.getFeaturePath());
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      assertEquals("uima.tcas.DocumentAnnotation", featurePath
            .getValueAsString(cas.getDocumentAnnotation()));
View Full Code Here

            .getValueAsString(cas.getDocumentAnnotation()));

      // test typeName() on root
      path = ":typeName()";
      featurePath = new FeaturePathImpl();
      featurePath.initialize(path);
      assertEquals(path, featurePath.getFeaturePath());
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      assertEquals("uima.tcas.DocumentAnnotation", featurePath
            .getValueAsString(cas.getDocumentAnnotation()));
View Full Code Here

            .getValueAsString(cas.getDocumentAnnotation()));

      // test coveredText() on root
      path = "/:coveredText()";
      featurePath = new FeaturePathImpl();
      featurePath.initialize(path);
      assertEquals(path, featurePath.getFeaturePath());
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      assertEquals(cas.getDocumentText(), featurePath.getValueAsString(cas
            .getDocumentAnnotation()));
      assertEquals(cas.getDocumentText(), featurePath.ll_getValueAsString(cas.getLowLevelCAS().ll_getFSRef(
View Full Code Here

      assertEquals(TypeClass.TYPE_CLASS_FS, featurePath.getTypClass(cas.getDocumentAnnotation()));

      // test fsId() on root
      path = "/:fsId()";
      featurePath = new FeaturePathImpl();
      featurePath.initialize(path);
      assertEquals(path, featurePath.getFeaturePath());
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
      assertEquals("8", featurePath.getValueAsString(cas
            .getDocumentAnnotation()));
View Full Code Here

            cas.getDocumentAnnotation());

      // test featurePath = null
      FeaturePath featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize(null);
      } catch (CASException ex) {
         assertTrue(ex.getMessage().indexOf("Invalid featurePath") > -1);
      }

      // test featurePath syntax error
View Full Code Here

      }

      // test featurePath syntax error
      featurePath = new FeaturePathImpl();
      try {
         featurePath.initialize("feature//path");
      } catch (CASException ex) {
         assertTrue(ex.getMessage().indexOf("//") > -1);
      }

      // test non supported built-in function
View Full Code Here

      }

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

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.