Examples of FSMatchConstraint


Examples of org.apache.uima.cas.FSMatchConstraint

                                            Object[]    values)
        {
            ConstraintFactory cf = jcas.getConstraintFactory();

            FeaturePath feature_path = m_feat2path.get(feature_name);
            FSMatchConstraint feat_mc = null;
            for (int i = 0; i < values.length; ++i) {
                FSStringConstraint val_sc = cf.createStringConstraint();
                val_sc.equals(values[i].toString());
                if (null == feat_mc) {
                    feat_mc = cf.embedConstraint(feature_path, val_sc);
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);
      }
    }

    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

  }

  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

    if (windowAnnotation != null
            && (annotationFS.getBegin() < windowAnnotation.getBegin() || annotationFS.getEnd() > windowAnnotation
                    .getEnd())) {
      return false;
    }
    FSMatchConstraint defaultConstraint = filter.getDefaultConstraint();
    return defaultConstraint.match(annotationFS);
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

  }

  public FSMatchConstraint createAnchorConstraints(RutaBlock block, RutaStream stream) {
    ConstraintFactory cf = stream.getCas().getConstraintFactory();
    List<Type> types = getTypes(block, stream);
    FSMatchConstraint result = null;

    for (Type eachType : types) {
      BasicTypeConstraint anchorConstraint = new BasicTypeConstraint(cf.createTypeConstraint(),
              eachType);
      anchorConstraint.add(eachType);
View Full Code Here

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<AnnotationFS> allAnnotations = getCAS().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

    Set<Type> filterTypes = new HashSet<Type>();
    filterTypes.addAll(defaultFilterTypes);
    filterTypes.addAll(currentFilterTypes);
    filterTypes.removeAll(currentRetainTypes);

    FSMatchConstraint typeConstraint = createTypeConstraint(filterTypes);

    FSMatchConstraint constraint = new NotConstraint(typeConstraint);
    if (additionalWindow != null && windowConstraint) {
      constraint = cf.and(additionalWindow, constraint);
    }
    return constraint;
  }
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.