Problem with AMZI Prolog 
Author Message
 Problem with AMZI Prolog

Hello

This should be a simple problem, but it's got me beaten at the moment.
I have mailed AMZI support too, but maybe someone here knows how to fix
it, and it is really holding me up at the moment.

I have written some Prolog code that I have been testing with Listener,
but now I come to use it from a Java program, I am having problems with
some of the calls.  I can reproduce the problem with the following very
simple example.

Here is a sample prolog file.

    doInit(Value) :- assert(data(test, value, Value)).
    doCall(Funct, Arg) :- Goal =.. [Funct, Arg], call(Goal).

Working from listener, I can type:
    ?- doInit(value1).

    yes
    ?- doCall(doInit, value2).

    yes
    ?- data(X, Y, Z).

    X = test
    Y = value
    Z = value1 ;

    X = test
    Y = value
    Z = value2 ;
    no
    ?-

But when I try the same thing from Java, using the code below:

    import amzi.ls.*;

    class Test
    {
        public static void main(String args[])
            throws LSException
        {
            LogicServer ls = new LogicServer();
            ls.Init("");
            ls.Load("test.xpl");

            ls.ExecStr("doInit(value1)");   // this guy works
            ls.ExecStr("doCall(doInit, value2)"); // this guy fails

            String sQuery = "data(X, Y, Z)";
            long term = ls.CallStr(sQuery);
            do
            {
                System.out.println(ls.TermToStr(term, 100));
            }
            while (ls.Redo());

            ls.Close();
        }
    }

all that is printed is:
    data(test, value, value1)

That is, the 'call' fails!

Anyone have any ideasn what's going wrong?  AMZI have quite good
documentation, but I've not been able to find anything relevant to this
problem.

Thanks

Ken

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Fri, 15 Nov 2002 03:00:00 GMT  
 Problem with AMZI Prolog
Hi,

Our tech support folks have e-mailed you directly on this problem.

Regards,
Mary Kroening

Quote:

> Hello

> This should be a simple problem, but it's got me beaten at the moment.
> I have mailed AMZI support too, but maybe someone here knows how to fix
> it, and it is really holding me up at the moment.

> I have written some Prolog code that I have been testing with Listener,
> but now I come to use it from a Java program, I am having problems with
> some of the calls.  I can reproduce the problem with the following very
> simple example.

> Here is a sample prolog file.

>     doInit(Value) :- assert(data(test, value, Value)).
>     doCall(Funct, Arg) :- Goal =.. [Funct, Arg], call(Goal).

> Working from listener, I can type:
>     ?- doInit(value1).

>     yes
>     ?- doCall(doInit, value2).

>     yes
>     ?- data(X, Y, Z).

>     X = test
>     Y = value
>     Z = value1 ;

>     X = test
>     Y = value
>     Z = value2 ;
>     no
>     ?-

> But when I try the same thing from Java, using the code below:

>     import amzi.ls.*;

>     class Test
>     {
>         public static void main(String args[])
>             throws LSException
>         {
>             LogicServer ls = new LogicServer();
>             ls.Init("");
>             ls.Load("test.xpl");

>             ls.ExecStr("doInit(value1)");   // this guy works
>             ls.ExecStr("doCall(doInit, value2)"); // this guy fails

>             String sQuery = "data(X, Y, Z)";
>             long term = ls.CallStr(sQuery);
>             do
>             {
>                 System.out.println(ls.TermToStr(term, 100));
>             }
>             while (ls.Redo());

>             ls.Close();
>         }
>     }

> all that is printed is:
>     data(test, value, value1)

> That is, the 'call' fails!

> Anyone have any ideasn what's going wrong?  AMZI have quite good
> documentation, but I've not been able to find anything relevant to this
> problem.

> Thanks

> Ken

> Sent via Deja.com http://www.deja.com/
> Before you buy.

--

----------------------------------------------------------------------------
|  Amzi! inc.                              Intelligent Components,
Agents  |
|  5861 Greentree Road                                    and
Logic-Bases  |
|  Lebanon, OH 45036 U.S.A.                       for C/C++, Java,
Delphi, |
|  tel      +1 513 425 8050                      VB, Web Servers and
more  |
|  fax      +1 513 425 8025                                        
with  |

Server  |
|  web      http://www.amzi.com                                 and
WebLS  |
----------------------------------------------------------------------------



Fri, 15 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Amzi Prolog versus LPA Prolog.

2. Amzi-Prolog vs. Visual Prolog

3. Searching Amzi Prolog with Smalltalk examples

4. Amzi Prolog - Newbie Question

5. Amzi Prolog - Warplan exame: extending it

6. Amzi Prolog for the Web

7. Amzi! Prolog

8. Random in Amzi Prolog

9. How Do I: Browser-Enable Amzi Prolog Program

10. Amzi Prolog and SQL Server

11. How to use COM with Amzi Prolog

12. AMZI! Prolog and for/4

 

 
Powered by phpBB® Forum Software