Examples of FSMatchConstraint


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

  }

  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

    AnnotationFS windowAnnotation = filter.getWindowAnnotation();
    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

    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

Examples of org.apache.uima.cas.FSMatchConstraint

           ClassNotFoundException,
           IllegalAccessException,
           NoSuchFieldException
    {
        EnclosedConstraintDescriptor ecDescr = new EnclosedConstraintDescriptor(jcas, enclosed);
        FSMatchConstraint mcBounds = ecDescr.createConstraint(jcas, begin_lower, begin_upper, end_lower, end_upper);
        return ecDescr.createFilteredIterator(jcas, mcBounds);
    }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

           ClassNotFoundException,
           IllegalAccessException,
           NoSuchFieldException
    {
        EnclosedConstraintDescriptor ecDescr = new EnclosedConstraintDescriptor(jcas, Annotation.typeIndexID);
        FSMatchConstraint mcBounds = ecDescr.createConstraint(jcas, begin_lower, begin_upper, end_lower, end_upper);
       
        if ((null != enclosedTypes) && (0 < enclosedTypes.length)) {
            ConstraintFactory cf = jcas.getConstraintFactory();
            FSTypeConstraint tc = cf.createTypeConstraint();
            for (int i = 0; i < enclosedTypes.length; ++i) {
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    {
       
        EnclosedConstraintDescriptor ecDescr = new EnclosedConstraintDescriptor(jcas, enclosed);
        FeatureConstraintDescriptor fcDescr = new FeatureConstraintDescriptor(jcas, enclosed, Arrays.asList(new String[] {feat_name}));
       
        FSMatchConstraint mc_bounds = ecDescr.createConstraint(jcas, begin_lower, begin_upper, end_lower, end_upper);
        FSMatchConstraint mc_feature = fcDescr.createConstraint(jcas, feat_name, values);
       
        return fcDescr.createFilteredIterator(jcas, jcas.getConstraintFactory().and(mc_bounds, mc_feature));
    }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

            FeaturePath end_fp = m_feat2path.get("end");             

            ConstraintFactory cf = jcas.getConstraintFactory();
            FSIntConstraint bcLower = cf.createIntConstraint();
            bcLower.geq(begin_lower);
            FSMatchConstraint mcBegin = cf.embedConstraint(begin_fp, bcLower);
            if (begin_upper > begin_lower) {
                FSIntConstraint bcUpper = cf.createIntConstraint();
                bcUpper.lt(begin_upper);
                mcBegin = cf.and(mcBegin, cf.embedConstraint(begin_fp, bcUpper));
            }

            FSIntConstraint ecUpper = cf.createIntConstraint();
            ecUpper.leq(end_upper);        
            FSMatchConstraint mcEnd = cf.embedConstraint(end_fp, ecUpper);
            if (end_upper > end_lower) {
                FSIntConstraint ecLower = cf.createIntConstraint();
                ecLower.gt(end_lower);
                mcEnd = cf.and(mcEnd, cf.embedConstraint(end_fp, ecLower));
            }
           
            FSMatchConstraint mcBounds = cf.and(mcBegin, mcEnd);
            return mcBounds;
        }
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.