Package net.sf.kpex.prolog

Examples of net.sf.kpex.prolog.Clause


    if (null == C)
    {
      return null;
    }
    Term Vs = C.varsOf();
    Clause SuperC = new Clause(Vs, C);
    SuperC.dict = C.dict;
    Clause NamedSuperC = SuperC.cnumbervars(false);
    Term Ns = NamedSuperC.getHead();
    Term NamedC = NamedSuperC.getBody();
    return new Fun("clause", C, Vs, NamedC, Ns);
  }
View Full Code Here


  }

  @Override
  public Term getElement()
  {
    Clause C = null;
    if (/* IO.peer!=null && */reader.equals(IO.input))
    {
      String s = IO.promptln(">:");
      if (null == s || 0 == s.length())
      {
        C = null;
      }
      else
      {
        C = new Clause(s, builtinDb);
      }
    }
    else if (null != parser)
    {
      if (parser.atEOF())
      {
        C = null;
        stop();
      }
      else
      {
        C = parser.readClause();
      }
      if (C != null && C.getHead().eq(Const.EOF))
      {
        C = null;
        stop();
      }
    }
View Full Code Here

      if (p.atEOF())
      {
        return;
      }
      int begins_at = p.lineno();
      Clause C = p.readClause();
      if (null == C)
      {
        return;
      }
      if (Parser.isError(C))
      {
        Parser.showError(C);
      }
      else
      {
        // IO.mes("ADDING= "+C.pprint());
        processClause(C, ktable);
        C.setFile(fname, begins_at, p.lineno());
      }
    }
  }
View Full Code Here

   * "the('[]'(VarsOfQuery))" containing a binding of the variables or the
   * first solution to the query or "no" if no such solution exists
   */
  public static String askJinni(String query)
  {
    Clause Goal = getGoal(query);
    Term Body = Goal.getBody();
    return askJinni(Body).prettyPrint();
  }
View Full Code Here

  /**
   * evalutes a query
   */
  public static void evalGoal(Clause Goal)
  {
    Clause NamedGoal = Goal.cnumbervars(false);
    Term Names = NamedGoal.getHead();
    if (!(Names instanceof Fun))
    { // no vars in Goal
      Term Result = Prog.firstSolution(Goal.getHead(), Goal.getBody());
      if (!Const.NO.eq(Result))
      {
View Full Code Here

    }
  }

  public static Clause getGoal(String line)
  {
    Clause G = Clause.goalFromString(line, builtinDb);
    // IO.mes("getGoal: "+G+" DICT: "+G.dict); //OK
    return G;
  }
View Full Code Here

    return true;
  }

  public static void run_query(String query)
  {
    Clause Goal = getGoal(query);
    timeGoal(Goal);
  }
View Full Code Here

  public static void standardTop(String prompt)
  {
    for (;;)
    {
      Clause G = getGoal(IO.promptln(prompt));
      if (null == G)
      {
        continue;
      }
      IO.peer = null;
View Full Code Here

  }

  @Override
  public int exec(Prog p)
  {
    Clause goal = getArg(0).toClause();
    Prog newp = new Prog(goal, p);
    Unfolder S = new Unfolder(goal, newp);
    return putArg(1, S, p);
  }
View Full Code Here

  }

  @Override
  public int exec(Prog p)
  {
    Clause goal = new Clause(getArg(0), getArg(1));
    Prog U = new Prog(goal, p);
    return putArg(2, U, p);
  }
View Full Code Here

TOP

Related Classes of net.sf.kpex.prolog.Clause

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.