Pengine Error: Arguments are not sufficiently instantiated

168 views
Skip to first unread message

dagobi

unread,
Sep 29, 2016, 12:39:08 AM9/29/16
to SWI-Prolog
We have a (predicate) query that runs fine and returns correct results when it's run with swipl (command line). However the same query gives the following error when it's run with pengine.ask(query,opts) from a web page. What could be the problem or where should we look into? 

I know it would be better if I could provide an example but it's really hard to write a test program with the same issue without knowing why we had the issue with the Pengines JavaScript API. Any advices would be greatly appreciated. In the meantime I will try to come up with an example.

Output


Error: Arguments are not sufficiently instantiated Reachable from: mytest:module1(20,A,B,C) mytest:module2(20,A,B,C,D) mytest:module3(20,[test],A,B,C) mytest:module4(10,20,[test],A,B,C,D)

Eyal Dechter

unread,
Sep 29, 2016, 9:38:10 AM9/29/16
to dagobi, SWI-Prolog
At the very least, the form of the query and options you are passing to pengine:ask would be useful.

Eyal

--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.

dagobi

unread,
Oct 3, 2016, 11:31:06 PM10/3/16
to SWI-Prolog, zack...@gmail.com
Thanks Eyal. Sorry for the late reply. The ask call is similar to that of the genealogist example, something like the following. Hope this helps. Again, running the same query on a swipl prompt returns correct results with no issues. Thanks again in advance!!

<input type="text" id="query" value="mytest:module4(10,20,[test],A,B,C,D)">
<button onclick="query()">Ask</button>

<script type="text/javascript">
          var pengine;
          function query() {
              pengine = new Pengine({
                  application: 'mytest',
                  ask: $("#query").val(),
                  onsuccess: handleSuccess,
                  onfailure: handleFailure,
                  onerror:   handleError
              });
          }
On Thursday, September 29, 2016 at 8:38:10 AM UTC-5, Eyal Dechter wrote:
At the very least, the form of the query and options you are passing to pengine:ask would be useful.

Eyal
On Thu, Sep 29, 2016 at 12:39 AM, dagobi <zack...@gmail.com> wrote:
We have a (predicate) query that runs fine and returns correct results when it's run with swipl (command line). However the same query gives the following error when it's run with pengine.ask(query,opts) from a web page. What could be the problem or where should we look into? 

I know it would be better if I could provide an example but it's really hard to write a test program with the same issue without knowing why we had the issue with the Pengines JavaScript API. Any advices would be greatly appreciated. In the meantime I will try to come up with an example.

Output


Error: Arguments are not sufficiently instantiated Reachable from: mytest:module1(20,A,B,C) mytest:module2(20,A,B,C,D) mytest:module3(20,[test],A,B,C) mytest:module4(10,20,[test],A,B,C,D)

--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.

Torbjörn Lager

unread,
Oct 4, 2016, 6:55:22 AM10/4/16
to dagobi, SWI-Prolog
Hi dagobi,

The Help menu of SWISH, under Help/Caveats, most likely explains the trouble you have. Here is the relevant section:

Sandboxing

SWISH cannot provide unrestricted access to Prolog because Prolog gives unrestricted access to the operating system. Therefore, SWISH examines each goal on safety before execution. This process unfolds the call-tree and verifies all called predicates against a whitelist. It fails on three occasions:

  • If insufficient information is available to decide what will be called. E.g., ?- read(X), call(X). Such errors are raised as instantiation errors.
  • If a predicate is found that is not whitelisted. Such errors are raised as permission errors
  • If a called predicate is not defined. Such errors are raised as existence errors

If any of the above happens, the error is printed, along with a chain of intermediate goals that should help finding the culprit. Note that the whitelist is incomplete, i.e., there are many predicates that can be considered safe that are not on the list. Please report such omissions as bugs.

Cheers,
Torbjörn




To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+unsubscribe@googlegroups.com.



--
Torbjörn Lager
Professor of General and Computational Linguistics
Department of Philosophy, Linguistics and Theory of Science
University of Gothenburg
Box 200, SE-405 30 Gothenburg, Sweden
Phone: +46317864962

dagobi

unread,
Oct 8, 2016, 12:36:17 AM10/8/16
to SWI-Prolog, zack...@gmail.com
Thanks Torbjörn. 

However I still do not understand why it works with swipl (directly) but fails to work with pengine.ask. Would this imply a problem with the pengine javascript package? Or would it mean pengine is more strict?

I have simplified my test program as follows, still getting the same error with pengine.ask. Sorry I am not able to share the entire program.

query1(Input1, Input2, Output1, Output2):-
sub_query1(Input1, Input2, Output3), 
sub_query2(Input1, Output3, Output1, Output2). 

Error: Arguments are not sufficiently instantiated Reachable from: mytest:sub_query2(88,A,B,C) mytest:query1(88,[hello],A,B)

Both sub_query1 and sub_query2 work individually with pengine.ask from a web page - Does this mean the arguments have been instantiated properly?

Again  query1 does not work with pengine.ask, although it works with swipl.
 
Thanks in advance as always!
Reply all
Reply to author
Forward
0 new messages