Hey there. This is my very first experience using Prolog, and I’m doing so through JPL. To summarize what I’m trying to achieve, I want to be able to swap between using different source files with regularity due to the nature of my program, which models the sharing of knowledge between agents.
Lets say I consult an agent’s knowledge base and query it for the presence of a predicate, independent from other knowledge bases, then repeat for all agents. Currently, each consult seems to include new predicates alongside any previously loaded, meaning if the predicate is found in one knowledge base, the following queries will all detect its presence. I need only one knowledge base to be considered at a time, and I’m clearly missing something in how these queries work.
I’m aware that re-initialization is not supported by JPL, and you can only have one Prolog instance at a time (in a single thread?), so I tried multi-threading, each thread existing to consult and query a different knowledge base once, so each thread could use a Separate SWI Prolog engine. I feel like this is close to what I want, but my issue persists. I’ve tried using unload_file, didn’t change anything. I suppose I could try to retract all predicates every time I want to reset?
Is there a better way to achieve what I’m aiming for?