Examples of RutaBlock


Examples of org.apache.uima.ruta.RutaBlock

  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    List<Type> types = new ArrayList<Type>();
    RutaBlock parent = element.getParent();
    if (element instanceof RutaRuleElement) {
      types = ((RutaRuleElement) element).getMatcher().getTypes(parent, stream);
    }
    if (types == null)
      return;

    for (Type type : types) {
      String stringValue = featureStringExpression.getStringValue(parent, match, element, stream);
      Feature featureByBaseName = type.getFeatureByBaseName(stringValue);
      RutaEnvironment environment = parent.getEnvironment();
      List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotationsOf(element);
      for (AnnotationFS annotationFS : matchedAnnotations) {
        if (annotationFS.getType().getFeatureByBaseName(stringValue) == null) {
          System.out.println("Can't access feature " + stringValue
                  + ", because it's not defined in the matched type: " + annotationFS.getType());
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    RutaEnvironment environment = parent.getEnvironment();
    List list = environment.getVariableValue(var, List.class);
    // Class<?> vtype = environment.getVariableType(var);
    Class<?> vgtype = environment.getVariableGenericType(var);
    for (RutaExpression each : elements) {
      if (each instanceof ListExpression) {
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

    this.parameterMap = map;
  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    RutaModule thisScript = parent.getScript();
    AnalysisEngine targetEngine = thisScript.getEngine(namespace);
    ConfigurationParameterDeclarations configurationParameterDeclarations = targetEngine
            .getAnalysisEngineMetaData().getConfigurationParameterDeclarations();

    Set<Entry<StringExpression, RutaExpression>> entrySet = parameterMap.entrySet();
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

  }

  protected void fillFeatures(TOP structure, Map<StringExpression, RutaExpression> features,
          AnnotationFS matchedAnnotation, RuleElement element, RutaStream stream) {
    Map<String, RutaExpression> map = new HashMap<String, RutaExpression>();
    RutaBlock parent = element.getParent();
    for (Entry<StringExpression, RutaExpression> each : features.entrySet()) {
      String value = each.getKey().getStringValue(parent, matchedAnnotation, stream);
      map.put(value, each.getValue());
    }
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

  }

  @SuppressWarnings({ "rawtypes" })
  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    List list = parent.getEnvironment().getVariableValue(var, List.class);
    List<Object> toRemove = new ArrayList<Object>();
    for (Object entry : list) {
      Object value1 = getValue(entry, parent, stream);
      for (RutaExpression arg : elements) {
        if (arg instanceof ListExpression) {
          ListExpression l = (ListExpression) arg;
          List list2 = l.getList(parent, stream);
          for (Object object : list2) {
            Object value2 = getValue(object, parent, stream);
            if (value1.equals(value2)) {
              toRemove.add(entry);
            }
          }
        } else {
          Object value2 = getValue(arg, parent, stream);
          if (value1.equals(value2)) {
            toRemove.add(entry);
          }
        }
      }
    }
    for (Object object : toRemove) {
      list.remove(object);
    }
    parent.getEnvironment().setVariableValue(var, list);
  }
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

    Type casType = stream.getJCas().getCasType(RutaColoring.type);
    FeatureStructure newAnnotationFS = stream.getCas().createFS(casType);
    RutaColoring coloring = null;
    if (newAnnotationFS instanceof RutaColoring) {
      coloring = (RutaColoring) newAnnotationFS;
      RutaBlock parent = element.getParent();
      coloring.setBgColor(bgcolor.getStringValue(parent, match, element, stream));
      coloring.setFgColor(fgcolor.getStringValue(parent, match, element, stream));
      coloring.setSelected(selected.getBooleanValue(parent, match, element, stream));
      coloring.setTargetType(type.getType(parent).getName());
      coloring.addToIndexes();
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

    this.maxIgnoreChar = maxIgnoreChar;
  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock block = element.getParent();
    RutaTable table = tableExpr.getTable(block);
    int index = indexExpr.getIntegerValue(block, match, element, stream);
    Type type = typeExpr.getType(block);
    Map<String, Integer> map = new HashMap<String, Integer>();
    for (StringExpression each : featureMap.keySet()) {
View Full Code Here

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

    // commentLineSince = 0;
    // }
    // }

    if (s instanceof RutaBlock) {
      RutaBlock b = (RutaBlock) s;
      appendIntoNewLine("BLOCK(");
      append(b.getName());
      append(") ");
      this.inBlockDeclaration = true;
      if (b.getRule() != null) {
        b.getRule().traverse(this);
      }
      this.inBlockDeclaration = false;
      append(" {");
      indentLevel++;
      b.getBody().traverse(this);
      lastStatements.put(indentLevel, null);
      indentLevel--;
      lastStatements.put(indentLevel, s);
      appendIntoNewLine("}");
      appendNewLine();
View Full Code Here

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

  }

  @Override
  public boolean visit(MethodDeclaration s) throws Exception {
    if (s instanceof RutaBlock) {
      RutaBlock b = (RutaBlock) s;
      knownLocalVariables.push(new HashMap<String, Integer>());
      String name = b.getName();
      blocks.push(name);
      // TODO add syntax check for block extensions
    }

    return true;
View Full Code Here

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

    // commentLineSince = 0;
    // }
    // }

    if (s instanceof RutaBlock) {
      RutaBlock b = (RutaBlock) s;
      appendIntoNewLine("BLOCK(");
      append(b.getName());
      append(") ");
      this.inBlockDeclaration = true;
      if (b.getRule() != null) {
        b.getRule().traverse(this);
      }
      this.inBlockDeclaration = false;
      append(" {");
      indentLevel++;
      b.getBody().traverse(this);
      lastStatements.put(indentLevel, null);
      indentLevel--;
      lastStatements.put(indentLevel, s);
      appendIntoNewLine("}");
      appendNewLine();
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.