* 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))
{
Result = Const.YES;
}
IO.println(Result.toString());
return;
}
Prog E = new Prog(Goal, null);
for (int i = 0;; i++)
{
Term R = Prog.ask_engine(E);
// IO.mes("GOAL:"+Goal+"\nANSWER: "+R);
if (R == null)
{
IO.println("no");
break;
}
if (Names instanceof Fun)
{
Fun NamedR = (Fun) R.numberVars();
for (int j = 0; j < Names.getArity(); j++)
{
IO.println(((Fun) Names).getArg(j) + "=" + NamedR.getArg(j));
}
// IO.println(";");