[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Info-gnuprologjava] Problem on firing a query
From: |
Daniel Thomas |
Subject: |
Re: [Info-gnuprologjava] Problem on firing a query |
Date: |
Mon, 04 Jun 2012 12:33:18 +0100 |
Change the call to runOnce to a call to prepareGoal and then execute and
you will get a more helpful error message.
Daniel
On Mon, 2012-06-04 at 12:21 +0530, Suman Roy wrote:
> Hi,
>
> Actually we are facing a different issue. When we are creating a query,
> ?- limited_history(H,5), happens3(end(sendFreightInvoice1), _, H).
>
> through the JAR file (will send you the source JAVA file in a separate mail),
> we are getting the error, ``the current goal is not active''.
>
> However, when we simply type the query on the SWI editor the query is working
> fine, that is, giving all the substitutions.
>
> Regards,
> --Suman
>
>
>
>
>
>
>
>
> Suman Roy, Ph.D.
> Infosys LABS,
> Infosys Technologies Ltd.,
> Bangalore, India.
> Mob. +91 98860 23203
>
>
> -----Original Message-----
> From: Daniel Thomas [mailto:address@hidden
> Sent: Saturday, June 02, 2012 6:47 PM
> To: Suman Roy
> Cc: Jagadish Koneti; address@hidden
> Subject: RE: [Info-gnuprologjava] Problem on firing a query
>
> The stacktrace you get if you use prepareGoal and then execute rather than
> just runOnce is:
>
> gnu.prolog.vm.PrologException: error(existence_error(procedure,not / 1),error)
> at gnu.prolog.vm.PrologException.getError(PrologException.java:129)
> at gnu.prolog.vm.PrologException.getError(PrologException.java:118)
> at
> gnu.prolog.vm.PrologException.existenceError(PrologException.java:155)
> at
> gnu.prolog.vm.UndefinedPredicateCode.execute(UndefinedPredicateCode.java:62)
> at
> gnu.prolog.vm.interpreter.InterpretedByteCode.execute(InterpretedByteCode.java:522)
> at
> gnu.prolog.vm.interpreter.InterpretedByteCode.execute(InterpretedByteCode.java:522)
> at
> gnu.prolog.vm.interpreter.InterpretedByteCode.execute(InterpretedByteCode.java:522)
> at
> gnu.prolog.vm.interpreter.Predicate_call.staticExecute(Predicate_call.java:144)
> at gnu.prolog.vm.Interpreter.execute(Interpreter.java:507)
> at Fresh_06.main(Fresh_06.java:74)
>
> This indicates that the predicate not/1 is not defined which is a problem you
> came across before. You can trivially implement not/1 in terms of \+/1 and
> ensureLoaded this before loading the latest-rule prolog file and then
> everything should just work (I get success when I run your code having done
> that).
> not(X):- \+(X).
>
> I hope that helps,
>
> Daniel
>
> On Fri, 2012-06-01 at 15:25 +0530, Suman Roy wrote:
> > system(system1).
> > accountingSupplier(accountingSupplier1).
> > accountingCustomer(accountingCustomer1).
> > sendFreightInvoice(sendFreightInvoice1).
> > receiveFreightInvoice(receiveFreightInvoice1).
> > dofulfillmentProcess(dofulfillmentProcess1).
> > dopaymentProcess(dopaymentProcess1).
> > dofreightBillingProcess(dofreightBillingProcess1).
> > document(freightInvoice1).
> >
> > raiseDoc(accountingSupplier1,freightInvoice1).
> > relDocAgent(freightInvoice1,accountingSupplier1).
> > relDocAgent(freightInvoice1,accountingCustomer1).
> >
> > process(fulfillmentProcess1).
> > process(freightBillingProcess1).
> > process(paymentProcess1).
> >
> >
> >
> > qualified(system1,dofulfillmentProcess1).
> > qualified(accountingSupplier1,dofreightBillingProcess1).
> > qualified(accountingCustomer1,dofreightBillingProcess1).
> > qualified(system1,dopaymentProcess1).
> > qualified(system1,dofreightBillingProcess1).
> > qualified(accountingSupplier1,sendFreightInvoice1).
> > qualified(accountingCustomer1,receiveFreightInvoice1).
> >
> > agent(X):-system(X).
> > agent(X):-accountingSupplier(X).
> > agent(X):-accountingCustomer(X).
> >
> > activity(X):-sendFreightInvoice(X).
> > activity(X):-receiveFreightInvoice(X).
> > activity(X):-dofulfillmentProcess(X).
> > activity(X):-dopaymentProcess(X).
> > activity(X):-dofreightBillingProcess(X).
> >
> >
> > holds_at(P,T,H):-initiates(E,P),happens3(E,T1,H),T1<T,
> > not( terminated_between(P,T1,T,H) ).
> >
> > terminated_between(P,T1,T2,H):-terminates(E,P),happens3(E,T,H),T1=<T,T=<T2.
> >
> > happens3(start(A),T,H):-member(happens(start(A),T),H).
> > happens3(end(A),T2,H):-happens3(start(A),T1,H),dur(A,Y),T2 is T1+Y.
> >
> > step(happens(start(A),T),H):-sequential(A0,A),happens3(end(A0),T,H),
> > not( happens3(start(A),T,H) ).
> >
> > history([happens(start(dofulfillmentProcess1),-1)]).
> > history([Happens|H]):-history(H),step(Happens,H).
> >
> > limited_history( [happens(start(dofulfillmentProcess1),-1)], N ) :-
> > 0<N.
> > limited_history( [Happens|H], N ) :- 1<N, N1 is N-1,
> > limited_history( H, N1 ),
> > step(Happens,H).
> >
> >
> > initiates(end(dofulfillmentProcess1),initiationfreightBillingProcess).
> >
> >
> > initiates(start(dopaymentProcess1),closurefreightBillingProcess).
> >
> > dur(dofulfillmentProcess1,0).
> > dur(dopaymentProcess1,2).
> > dur( sendFreightInvoice1, 1 ).
> > dur( receiveFreightInvoice1, 1 ).
> >
> > sequential(dofulfillmentProcess1,sendFreightInvoice1).
> > sequential(sendFreightInvoice1,receiveFreightInvoice1).
> > sequential(receiveFreightInvoice1,dopaymentProcess1).
> >
> > terminates( a, a ).
>
> **************** 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***
signature.asc
Description: This is a digitally signed message part