Examples of FeatureMatchExpression


Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

    return new SimpleFeatureExpression(te, featureReferences);
  }

  public static FeatureMatchExpression createFeatureMatchExpression(FeatureExpression f, Token op,
          IRutaExpression arg, RutaBlock env) {
    return new FeatureMatchExpression(f, op.getText(), arg);
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

  private boolean checkFeature(AnnotationFS annotation, RutaStream stream, RutaBlock parent) {
    FeatureExpression fe = mr.getFeatureExpression(parent, stream);
    Feature feature = fe.getFeature(parent);
    if (fe instanceof FeatureMatchExpression) {
      FeatureMatchExpression fme = (FeatureMatchExpression) fe;
      boolean checkFeatureValue = fme.checkFeatureValue(annotation, stream, parent);
      if (checkFeatureValue) {
        return true;
      }
    } else {
      TypeSystem typeSystem = stream.getCas().getTypeSystem();
View Full Code Here

Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

      if (tail != null) {
        if (op == null) {
          featureExpression = new SimpleFeatureExpression(typeExpression, tail);
        } else {
          SimpleFeatureExpression expr = new SimpleFeatureExpression(typeExpression, tail);
          featureExpression = new FeatureMatchExpression(expr, op, arg);
        }
      }
    }
    if(typeExpression == null || typeExpression.getType(parent) == null) {
      throw new IllegalArgumentException("Not able to resolve type of expression: "+ match);
View Full Code Here

Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

          InferenceCrowd crowd) {
    if (expr instanceof IBooleanExpression) {
      IBooleanExpression be = (IBooleanExpression) expr;
      return new EvaluatedCondition(this, be.getBooleanValue(element.getParent(), null, stream));
    } else if (expr instanceof FeatureMatchExpression) {
      FeatureMatchExpression fme = (FeatureMatchExpression) expr;
      TypeExpression typeExpr = fme.getTypeExpr();
      Type type = typeExpr.getType(element.getParent());
      List<AnnotationFS> annotations = getAnnotationsToCheck(annotation, type, fme, stream);
      Collection<AnnotationFS> featureAnnotations = fme.getFeatureAnnotations(annotations, stream,
              element.getParent(), true);
      return new EvaluatedCondition(this, !featureAnnotations.isEmpty());
    }
    return new EvaluatedCondition(this, false);
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

  private boolean checkFeature(AnnotationFS annotation, RutaStream stream, RutaBlock parent) {
    FeatureExpression fe = mr.getFeatureExpression(parent, stream);
    Feature feature = fe.getFeature(parent);
    if (fe instanceof FeatureMatchExpression) {
      FeatureMatchExpression fme = (FeatureMatchExpression) fe;
      boolean checkFeatureValue = fme.checkFeatureValue(annotation, stream, parent);
      if (checkFeatureValue) {
        return true;
      }
    } else {
      TypeSystem typeSystem = stream.getCas().getTypeSystem();
View Full Code Here

Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

      if (tail != null) {
        if (op == null) {
          featureExpression = new SimpleFeatureExpression(typeExpression, tail);
        } else {
          SimpleFeatureExpression expr = new SimpleFeatureExpression(typeExpression, tail);
          featureExpression = new FeatureMatchExpression(expr, op, arg);
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

          InferenceCrowd crowd) {
    if (expr instanceof BooleanExpression) {
      BooleanExpression be = (BooleanExpression) expr;
      return new EvaluatedCondition(this, be.getBooleanValue(element.getParent(), null, stream));
    } else if (expr instanceof FeatureMatchExpression) {
      FeatureMatchExpression fme = (FeatureMatchExpression) expr;
      TypeExpression typeExpr = fme.getTypeExpr();
      Type type = typeExpr.getType(element.getParent());
      List<AnnotationFS> annotations = getAnnotationsToCheck(annotation, type, fme, stream);
      Collection<AnnotationFS> featureAnnotations = fme.getFeatureAnnotations(annotations, stream,
              element.getParent(), true);
      return new EvaluatedCondition(this, !featureAnnotations.isEmpty());
    }
    return new EvaluatedCondition(this, false);
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.feature.FeatureMatchExpression

    return new SimpleFeatureExpression(te, featureReferences);
  }

  public static FeatureMatchExpression createFeatureMatchExpression(FeatureExpression f, Token op,
          RutaExpression arg, RutaBlock env) {
    return new FeatureMatchExpression(f, op.getText(), arg);
  }
View Full Code Here

Examples of org.apache.uima.ruta.ide.parser.ast.FeatureMatchExpression

    if (s instanceof RutaRuleElement) {
      RutaRuleElement re = (RutaRuleElement) s;
      Expression head = re.getHead();
      if (head instanceof FeatureMatchExpression) {
        FeatureMatchExpression fme = (FeatureMatchExpression) head;
        String text = fme.getFeature().getText();
        int lastIndexOf = text.lastIndexOf('.');
        String twf = text.substring(0, lastIndexOf);
        if (getVariableType(twf) == RutaTypeConstants.RUTA_TYPE_AT) {
          matchedType = twf;
        } else {
          twf = expand(twf);
          matchedType = isFeatureMatch(twf);
        }
      } else if (head != null) {
        matchedType = sourceModule.getSource().substring(head.sourceStart(), head.sourceEnd());
      }
      // cache long name
      matchedType = expand(matchedType);
      if (matchedType == null) {
        matchedType = "uima.tcas.Annotation";
      }
    }
    if (s instanceof FeatureMatchExpression) {
      FeatureMatchExpression fme = (FeatureMatchExpression) s;
      String featText = fme.getFeature().getText();
      checkTypeOfFeatureMatch(featText, fme);
      return true;
    }
    if (s instanceof RutaVariableReference) {
      RutaVariableReference ref = (RutaVariableReference) s;
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.