00001 package jpl.test; 00002 00003 import jpl.Query; 00004 import jpl.Term; 00005 00006 public class FetchBigTree { 00007 public static void main(String[] args) { 00008 // Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "D:/pcm/bin/pcm.ini", "-g", "pcm_2000" }); 00009 (new Query("consult('jpl/test/test.pl')")).oneSolution(); 00010 Term t = (Term)((new Query("p(18,T)")).oneSolution().get("T")); 00011 int i = 1; 00012 while ( t.hasFunctor("a", 2)){ 00013 t = t.arg(2); 00014 i = i+1; 00015 } 00016 System.err.println("got a tree of " + i+" generations"); 00017 } 00018 }