1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| import jpl.*;
import java.util.Hashtable;
public class Test2 {
//private static Variable X = new Variable();
/**
* @param args
*/
public Test2(){
}
public void run(){
// Test2 Test =new Test2();
try
{
/* String t1 = "consult"(["fam.pl"]);
Query q1 = new Query(
"consult",
new Term[] {new Atom("['fam.pl']")});
boolean t2 = (q1.query());
System.out.println( t1 + "test " + t2);*/
String t1 = "consult('D:/workspace/conflictDetector/src/fam')";
Query q1 = new Query(t1);
System.out.println( t1 + " " + (q1.hasSolution() ? "succeeded" : "failed") );
}
catch(Exception e)
{
System.out.println("erreur " + e.toString());
return;
}
}
public void run1(){
Variable X = new Variable();
Term args[] = { X, new Atom("joe" )};
Query q4 =
new Query(
"child_of",
args);
java.util.Hashtable[] solutions = q4.allSolutions();
for ( int i=0 ; i< solutions.length ; i++ ) {
System.out.println( "X = " + (solutions[i].get(X)));
}
System.out.println(" Test" + " " + solutions.length);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Test2 Test = new Test2();
Test.run();
Test.run1();
}
} |
Partager