Package org.apache.uima.cas

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


    ConstraintFactory cf = getCAS().getConstraintFactory();

    Type annotationType = getCAS().getAnnotationType();

    FeaturePath beginPath = getCAS().createFeaturePath();
    beginPath.addFeature(annotationType.getFeatureByBaseName("begin"));
    FSIntConstraint beginConstraint = cf.createIntConstraint();
    beginConstraint.geq(span.getStart());

    FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath,
        beginConstraint);
View Full Code Here


    FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath,
        beginConstraint);

    FeaturePath endPath = getCAS().createFeaturePath();
    endPath.addFeature(annotationType.getFeatureByBaseName("end"));
    FSIntConstraint endConstraint = cf.createIntConstraint();
    endConstraint.leq(span.getEnd());

    FSMatchConstraint embeddedEnd = cf.embedConstraint(endPath,
        endConstraint);
View Full Code Here

    ConstraintFactory cf = cas.getConstraintFactory();

    Type annotationType = cas.getAnnotationType();

    FeaturePath beginPath = cas.createFeaturePath();
    beginPath.addFeature(annotationType.getFeatureByBaseName("begin"));
    FSIntConstraint beginConstraint = cf.createIntConstraint();
    beginConstraint.geq(span.getStart());

    FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath, beginConstraint);
View Full Code Here

    beginConstraint.geq(span.getStart());

    FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath, beginConstraint);

    FeaturePath endPath = cas.createFeaturePath();
    endPath.addFeature(annotationType.getFeatureByBaseName("end"));
    FSIntConstraint endConstraint = cf.createIntConstraint();
    endConstraint.leq(span.getEnd());

    FSMatchConstraint embeddedEnd = cf.embedConstraint(endPath, endConstraint);
View Full Code Here

  private FSMatchConstraint createWindowConstraint(AnnotationFS windowAnnotation, CAS cas) {
    if (windowAnnotation == null)
      return null;
    FeaturePath beginFP = cas.createFeaturePath();
    Type type = windowAnnotation.getType();
    beginFP.addFeature(type.getFeatureByBaseName("begin"));
    FSIntConstraint intConstraint = cf.createIntConstraint();
    intConstraint.geq(windowAnnotation.getBegin());
    FSMatchConstraint beginConstraint = cf.embedConstraint(beginFP, intConstraint);

    FeaturePath endFP = cas.createFeaturePath();
View Full Code Here

    FSIntConstraint intConstraint = cf.createIntConstraint();
    intConstraint.geq(windowAnnotation.getBegin());
    FSMatchConstraint beginConstraint = cf.embedConstraint(beginFP, intConstraint);

    FeaturePath endFP = cas.createFeaturePath();
    endFP.addFeature(type.getFeatureByBaseName("end"));
    intConstraint = cf.createIntConstraint();
    intConstraint.leq(windowAnnotation.getEnd());
    FSMatchConstraint endConstraint = cf.embedConstraint(endFP, intConstraint);

    FSMatchConstraint windowConstraint = cf.and(beginConstraint, endConstraint);
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);
      }

      // use featurePath object with an different type than used for typeInit()
View Full Code Here

      cas.getDocumentAnnotation().setFeatureValue(refFeat,
            cas.getDocumentAnnotation());

      // create featurePath with add() API
      FeaturePath featurePath = new FeaturePathImpl();
      featurePath.addFeature(refFeat);
      featurePath.addFeature(stringFeat);

      assertEquals("MyExample", featurePath.getValueAsString(cas
            .getDocumentAnnotation()));
      assertEquals("/refFeature/stringFeature", featurePath.getFeaturePath());
View Full Code Here

            cas.getDocumentAnnotation());

      // create featurePath with add() API
      FeaturePath featurePath = new FeaturePathImpl();
      featurePath.addFeature(refFeat);
      featurePath.addFeature(stringFeat);

      assertEquals("MyExample", featurePath.getValueAsString(cas
            .getDocumentAnnotation()));
      assertEquals("/refFeature/stringFeature", featurePath.getFeaturePath());
      assertTrue(featurePath.size() == 2);
View Full Code Here

      // 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();
      featurePath.initialize("/refFeature2");
      featurePath.typeInit(cas.getDocumentAnnotation().getType());
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.