I was looking for a Prolog interpreter embedded in Java and this project took my interest.
I am reading the setup instructions in the user manual (http://www.gnu.org/software/gnuprologjava/manual/Constructing-Terms.html#Constructing-Terms) and there is something that is not entirely clear to me. Quoting relevant sentences from the manual:
---
..."load any prolog files you want to which define additional predicates etc using environment.ensureLoaded(AtomTerm.get(``URL of file''))
for each file. " ...
"you will need to create at least one gnu.prolog.vm.Interpreter which is used to execute goals. You do this using environment.createInterpreter()
. "
"Having created it you need to use it to run the initialization of
any files you have loaded by using env.runInitialization(interpreter);
. This ensures the goals contained in any “:- initialization(goal).” or “:- goal.”s in the files you have loaded are run."
---
Does it mean that the only mechanism for loading files is with "environment.ensureLoaded" ? So the ISO predicate "ensure_loaded/1" does not work ?
I am wondering if there is a way to load
additional files after the Interpreter has been created and initialized with
"env.runInitialization(...)"
?
I guess that in case "
environment.ensureLoaded(...)" needs to be called again AFTER the instantiation and initialization of the interpreter then
"env.runInitialization(...)" should also be called again in order to load any
“:- initialization(goal).” or “:- goal.”s in the new loaded file ???.
If this is correct, does it mean that all
the initialization directives that were executed in the first call to
"env.runInitialization(...)" will be executed again ?
Thanks for any help on this regard,
cheers,
Sergio