Package org.apache.uima.ruta.expression.type

Examples of org.apache.uima.ruta.expression.type.TypeExpression


            if (value instanceof IStringExpression) {
              IStringExpression se = (IStringExpression) value;
              String string = se.getStringValue(parent, match, element, stream);
              targetEngine.setConfigParameterValue(stringValue, string);
            } else if (value instanceof TypeExpression) {
              TypeExpression te = (TypeExpression) value;
              Type t = te.getType(parent);
              targetEngine.setConfigParameterValue(stringValue, t.getName());
            }
          }
        } else if (type.equals("Float")) {
          if (value instanceof NumberListExpression) {
View Full Code Here


      Object valueObject = map.get(shortFName);
      Type range = targetFeature.getRange();
      if (valueObject != null) {
        if (valueObject instanceof TypeExpression
                && range.getName().equals(UIMAConstants.TYPE_STRING)) {
          TypeExpression type = (TypeExpression) valueObject;
          List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(matchedAnnotation,
                  type.getType(parent));
          if (annotationsInWindow != null && !annotationsInWindow.isEmpty()) {
            AnnotationFS annotation = annotationsInWindow.get(0);
            structure.setStringValue(targetFeature, annotation.getCoveredText());
          }
        } else if (valueObject instanceof IStringExpression
                && range.getName().equals(UIMAConstants.TYPE_STRING)) {
          structure.setStringValue(targetFeature, ((IStringExpression) valueObject).getStringValue(
                  parent, matchedAnnotation, stream));

        } else if (valueObject instanceof INumberExpression) {
          if (range.getName().equals(UIMAConstants.TYPE_INTEGER)) {
            structure.setIntValue(targetFeature, ((INumberExpression) valueObject).getIntegerValue(
                    parent, matchedAnnotation, stream));
          } else if (range.getName().equals(UIMAConstants.TYPE_DOUBLE)) {
            structure.setDoubleValue(targetFeature, ((INumberExpression) valueObject)
                    .getDoubleValue(parent, matchedAnnotation, stream));
          } else if (range.getName().equals(UIMAConstants.TYPE_FLOAT)) {
            structure.setFloatValue(targetFeature, ((INumberExpression) valueObject).getFloatValue(
                    parent, matchedAnnotation, stream));
          } else if (range.getName().equals(UIMAConstants.TYPE_BYTE)) {
            structure.setByteValue(targetFeature, (byte) ((INumberExpression) valueObject)
                    .getIntegerValue(parent, matchedAnnotation, stream));
          } else if (range.getName().equals(UIMAConstants.TYPE_SHORT)) {
            structure.setShortValue(targetFeature, (short) ((INumberExpression) valueObject)
                    .getIntegerValue(parent, matchedAnnotation, stream));
          } else if (range.getName().equals(UIMAConstants.TYPE_LONG)) {
            structure.setLongValue(targetFeature, (long) ((INumberExpression) valueObject)
                    .getIntegerValue(parent, matchedAnnotation, stream));
          }
        } else if (valueObject instanceof IBooleanExpression
                && range.getName().equals(UIMAConstants.TYPE_BOOLEAN)) {
          structure.setBooleanValue(targetFeature, ((IBooleanExpression) valueObject)
                  .getBooleanValue(parent, matchedAnnotation, stream));
        } else if (valueObject instanceof TypeExpression) {
          TypeExpression type = (TypeExpression) valueObject;
          List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(matchedAnnotation,
                  type.getType(parent));
          if (typeSystem.subsumes(jcas.getCasType(FSArray.type), range)) {
            structure
                    .setFeatureValue(targetFeature, UIMAUtils.toFSArray(jcas, annotationsInWindow));
          } else if (typeSystem.subsumes(range, type.getType(parent))
                  && !annotationsInWindow.isEmpty()) {
            AnnotationFS annotation = annotationsInWindow.get(0);
            structure.setFeatureValue(targetFeature, annotation);
          }
        }
View Full Code Here

    Map<String, Type> typeMap = new HashMap<String, Type>();
    RutaBlock parent = element.getParent();
    for (IStringExpression eachKey : map.keySet()) {
      String stringValue = eachKey.getStringValue(parent, match, element, stream);
      TypeExpression typeExpression = map.get(eachKey);
      if (typeExpression != null) {
        Type typeValue = typeExpression.getType(parent);
        typeMap.put(stringValue, typeValue);
      }
    }
    boolean ignoreCaseValue = ignoreCase.getBooleanValue(parent, match, element, stream);
    int ignoreLengthValue = ignoreLength.getIntegerValue(parent, match, element, stream);
View Full Code Here

                && expr instanceof IBooleanExpression) {
          IBooleanExpression booleanExpr = (IBooleanExpression) expr;
          boolean v = booleanExpr.getBooleanValue(parent, match, element, stream);
          annotationFS.setBooleanValue(feature, v);
        } else if (expr instanceof TypeExpression) {
          TypeExpression typeExpr = (TypeExpression) expr;
          Type t = typeExpr.getType(parent);
          List<AnnotationFS> inWindow = stream.getAnnotationsInWindow(annotationFS, t);
          if (feature.getRange().isArray()) {
            annotationFS.setFeatureValue(feature, UIMAUtils.toFSArray(stream.getJCas(), inWindow));
          } else {
            AnnotationFS annotation = inWindow.get(0);
View Full Code Here

        List<String> l = new ArrayList<String>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          basicCount++;
        }
      } else if (arg instanceof TypeExpression && argList instanceof TypeListExpression) {
        TypeExpression e = (TypeExpression) arg;
        TypeListExpression le = (TypeListExpression) argList;
        Type v = e.getType(element.getParent());
        List<Type> l = new ArrayList<Type>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          basicCount++;
        }
      }
View Full Code Here

    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());
    }
View Full Code Here

        List<String> l = new ArrayList<String>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          count++;
        }
      } else if (arg instanceof TypeExpression && list instanceof TypeListExpression) {
        TypeExpression e = (TypeExpression) arg;
        TypeListExpression le = (TypeListExpression) list;
        Type v = e.getType(element.getParent());
        List<Type> l = new ArrayList<Type>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          count++;
        }
      }
View Full Code Here

    this.expr = expr;
  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    TypeExpression typeExpr = expr.getTypeExpr();
    Type type = typeExpr.getType(element.getParent());
    List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotationsOf(element);
    Collection<AnnotationFS> annotations = new TreeSet<AnnotationFS>(comp);
    for (AnnotationFS annotation : matchedAnnotations) {
      annotations.addAll(getAnnotations(annotation, type, expr, stream));
    }
View Full Code Here

    } else if (argExpr instanceof IBooleanExpression && (range.equals(UIMAConstants.TYPE_BOOLEAN))) {
      IBooleanExpression booleanExpr = (IBooleanExpression) argExpr;
      boolean v = booleanExpr.getBooleanValue(element.getParent(), a, stream);
      a.setBooleanValue(feature, v);
    } else if (argExpr instanceof TypeExpression && !feature.getRange().isPrimitive()) {
      TypeExpression typeExpr = (TypeExpression) argExpr;
      Type t = typeExpr.getType(element.getParent());
      List<AnnotationFS> inWindow = stream.getAnnotationsInWindow(a, t);
      if (feature.getRange().isArray()) {
        a.setFeatureValue(feature, UIMAUtils.toFSArray(stream.getJCas(), inWindow));
      } else {
        AnnotationFS annotation = inWindow.get(0);
View Full Code Here

      String var = a.getVar();
      String op = verbalizer.verbalize(a.getOpExpr());
      return name + var + ", " + op + ")";
    } else if (action instanceof MarkTableAction) {
      MarkTableAction a = (MarkTableAction) action;
      TypeExpression typeExpr = a.getTypeExpr();
      INumberExpression indexExpr = a.getIndexExpr();
      WordTableExpression tableExpr = a.getTableExpr();
      Map<IStringExpression, INumberExpression> featureMap = a.getFeatureMap();
      IBooleanExpression ignoreCase = a.getIgnoreCase();
      INumberExpression ignoreLength = a.getIgnoreLength();
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.expression.type.TypeExpression

Copyright © 2018 www.massapicom. 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.