1

I am trying to query a dynamic module of a prolog file using JPL. Thanks to this question( how to consult file as a module in jpl) I was able to consult, assert to, and retract from the module with Query objects declared as such:

assertFact = new Query("assert(mod1:"+fact.toString()+")");

retractFact = new Query("retract(mod1:"+fact.toString()+")");

consultQuery = new Query("mod1:consult('"+rulesPath+"')");

However, I am unable to query predicates within the file using similar calls, such as

legalMovesQuery = new Query("mod1:legal("+playerName+",Move)");

or

nextQuery = new Query("mod1:next(Role,Action)");

It always returns the results from the non-module instance of prolog I have running simultaneously. I find this particularly odd, because I am able to successfully run this query:

dynamicQuery = new Query("mod1:predicate_property(X,dynamic),\\+predicate_property(X,built_in),\\+predicate_property(X,number_of_clauses(0))");

Maybe it is because all of the queries that are not working are within the file, and so the syntax doesn't work the same way? I don't know, I'm just spitballing.

So, any ideas on how I might be able to query the module I have created?

Community
  • 1
  • 1

0 Answers0