Package lupos.rif

Examples of lupos.rif.RIFException


        used.addAll(obj.getBody().getVariables());
      }
      if (declared.size() < used.size()) {
        for (final RuleVariable var : used) {
          if (!declared.contains(var)) {
            throw new RIFException("Variable " + var.toString() + " not declared!");
          }
        }
      }
    }
    // Jede Variable muss gebunden sein im Variablenscope
    if (obj.isImplication()) {
      final Collection<RuleVariable> boundVars = new HashSet<RuleVariable>();
      // Boundvars intialisieren
      int initSize = 0;
      do {
        initSize = boundVars.size();
        for (final RuleVariable var : obj.getHead().getVariables()) {
          obj.getBody().isBound(var, boundVars);
        }
      } while (initSize < boundVars.size());
      // zweite Iteration, Ungebundene Variablen koennen an gebundene
      // gebunden werden
      for (final RuleVariable var : obj.getHead().getVariables()) {
        if (!boundVars.contains(var)) {
          throw new RIFException("Variable " + var.toString() + " not bound!");
        }
      }
    }
    // VariablenScope setzen
    this.declaredVars.addAll(declared);
View Full Code Here


  @Override
  public Object visit(final RulePredicate obj, final Object arg) throws RIFException {
    final VALIDATION flag = (VALIDATION) arg;
    if (flag == VALIDATION.NO_TRIPLE_AND_EXISTS) {
      throw new RIFException("Triple not allowed in Comparsion!");
    }
    if (!(obj.termName instanceof RuleVariable || obj.termName instanceof Constant)) {
      throw new RIFException("Relation " + obj.termName.toString()
          + " in Uniterm has to a Variable or Constant!");
    }
    return true;
  }
View Full Code Here

  @Override
  public Object visit(final ExistExpression obj, final Object arg) throws RIFException {
    final VALIDATION flag = (VALIDATION) arg;
    if (flag == VALIDATION.NO_TRIPLE_AND_EXISTS) {
      throw new RIFException("Exists not allowed in Comparsion!");
    }
    // variablenscopes �berpr�fen
    final Set<RuleVariable> declared = obj.getDeclaredVariables();
    final Set<RuleVariable> innerVars = obj.expr.getVariables();
    // Deklarierte Variablen d�rfen nicht schon deklariert sein (Scope)
    // und m�ssen vorkommen im Term
    for (final RuleVariable var : declared) {
      if (!innerVars.contains(var)) {
        throw new RIFException("Variable " + var.toString()
            + " is declared, but not used!");
      } else if (this.declaredVars.contains(var)) {
        throw new RIFException("Variable " + var.toString()
            + " in Exists is already declared!");
      }
    }

    // Jede Variable muss gebunden sein im Variablenscope
    final Collection<RuleVariable> boundVars = new HashSet<RuleVariable>();
    // Boundvars intialisieren
    int initSize = 0;
    do {
      initSize = boundVars.size();
      for (final RuleVariable var : declared) {
        obj.expr.isBound(var, boundVars);
      }
    } while (initSize < boundVars.size());
    // zweite Iteration, Ungebundene Variablen k�nnen an gebundene
    // gebunden werden
    for (final RuleVariable var : declared) {
      if (!boundVars.contains(var)) {
        throw new RIFException("Variable " + var.toString()
            + " not bound!");
      }
    }

    this.declaredVars.addAll(declared);
View Full Code Here

  @Override
  public Object visit(final Constant obj, final Object arg) throws RIFException {
    final VALIDATION flag = (VALIDATION) arg;
    if (flag == VALIDATION.CHECK_FOR_SINGLE_CONSTANTS_VARIABLES
        || flag == VALIDATION.ALLOW_SINGLE_VARIABLES_TRIPLES) {
      throw new RIFException("Single Constant " + obj.toString()
          + " found!");
    }
    return true;
  }
View Full Code Here

  @Override
  public Object visit(final RuleVariable obj, final Object arg) throws RIFException {
    final VALIDATION flag = (VALIDATION) arg;
    if (flag == VALIDATION.CHECK_FOR_SINGLE_CONSTANTS_VARIABLES) {
      throw new RIFException("Single Variable " + obj.toString()
          + " found!");
    }
    return true;
  }
View Full Code Here

    super();
    this.indexScanCreator = indexScanCreator;
  }

  public Object visit(RuleList obj, Object arg) throws RIFException {
    throw new RIFException("Lists should be translated to Triples before processing in Operatorgraph!");
  }
View Full Code Here

   */
  protected boolean filter(final Bindings bind, final Object result){
    try {
      return Helper.booleanEffectiveValue(result);
    } catch (final TypeErrorException e) {
      throw new RIFException(e.getMessage());
    }
  }
View Full Code Here

  public void setName(Literal name) {
    if (name instanceof URILiteral)
      this.name = (URILiteral) name;
    else
      throw new RIFException("Predicatename can only be URILiteral!");
  }
View Full Code Here

TOP

Related Classes of lupos.rif.RIFException

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.