Package ru.bmstu.datalog.data

Examples of ru.bmstu.datalog.data.Predicate


    String name = parseName();   
    parseSymbol('(');   
    ArrayList<Argument> arguments = parseArguments();
    parseSymbol(')');
   
    return new Predicate(name, arguments);
  }
View Full Code Here


      ArrayList<Argument> args = new ArrayList<Argument>();
     
      for (int i = 0; i < predicate.size(); ++i)
        args.add(new Argument(resultSet.getString("f" + i)));
     
      answer.add(new Predicate(predicate.getName(), args));
    }   
   
    return answer;
 
View Full Code Here

       
        ArrayList<Unifier> unifierList = new ArrayList<Unifier>();     //Start with a list of substitutions, which consists of a single empty substitution.
        unifierList.add(new Unifier());
       
        for (int i = 0; i < rule.getBody().size(); ++i) {
          Predicate predicate = rule.getBody().get(i);        //Iterate through all the predicates of the body using select Function
          ArrayList<Unifier> localUnifierList = new ArrayList<Unifier>();
         
          for (Unifier unifier : unifierList) {        //For each permutation of the list.
            Predicate localPredicate = unifier.unifyPredicate(predicate)//Apply it to the predicate.       
           
            HashSet<Predicate> tempAnswers;
           
            if (ruleNames.contains(new PredicateIdentifier(predicate))) {  //If the predicate occurs in the program as the head rules: //TODO вынести проверку на уровень выше
              executeRequest(getRequest(localPredicate));      //Recursively run executeRequest of this predicate.
View Full Code Here

      if (arg.isVariable())  
        evaluateVariable(hash, arg);
      args.add(arg);
    }
   
    return new Predicate(predicate.getName(),args);
  }
View Full Code Here

   
    for (Rule rule : rules) {
      Unifier unifier = Unifier.produceMostGeneralUnifier(rule.getHead(), request);
     
      if (unifier != null) {
        Predicate answerHead =  unifier.unifyPredicate(rule.getHead());
       
        ArrayList<Predicate> answerBody = new ArrayList<Predicate>();
        for (Predicate predicate : rule.getBody())
          answerBody.add(unifier.unifyPredicate(predicate));
       
View Full Code Here

   
    for (int i = 0; i < predicate.size(); i++) {
      args.add(unify(predicate.get(i)));
    }
   
    return new Predicate(predicate.getName(),args);
   
  }
View Full Code Here

TOP

Related Classes of ru.bmstu.datalog.data.Predicate

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.