Examples of FSMatchConstraint


Examples of org.apache.uima.cas.FSMatchConstraint

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

    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);

    FSMatchConstraint strictType = new StrictTypeConstraint(type);

    FSMatchConstraint annotatioInSpanConstraint = cf.and(embeddedBegin,
        embeddedEnd);

    FSMatchConstraint annotationInSpanAndStrictTypeConstraint = cf.and(
        annotatioInSpanConstraint, strictType);

    FSIndex allAnnotations = getCAS().getAnnotationIndex(type);

    FSIterator annotationInsideSpanIndex = getCAS().createFilteredIterator(
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

  }

  public FSIterator<AnnotationFS> getFilteredBasicIterator(FSMatchConstraint constraint) {
    ConstraintFactory cf = cas.getConstraintFactory();
    FSMatchConstraint matchConstraint = cf.and(constraint, filter.getDefaultConstraint());
    return cas.createFilteredIterator(basicIt, matchConstraint);
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    List<RutaBasic> result = new ArrayList<RutaBasic>();
    if (windowAnnotation instanceof RutaBasic) {
      result.add((RutaBasic) windowAnnotation);
      return result;
    }
    FSMatchConstraint defaultConstraint = filter.getDefaultConstraint();
    FSIterator<AnnotationFS> iterator = cas.createFilteredIterator(cas
            .getAnnotationIndex(basicType).subiterator(windowAnnotation), defaultConstraint);

    while (iterator.isValid()) {
      result.add((RutaBasic) iterator.get());
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    FeaturePath beginPath = cas.createFeaturePath();
    beginPath.addFeature(annotationType.getFeatureByBaseName("begin"));
    FSIntConstraint beginConstraint = cf.createIntConstraint();
    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);

    FSMatchConstraint strictType = new StrictTypeConstraint(type);

    FSMatchConstraint annotatioInSpanConstraint = cf.and(embeddedBegin, embeddedEnd);

    FSMatchConstraint annotationInSpanAndStrictTypeConstraint =
            cf.and(annotatioInSpanConstraint, strictType);

    FSIndex<AnnotationFS> allAnnotations = cas.getAnnotationIndex(type);

    FSIterator<AnnotationFS> annotationInsideSpanIndex =
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    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();
    endFP.addFeature(type.getFeatureByBaseName("end"));
    intConstraint = cf.createIntConstraint();
    intConstraint.leq(windowAnnotation.getEnd());
    FSMatchConstraint endConstraint = cf.embedConstraint(endFP, intConstraint);

    FSMatchConstraint windowConstraint = cf.and(beginConstraint, endConstraint);
    return windowConstraint;
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

        List<Type> subsumedTypes = cas.getTypeSystem().getProperlySubsumedTypes(type);
        filterTypes.removeAll(subsumedTypes);
      }
    }
    currentHiddenTypes = filterTypes;
    FSMatchConstraint typeConstraint = createTypeConstraint(filterTypes);

    FSMatchConstraint constraint = new NotConstraint(typeConstraint);
    if (additionalWindow != null && windowConstraint) {
      constraint = cf.and(additionalWindow, constraint);
    }
    return constraint;
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    if (begin == 0) {
      begin++;
    }
    AnnotationFS pointer = cas.createAnnotation(cas.getAnnotationType(), begin - 1, begin);
    FSIterator<AnnotationFS> it = cas.getAnnotationIndex().iterator(pointer);
    FSMatchConstraint constraint = getConstraint(cas);
    FSIterator<AnnotationFS> iterator = cas.createFilteredIterator(it, constraint);
    iterator.moveTo(pointer);

    int firstBegin = -1;
    while (iterator.isValid()) {
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    for (String each : getFilterSet()) {
      constraint.add(each);
    }
    constraint.add(RutaEngine.BASIC_TYPE);
    // TODO check if this is a legal alternative to "new NotConstraint(constraint)":
    FSMatchConstraint result = new FSMatchConstraint() {
      private static final long serialVersionUID = -6744378612440830298L;

      private final FSTypeConstraint c = constraint;

      public boolean match(FeatureStructure fs) {
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

  }

  public FSIterator<AnnotationFS> getFilteredBasicIterator(FSMatchConstraint constraint) {
    ConstraintFactory cf = cas.getConstraintFactory();
    FSMatchConstraint matchConstraint = cf.and(constraint, filter.getDefaultConstraint());
    return cas.createFilteredIterator(basicIt, matchConstraint);
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    List<RutaBasic> result = new ArrayList<RutaBasic>();
    if (windowAnnotation instanceof RutaBasic) {
      result.add((RutaBasic) windowAnnotation);
      return result;
    }
    FSMatchConstraint defaultConstraint = filter.getDefaultConstraint();
    FSIterator<AnnotationFS> iterator = cas.createFilteredIterator(cas
            .getAnnotationIndex(basicType).subiterator(windowAnnotation), defaultConstraint);

    while (iterator.isValid()) {
      result.add((RutaBasic) iterator.get());
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.