Package lupos.rif.model

Examples of lupos.rif.model.RuleVariable


    external.setParent(argu);
    return external;
  }

  public Object visit(final RIFVar n, final IRuleNode argu) {
    final RuleVariable var = new RuleVariable((String) n.f1.accept(this,
        argu));
    var.setParent(argu);
    return var;
  }
View Full Code Here


      Conjunction conjunction = new Conjunction();
      conjunction.setParent(arg);
      int iteration = 0;
      //Listenidentifikator erstellen
      String baseName = aliasString + "list" + listCtr++ + "it";
      conjunction.addExpr(new RuleVariable(baseName + iteration));
      int ctr = obj.getItems().size();
      for (IExpression expr : obj.getItems()) {
        ctr--;
        IRuleNode result = expr.accept(this, conjunction);
        final String itVar = baseName + iteration++;
        if (result instanceof Conjunction) {
          for (IExpression item : new ArrayList<IExpression>(
              ((Conjunction) result).exprs))
            if (item instanceof RulePredicate)
              conjunction.addExpr(item);
            else if (item instanceof RuleVariable)
              result = item;
        }
        final RulePredicate item = new RulePredicate(
            new RuleVariable(itVar),
            new Constant(
                LiteralFactory
                    .createURILiteral("<http://www.w3.org/1999/02/22-rdf-syntax-ns#first>"),
                arg), (IExpression) result);
        conjunction.addExpr(item);
        final RulePredicate next = new RulePredicate(
            new RuleVariable(itVar),
            new Constant(
                LiteralFactory
                    .createURILiteral("<http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>"),
                arg),
            ctr == 0 ? new Constant(
                LiteralFactory
                    .createURILiteral("<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>"),
                arg)
                : new RuleVariable(baseName + iteration));
        conjunction.addExpr(next);
        currentVariableScope.addVariable(new RuleVariable(itVar));
      }
      return conjunction;
    } catch (URISyntaxException e) {
      throw new RIFException(e.getMessage());
    }
View Full Code Here

  @Builtin(Name = "make-list")
  public static RuleList make_list(final Argument arg) {
    final RuleList result = new RuleList();
    for (final Item item : arg.arguments) {
      if (item instanceof Variable)
        result.addItem(new RuleVariable(item.getName()));
      else if (item instanceof Literal)
        result.addItem(new Constant((Literal) item, result));
      else if (item instanceof IExpression)
        result.addItem((IExpression) item);
    }
View Full Code Here

        if (first) {
          first = false;
          continue;
        }
        if (item instanceof Variable)
          list.addItem(new RuleVariable(item.getName()));
        else if (item instanceof Literal)
          list.addItem(new Constant((Literal) item, list));
        else if (item instanceof IExpression)
          list.addItem((IExpression) item);
      }
View Full Code Here

      list.getItems().clear();
      for (int i = 0; i < original.size(); i++) {
        final IExpression expr = original.get(i);
        if (i == index) {
          if (item instanceof Variable)
            list.addItem(new RuleVariable(item.getName()));
          else if (item instanceof Literal)
            list.addItem(new Constant((Literal) item, list));
          else if (item instanceof IExpression)
            list.addItem((IExpression) item);
        }
View Full Code Here

        && arg.arguments.get(1) instanceof Item) {
      final RuleList list = (RuleList) arg.arguments.get(0);
      final Item item = arg.arguments.get(1);
      IExpression lookingFor = null;
      if (item instanceof Variable)
        lookingFor = new RuleVariable(item.getName());
      else if (item instanceof Literal)
        lookingFor = new Constant((Literal) item, list);
      else if (item instanceof IExpression)
        lookingFor = (IExpression) item;
      final RuleList results = new RuleList();
View Full Code Here

  public IRuleNode visit(External obj, Object arg) throws RIFException {
    final Conjunction conjunction = new Conjunction();
    conjunction.setParent((IRuleNode) arg);

    RuleVariable alias = new RuleVariable(aliasString + aliasCtr++);
    conjunction.addExpr(alias);

    Equality comp = new Equality();
    comp.leftExpr = new RuleVariable(alias.getName());
    comp.leftExpr.setParent(comp);
    comp.rightExpr = obj;
    obj.setParent(comp);
    conjunction.addExpr(comp);

    currentVariableScope.addVariable(new RuleVariable(alias.getName()));
    return conjunction;
  }
View Full Code Here

TOP

Related Classes of lupos.rif.model.RuleVariable

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.