info-gnuprologjava
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Info-gnuprologjava] FW: problem in creating complex prolog queries , qu


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);

 

 

 

 

 

=======================================

 

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are not
to copy, disclose, or distribute this e-mail or its contents to any other person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
every reasonable precaution to minimize this risk, but is not liable for any damage
you may sustain as a result of any virus in this e-mail. You should carry out your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

reply via email to

[Prev in Thread] Current Thread [Next in Thread]