|
From: | Suman Roy |
Subject: | [Info-gnuprologjava] FW: problem in creating complex prolog queries , queries created by conjugating more that 5 simple queries . |
Date: | Thu, 17 May 2012 14:12:15 +0530 |
Hello , I want to construct a complex prolog query with the help of “ gnu prolog “ jar file , which will be conjugation of 5 simple prolog queries . For instance : :- p (a) , q(b), r(c), s(d ), l(e ) . But gnu prolog is showing an error message , “ The goal is not currently active ”. Can you please let me what can be done to create such queries? rules_01.pl file : -------- p (a). q(b). r(c). s(d ). l(e ) . Code snippet : ----------------- Term t1[] = {AtomTerm.get("a")}; Term t2[] = {AtomTerm.get("b")}; Term t3[] = {AtomTerm.get("c")}; Term t4[] = {AtomTerm.get("d")}; Term t5[] = {AtomTerm.get("e”)}; CompoundTerm ct1=new CompoundTerm("p",t1); CompoundTerm ct2=new CompoundTerm("q",t2); CompoundTerm ct3=new CompoundTerm("r",t3); CompoundTerm ct4=new CompoundTerm("s",t4); CompoundTerm ct5=new CompoundTerm("l",t5); String functor = ","; CompoundTerm mt1 = new CompoundTerm(functor, 2); mt1.args[0]=ct1; mt1.args[1]=ct2; CompoundTerm mt2 = new CompoundTerm(functor, 2); mt2.args[0]=mt1; mt2.args[1]=ct3; CompoundTerm mt3 = new CompoundTerm(functor, 2); mt3.args[0]=mt2; mt3.args[1]=ct4; CompoundTerm mt4 = new CompoundTerm(functor, 2); mt3.args[0]=mt3; mt3.args[1]=ct5; int rc = in.runOnce(mt4); =======================================
|
[Prev in Thread] | Current Thread | [Next in Thread] |